From 8d9c59287de0c4c9684cc6822f48b9d656bd26af Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 18 Jun 2006 18:55:48 +0000 Subject: [PATCH] Handle JackChanged getting called when the device is stopped. --- stepmania/src/arch/Sound/RageSoundDriver_CA.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp index 69438d6c93..00ac015a8d 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp @@ -486,8 +486,15 @@ OSStatus RageSound_CA::JackChanged( AudioDeviceID inDevice, UInt32 inChannel, Bo result ? "something" : "nothing") ); if( (error = AudioDeviceGetCurrentTime(inDevice, &time)) ) - FAIL_M( ERROR("Couldn't get current time when jack changed", error) ); - This->m_iOffset = This->m_iLastSampleTime - int64_t( time.mSampleTime ); + { + if( error != kAudioHardwareNotRunningError ) + FAIL_M( ERROR("Couldn't get current time when jack changed", error) ); + This->m_iOffset = This->m_iLastSampleTime; + } + else + { + This->m_iOffset = This->m_iLastSampleTime - int64_t( time.mSampleTime ); + } return noErr; }