diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-06-27 13:51:48 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-06-27 13:51:48 +0200 |
commit | 879761af2ced44c28053656089622467452c7ff1 (patch) | |
tree | b56b23a0c018d2ab0511e820f59df4b9bc4a153e /src/audio/sampman_oal.cpp | |
parent | Merge remote-tracking branch 'origin/miami' into lcs (diff) | |
download | re3-879761af2ced44c28053656089622467452c7ff1.tar re3-879761af2ced44c28053656089622467452c7ff1.tar.gz re3-879761af2ced44c28053656089622467452c7ff1.tar.bz2 re3-879761af2ced44c28053656089622467452c7ff1.tar.lz re3-879761af2ced44c28053656089622467452c7ff1.tar.xz re3-879761af2ced44c28053656089622467452c7ff1.tar.zst re3-879761af2ced44c28053656089622467452c7ff1.zip |
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r-- | src/audio/sampman_oal.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index e95bc978..3cd7a736 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1046,14 +1046,14 @@ cSampleManager::Initialise(void) char filename[MAX_PATH]; sprintf(filename, "%s.VB", StreamedNameTable[i]); if ( aStream[0] ) - opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000) ) + opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000); if ( !opened ) { sprintf(filename, "%s.MP3", StreamedNameTable[i]); if ( aStream[0] ) { - opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000) + opened = aStream[0]->Open(filename, IsThisTrackAt16KHz(i) ? 16000 : 32000); } } if ( opened ) @@ -1956,29 +1956,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) nFile = 0; } sprintf(filename, "%s.VB", StreamedNameTable[nFile]); - - CStream *stream = aStream[nStream]; - if ( stream && !stream->IsOpened() ) - { - delete stream; - stream = NULL; - } + CStream *stream = aStream[nStream]; + + bool opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); - if (!stream) + if ( !opened ) { sprintf(filename, "%s.MP3", StreamedNameTable[nFile]); - stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000); - if ( stream && !stream->IsOpened() ) - { - delete stream; - stream = NULL; - } + opened = stream->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); } - - aStream[nStream]->Open(filename, IsThisTrackAt16KHz(nFile) ? 16000 : 32000); - if ( stream->Setup() ) { + if ( opened && stream->Setup() ) { stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1); nStreamLoopedFlag[nStream] = TRUE; if (position != 0) |