diff options
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r-- | src/audio/sampman_oal.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 440e0927..cd2fa50a 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -34,6 +34,12 @@ #include "oal/oal_utils.h" #include "oal/aldlist.h" #include "oal/channel.h" + +#include <utility> +#ifdef MULTITHREADED_AUDIO +#include <mutex> +#include <queue> +#endif #include "oal/stream.h" #include "AudioManager.h" @@ -521,7 +527,7 @@ _FindMP3s(void) if (aStream[0] && aStream[0]->IsOpened()) { total_ms = aStream[0]->GetLengthMS(); - delete aStream[0]; + aStream[0]->Close(); aStream[0] = NULL; OutputDebugString(fd.cFileName); @@ -595,7 +601,7 @@ _FindMP3s(void) if (aStream[0] && aStream[0]->IsOpened()) { total_ms = aStream[0]->GetLengthMS(); - delete aStream[0]; + aStream[0]->Close(); aStream[0] = NULL; OutputDebugString(fd.cFileName); @@ -655,7 +661,7 @@ _FindMP3s(void) if (aStream[0] && aStream[0]->IsOpened()) { total_ms = aStream[0]->GetLengthMS(); - delete aStream[0]; + aStream[0]->Close(); aStream[0] = NULL; OutputDebugString(fd.cFileName); @@ -811,6 +817,7 @@ cSampleManager::Initialise(void) return TRUE; EFXInit(); + CStream::Initialise(); { @@ -971,7 +978,7 @@ cSampleManager::Initialise(void) if ( aStream[0] && aStream[0]->IsOpened() ) { uint32 tatalms = aStream[0]->GetLengthMS(); - delete aStream[0]; + aStream[0]->Close(); aStream[0] = NULL; nStreamLength[i] = tatalms; @@ -1021,7 +1028,7 @@ cSampleManager::Initialise(void) nStreamPan[i] = 63; } } - + { _bSampmanInitialised = TRUE; @@ -1107,7 +1114,7 @@ cSampleManager::Terminate(void) CStream *stream = aStream[i]; if (stream) { - delete stream; + stream->Close(); aStream[i] = NULL; } } @@ -1688,7 +1695,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) { if ( aStream[nStream] ) { - delete aStream[nStream]; + aStream[nStream]->Close(); aStream[nStream] = NULL; } @@ -1700,7 +1707,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) aStream[nStream] = stream; if ( !stream->Setup() ) { - delete stream; + stream->Close(); aStream[nStream] = NULL; } } @@ -1747,7 +1754,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if ( aStream[nStream] ) { - delete aStream[nStream]; + aStream[nStream]->Close(); aStream[nStream] = NULL; } if ( nFile == STREAMED_SOUND_RADIO_MP3_PLAYER ) @@ -1780,7 +1787,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) return TRUE; } else { - delete stream; + stream->Close(); aStream[nStream] = NULL; } return FALSE; @@ -1805,7 +1812,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) _bIsMp3Active = TRUE; return TRUE; } else { - delete aStream[nStream]; + aStream[nStream]->Close(); aStream[nStream] = NULL; } // fall through, start playing from another song @@ -1839,7 +1846,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) return TRUE; } else { - delete stream; + stream->Close(); aStream[nStream] = NULL; } return FALSE; @@ -1861,7 +1868,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) #endif return TRUE; } else { - delete aStream[nStream]; + aStream[nStream]->Close(); aStream[nStream] = NULL; } @@ -1888,7 +1895,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) return TRUE; } else { - delete stream; + stream->Close(); aStream[nStream] = NULL; } return FALSE; @@ -1903,7 +1910,7 @@ cSampleManager::StopStreamedFile(uint8 nStream) if ( stream ) { - delete stream; + stream->Close(); aStream[nStream] = NULL; if ( nStream == 0 ) |