19
19
#include " ../AudioReaderSource.h"
20
20
#include " ../AudioDevices.h"
21
21
#include " ../Settings.h"
22
+ #include " ../ZmqLogger.h"
22
23
23
24
#include < mutex>
24
25
#include < thread> // for std::this_thread::sleep_for
25
26
#include < chrono> // for std::chrono::milliseconds
27
+ #include < sstream>
26
28
27
29
using namespace juce ;
28
30
@@ -53,6 +55,12 @@ namespace openshot
53
55
m_pInstance->currentAudioDevice .type = " " ;
54
56
m_pInstance->defaultSampleRate = 0.0 ;
55
57
58
+ std::stringstream constructor_title;
59
+ constructor_title << " AudioDeviceManagerSingleton::Instance (default audio device type: " <<
60
+ Settings::Instance ()->PLAYBACK_AUDIO_DEVICE_TYPE << " , default audio device name: " <<
61
+ Settings::Instance ()->PLAYBACK_AUDIO_DEVICE_NAME << " )" ;
62
+ ZmqLogger::Instance ()->AppendDebugMethod (constructor_title.str (), " channels" , channels);
63
+
56
64
// Get preferred audio device type and name (if any - these can be blank)
57
65
openshot::AudioDeviceInfo requested_device = {Settings::Instance ()->PLAYBACK_AUDIO_DEVICE_TYPE ,
58
66
Settings::Instance ()->PLAYBACK_AUDIO_DEVICE_NAME };
@@ -102,6 +110,10 @@ namespace openshot
102
110
// do not support 48000 causing no audio device to be found.
103
111
int possible_rates[] { rate, 48000 , 44100 , 22050 };
104
112
for (int attempt_rate : possible_rates) {
113
+ std::stringstream title_rate;
114
+ title_rate << " AudioDeviceManagerSingleton::Instance (attempt audio device name: " << attempt_device.name << " )" ;
115
+ ZmqLogger::Instance ()->AppendDebugMethod (title_rate.str (), " rate" , attempt_rate, " channels" , channels);
116
+
105
117
// Update the audio device setup for the current sample rate
106
118
m_pInstance->defaultSampleRate = attempt_rate;
107
119
deviceSetup.sampleRate = attempt_rate;
@@ -121,11 +133,22 @@ namespace openshot
121
133
// Persist any errors detected
122
134
m_pInstance->initialise_error = audio_error.toStdString ();
123
135
136
+ if (!m_pInstance->initialise_error .empty ()) {
137
+ std::stringstream title_error;
138
+ title_error << " AudioDeviceManagerSingleton::Instance (audio device error: " <<
139
+ m_pInstance->initialise_error << " )" ;
140
+ ZmqLogger::Instance ()->AppendDebugMethod (title_error.str (), " rate" , attempt_rate, " channels" , channels);
141
+ }
142
+
124
143
// Determine if audio device was opened successfully, and matches the attempted sample rate
125
144
// If all rates fail to match, a default audio device and sample rate will be opened if possible
126
145
foundAudioIODevice = m_pInstance->audioDeviceManager .getCurrentAudioDevice ();
127
146
if (foundAudioIODevice && foundAudioIODevice->getCurrentSampleRate () == attempt_rate) {
128
147
// Successfully tested a sample rate
148
+ std::stringstream title_found;
149
+ title_found << " AudioDeviceManagerSingleton::Instance (successful audio device found: " <<
150
+ foundAudioIODevice->getTypeName () << " , name: " << foundAudioIODevice->getName () << " )" ;
151
+ ZmqLogger::Instance ()->AppendDebugMethod (title_found.str (), " rate" , attempt_rate, " channels" , channels);
129
152
break ;
130
153
}
131
154
}
@@ -136,6 +159,7 @@ namespace openshot
136
159
}
137
160
}
138
161
162
+ ZmqLogger::Instance ()->AppendDebugMethod (" AudioDeviceManagerSingleton::Instance (audio device initialization completed)" );
139
163
}
140
164
return m_pInstance;
141
165
}
0 commit comments