diff --git a/include/AudioSdl.h b/include/AudioSdl.h index ba2f09faa..a5ce279b4 100644 --- a/include/AudioSdl.h +++ b/include/AudioSdl.h @@ -82,8 +82,7 @@ private: bool m_convertEndian; - volatile bool m_stopped; - QSemaphore m_stopSemaphore; + bool m_stopped; } ; diff --git a/src/core/audio/AudioSdl.cpp b/src/core/audio/AudioSdl.cpp index 4587a61f3..4ebd2c878 100644 --- a/src/core/audio/AudioSdl.cpp +++ b/src/core/audio/AudioSdl.cpp @@ -42,8 +42,7 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : AudioDevice( DEFAULT_CHANNELS, _mixer ), m_outBuf( new surroundSampleFrame[mixer()->framesPerPeriod()] ), m_convertedBufPos( 0 ), - m_convertEndian( false ), - m_stopSemaphore( 1 ) + m_convertEndian( false ) { _success_ful = false; @@ -78,8 +77,6 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : } m_convertEndian = ( m_audioHandle.format != actual.format ); - m_stopSemaphore.acquire(); - _success_ful = true; } @@ -89,7 +86,6 @@ AudioSdl::AudioSdl( bool & _success_ful, Mixer* _mixer ) : AudioSdl::~AudioSdl() { stopProcessing(); - m_stopSemaphore.release(); SDL_CloseAudio(); SDL_Quit(); @@ -114,9 +110,8 @@ void AudioSdl::stopProcessing() { if( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING ) { - m_stopSemaphore.acquire(); - SDL_LockAudio(); + m_stopped = true; SDL_PauseAudio( 1 ); SDL_UnlockAudio(); } @@ -176,8 +171,6 @@ void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len ) const fpp_t frames = getNextBuffer( m_outBuf ); if( !frames ) { - m_stopped = true; - m_stopSemaphore.release(); memset( _buf, 0, _len ); return; }