Commit d9def1e4 authored by sletz's avatar sletz
Browse files

In JackCoreAudioDriver::Start, wait for the audio driver to effectively start...

In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3681 0c269be4-1314-0410-8aa9-9f06e86f4224
parent aab8a77b
......@@ -25,6 +25,10 @@ Paul Davis
Jackdmp changes log
---------------------------
2009-10-29 Stephane Letz <letz@grame.fr>
* In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback).
2009-10-28 Stephane Letz <letz@grame.fr>
* In JackCoreAudioDriver, force the SR value to the wanted one *before* creating aggregate device (otherwise creation will fail).
......
......@@ -227,6 +227,9 @@ OSStatus JackCoreAudioDriver::MeasureCallback(AudioDeviceID inDevice,
driver->fEngineControl->fComputation = driver->fEngineControl->fPeriod * driver->fComputationGrain;
}
// Signal waiting start function...
driver->fState = true;
// Setup threadded based log function
set_threaded_log_function();
return noErr;
......@@ -824,7 +827,7 @@ int JackCoreAudioDriver::SetupSampleRateAux(AudioDeviceID inDevice, jack_nframes
// Waiting for SR change notification
int count = 0;
while (!fState && count++ < 100) {
while (!fState && count++ < WAIT_COUNTER) {
usleep(100000);
jack_log("Wait count = %d", count);
}
......@@ -1376,8 +1379,22 @@ int JackCoreAudioDriver::Start()
printError(err);
return -1;
}
return 0;
// Waiting for Measure callback to be called ( = driver has started)
fState = false;
int count = 0;
while (!fState && count++ < WAIT_COUNTER) {
usleep(100000);
jack_log("JackCoreAudioDriver::Start wait count = %d", count);
}
if (count < WAIT_COUNTER) {
jack_info("CoreAudio driver is running...");
return 0;
} else {
jack_error("CoreAudio driver cannot start...");
return -1;
}
}
int JackCoreAudioDriver::Stop()
......
......@@ -36,6 +36,8 @@ typedef UInt8 CAAudioHardwareDeviceSectionID;
#define kAudioDeviceSectionOutput ((CAAudioHardwareDeviceSectionID)0x00)
#define kAudioDeviceSectionGlobal ((CAAudioHardwareDeviceSectionID)0x00)
#define kAudioDeviceSectionWildcard ((CAAudioHardwareDeviceSectionID)0xFF)
#define WAIT_COUNTER 60
/*!
\brief The CoreAudio driver.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment