From 5a36d466929ac9ba5612d577904773e3bd58bfe5 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Tue, 27 Aug 2019 22:46:41 +0200 Subject: Audio fixes --- src/audio/sampman.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/audio/sampman.cpp') diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index 58da6f64..de222493 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -158,14 +158,14 @@ release_existing() if ( opened_samples[i] ) { AIL_release_3D_sample_handle(opened_samples[i]); - opened_samples[i] = 0; + opened_samples[i] = NULL; } } if ( opened_provider ) { AIL_close_3D_provider(opened_provider); - opened_provider = 0; + opened_provider = NULL; } _fPrevEaxRatioDestination = 0.0f; @@ -879,7 +879,7 @@ cSampleManager::Initialise(void) _maxSamples = 0; - opened_provider = 0; + opened_provider = NULL; DIG = NULL; for ( int32 i = 0; i < MAXCHANNELS; i++ ) @@ -2020,9 +2020,10 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) { uint32 i = 0; + if ( !_bIsMp3Active ) goto FIND_MP3TRACK; + do { - if(_bIsMp3Active){ if ( ++_CurMP3Index >= nNumMP3s ) _CurMP3Index = 0; @@ -2058,15 +2059,21 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) AIL_pause_stream(mp3Stream[nStream], 0); return true; } - } - if(nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER]) position = 0; - - tMP3Entry *e; - if(!_GetMP3PosFromStreamPos(&position, &e)) { - if(e == NULL) { - nFile = 0; - goto PLAY_STREAMEDTRACK; - } + + goto NEXT_MP3TRACK; + +FIND_MP3TRACK: + if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] ) + position = 0; + + tMP3Entry *e; + if ( !_GetMP3PosFromStreamPos(&position, &e) ) + { + if ( e == NULL ) + { + nFile = 0; + goto PLAY_STREAMEDTRACK; + } } if ( e->pLinkPath != NULL ) @@ -2090,12 +2097,14 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) return true; } +NEXT_MP3TRACK: _bIsMp3Active = false; } while ( ++i < nNumMP3s ); position = 0; nFile = 0; + goto PLAY_STREAMEDTRACK; } PLAY_STREAMEDTRACK: -- cgit v1.2.3