diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2020-04-19 18:34:08 +0200 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2020-04-20 18:18:46 +0200 |
commit | 370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96 (patch) | |
tree | 5f5c66a542d7a121a7db88fed66e31f2a263b206 /src/audio/sampman.cpp | |
parent | Merge pull request #474 from Nick007J/master (diff) | |
download | re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.gz re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.bz2 re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.lz re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.xz re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.tar.zst re3-370c4e48cd87122e8d38f1a72f6b8f62ff7b9c96.zip |
Diffstat (limited to 'src/audio/sampman.cpp')
-rw-r--r-- | src/audio/sampman.cpp | 119 |
1 files changed, 69 insertions, 50 deletions
diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp index d24de27f..a375b847 100644 --- a/src/audio/sampman.cpp +++ b/src/audio/sampman.cpp @@ -1986,50 +1986,59 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream) if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER ) { uint32 i = 0; - - if ( !_bIsMp3Active ) goto FIND_MP3TRACK; - - do - { - if ( ++_CurMP3Index >= nNumMP3s ) - _CurMP3Index = 0; - - _CurMP3Pos = 0; - - tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index); - - if ( mp3 ) - { - mp3 = _pMP3List; - if ( mp3 == NULL ) - { - _bIsMp3Active = false; - nFile = 0; - goto PLAY_STREAMEDTRACK; + do { + if(i != 0 || _bIsMp3Active) { + if(++_CurMP3Index >= nNumMP3s) _CurMP3Index = 0; + + _CurMP3Pos = 0; + + tMP3Entry *mp3 = _GetMP3EntryByIndex(_CurMP3Index); + + if(mp3) { + mp3 = _pMP3List; + if(mp3 == NULL) { + _bIsMp3Active = false; + nFile = 0; + strcpy(filename, m_szCDRomRootPath); + strcat(filename, StreamedNameTable[nFile]); + + mp3Stream[nStream] = + AIL_open_stream(DIG, filename, 0); + if(mp3Stream[nStream]) { + AIL_set_stream_loop_count( + mp3Stream[nStream], 1); + AIL_set_stream_ms_position( + mp3Stream[nStream], position); + AIL_pause_stream(mp3Stream[nStream], + 0); + return true; + } + + return false; + } } + + if(mp3->pLinkPath != NULL) + mp3Stream[nStream] = + AIL_open_stream(DIG, mp3->pLinkPath, 0); + else { + strcpy(filename, _mp3DirectoryPath); + strcat(filename, mp3->aFilename); + + mp3Stream[nStream] = + AIL_open_stream(DIG, filename, 0); + } + + if(mp3Stream[nStream]) { + AIL_set_stream_loop_count(mp3Stream[nStream], 1); + AIL_set_stream_ms_position(mp3Stream[nStream], 0); + AIL_pause_stream(mp3Stream[nStream], 0); + return true; + } + + _bIsMp3Active = false; + continue; } - - if ( mp3->pLinkPath != NULL ) - mp3Stream[nStream] = AIL_open_stream(DIG, mp3->pLinkPath, 0); - else - { - strcpy(filename, _mp3DirectoryPath); - strcat(filename, mp3->aFilename); - - mp3Stream[nStream] = AIL_open_stream(DIG, filename, 0); - } - - if ( mp3Stream[nStream] ) - { - AIL_set_stream_loop_count(mp3Stream[nStream], 1); - AIL_set_stream_ms_position(mp3Stream[nStream], 0); - AIL_pause_stream(mp3Stream[nStream], 0); - return true; - } - - goto NEXT_MP3TRACK; - -FIND_MP3TRACK: if ( nPos > nStreamLength[STREAMED_SOUND_RADIO_MP3_PLAYER] ) position = 0; @@ -2039,10 +2048,23 @@ FIND_MP3TRACK: if ( e == NULL ) { nFile = 0; - goto PLAY_STREAMEDTRACK; + strcpy(filename, m_szCDRomRootPath); + strcat(filename, StreamedNameTable[nFile]); + mp3Stream[nStream] = + AIL_open_stream(DIG, filename, 0); + if(mp3Stream[nStream]) { + AIL_set_stream_loop_count( + mp3Stream[nStream], 1); + AIL_set_stream_ms_position( + mp3Stream[nStream], position); + AIL_pause_stream(mp3Stream[nStream], 0); + return true; + } + + return false; } } - + if ( e->pLinkPath != NULL ) mp3Stream[nStream] = AIL_open_stream(DIG, e->pLinkPath, 0); else @@ -2064,17 +2086,14 @@ FIND_MP3TRACK: return true; } -NEXT_MP3TRACK: _bIsMp3Active = false; - - } while ( ++i < nNumMP3s ); - + + } while(++i < nNumMP3s); + position = 0; nFile = 0; - goto PLAY_STREAMEDTRACK; } -PLAY_STREAMEDTRACK: strcpy(filename, m_szCDRomRootPath); strcat(filename, StreamedNameTable[nFile]); |