diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/audaspace/OpenAL/AUD_OpenALDevice.cpp | 10 | ||||
-rw-r--r-- | intern/audaspace/jack/AUD_JackDevice.cpp | 11 | ||||
-rw-r--r-- | intern/audaspace/jack/AUD_JackDevice.h | 9 |
3 files changed, 22 insertions, 8 deletions
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp index a87a4ad5eef..5df7ec4fb0c 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp @@ -128,13 +128,15 @@ void AUD_OpenALDevice::updateStreams() ALint info; AUD_DeviceSpecs specs = m_specs; + ALCenum cerr; while(1) { lock(); alcSuspendContext(m_context); - + cerr = alcGetError(m_device); + if(cerr == ALC_NO_ERROR) { // for all sounds for(AUD_HandleIterator it = m_playingSounds->begin(); it != m_playingSounds->end(); it++) @@ -253,12 +255,12 @@ void AUD_OpenALDevice::updateStreams() alSourcePlay(sound->source); } } - } - alcProcessContext(m_context); + alcProcessContext(m_context); + } // stop thread - if(m_playingSounds->empty()) + if(m_playingSounds->empty() || (cerr != ALC_NO_ERROR)) { unlock(); m_playing = false; diff --git a/intern/audaspace/jack/AUD_JackDevice.cpp b/intern/audaspace/jack/AUD_JackDevice.cpp index 5aa3f7b3fc1..0d72e85c351 100644 --- a/intern/audaspace/jack/AUD_JackDevice.cpp +++ b/intern/audaspace/jack/AUD_JackDevice.cpp @@ -236,9 +236,9 @@ AUD_JackDevice::AUD_JackDevice(std::string name, AUD_DeviceSpecs specs, int buff create(); m_valid = true; - m_playing = false; m_sync = 0; m_syncFunc = NULL; + m_nextState = m_state = jack_transport_query(m_client, NULL); pthread_mutex_init(&m_mixingLock, NULL); pthread_cond_init(&m_mixingCondition, NULL); @@ -307,11 +307,13 @@ void AUD_JackDevice::playing(bool playing) void AUD_JackDevice::startPlayback() { jack_transport_start(m_client); + m_nextState = JackTransportRolling; } void AUD_JackDevice::stopPlayback() { jack_transport_stop(m_client); + m_nextState = JackTransportStopped; } void AUD_JackDevice::seekPlayback(float time) @@ -335,5 +337,10 @@ float AUD_JackDevice::getPlaybackPosition() bool AUD_JackDevice::doesPlayback() { - return jack_transport_query(m_client, NULL) != JackTransportStopped; + jack_transport_state_t state = jack_transport_query(m_client, NULL); + + if(state != m_state) + m_nextState = m_state = state; + + return m_nextState != JackTransportStopped; } diff --git a/intern/audaspace/jack/AUD_JackDevice.h b/intern/audaspace/jack/AUD_JackDevice.h index 418992e0db1..cc3cf7d6598 100644 --- a/intern/audaspace/jack/AUD_JackDevice.h +++ b/intern/audaspace/jack/AUD_JackDevice.h @@ -87,9 +87,14 @@ private: static int jack_sync(jack_transport_state_t state, jack_position_t* pos, void* data); /** - * Last Jack Transport playing state. + * Next Jack Transport state (-1 if not expected to change). */ - bool m_playing; + jack_transport_state_t m_nextState; + + /** + * Current jack transport status. + */ + jack_transport_state_t m_state; /** * Syncronisation state. |