summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r--src/audio/sampman_oal.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 0d06098d..2091fb05 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -46,7 +46,6 @@
//TODO: fix eax3 reverb
//TODO: max channels
-//TODO: loop count
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
@@ -1695,7 +1694,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
ASSERT(stream != NULL);
aStream[nStream] = stream;
- if ( !stream->IsOpened() )
+ if ( !stream->Setup() )
{
delete stream;
aStream[nStream] = NULL;
@@ -1725,7 +1724,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
if ( stream )
{
- if ( stream->Setup() )
+ if ( stream->IsOpened() )
{
stream->Start();
}
@@ -1771,13 +1770,13 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if (stream->IsOpened()) {
- if (stream->Setup()) {
- if (position != 0)
- stream->SetPosMS(position);
+ if (stream->Setup()) {
+ stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
+ nStreamLoopedFlag[nStream] = true;
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -1798,10 +1797,8 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
}
- if (aStream[nStream]->IsOpened()) {
- if (aStream[nStream]->Setup()) {
- aStream[nStream]->Start();
- }
+ if (aStream[nStream]->Setup()) {
+ aStream[nStream]->Start();
return true;
} else {
@@ -1827,13 +1824,13 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if (stream->IsOpened()) {
- if (stream->Setup()) {
- if (position != 0)
- stream->SetPosMS(position);
+ if (stream->Setup()) {
+ stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
+ nStreamLoopedFlag[nStream] = true;
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -1854,13 +1851,11 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
}
- if (aStream[nStream]->IsOpened()) {
- if (aStream[nStream]->Setup()) {
- if (position != 0)
- aStream[nStream]->SetPosMS(position);
+ if (aStream[nStream]->Setup()) {
+ if (position != 0)
+ aStream[nStream]->SetPosMS(position);
- aStream[nStream]->Start();
- }
+ aStream[nStream]->Start();
_bIsMp3Active = true;
return true;
@@ -1884,13 +1879,13 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if ( stream->IsOpened() ) {
- if ( stream->Setup() ) {
- if (position != 0)
- stream->SetPosMS(position);
+ if ( stream->Setup() ) {
+ stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1);
+ nStreamLoopedFlag[nStream] = true;
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -2001,6 +1996,12 @@ cSampleManager::Service(void)
if ( stream )
stream->Update();
}
+ int refCount = CChannel::channelsThatNeedService;
+ for ( int32 i = 0; refCount && i < MAXCHANNELS+MAX2DCHANNELS; i++ )
+ {
+ if ( aChannel[i].Update() )
+ refCount--;
+ }
}
bool