summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-02-02 14:39:08 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-02-03 13:10:27 +0100
commit7ff899bd22f20c53d067529140aeb466612e8bbc (patch)
treecc53cf98a1ad746e5ff9c090a6193d8ceb06bc90 /src/audio/sampman_oal.cpp
parentMusicManager fixes (diff)
downloadre3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar.gz
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar.bz2
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar.lz
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar.xz
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.tar.zst
re3-7ff899bd22f20c53d067529140aeb466612e8bbc.zip
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r--src/audio/sampman_oal.cpp58
1 files changed, 26 insertions, 32 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 7b82a4e2..9365c7dd 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -44,7 +44,6 @@
//TODO: fix eax3 reverb
//TODO: max channels
-//TODO: loop count
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
@@ -117,7 +116,6 @@ char _mp3DirectoryPath[MAX_PATH];
CStream *aStream[MAX_STREAMS];
uint8 nStreamPan [MAX_STREAMS];
uint8 nStreamVolume[MAX_STREAMS];
-uint8 nStreamLoopedFlag[MAX_STREAMS];
uint32 _CurMP3Index;
int32 _CurMP3Pos;
bool _bIsMp3Active;
@@ -1666,7 +1664,7 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
ASSERT(stream != NULL);
aStream[nStream] = stream;
- if ( !stream->IsOpened() )
+ if ( !stream->Setup() )
{
delete stream;
aStream[nStream] = NULL;
@@ -1696,7 +1694,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
if ( stream )
{
- if ( stream->Setup() )
+ if ( stream->IsOpened() )
{
stream->Start();
}
@@ -1742,13 +1740,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if (stream->IsOpened()) {
- if (stream->Setup()) {
- if (position != 0)
- stream->SetPosMS(position);
+ if (stream->Setup()) {
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -1769,10 +1765,8 @@ cSampleManager::StartStreamedFile(uint8 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 {
@@ -1798,13 +1792,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if (stream->IsOpened()) {
- if (stream->Setup()) {
- if (position != 0)
- stream->SetPosMS(position);
+ if (stream->Setup()) {
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -1825,13 +1817,11 @@ cSampleManager::StartStreamedFile(uint8 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;
@@ -1855,13 +1845,11 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
aStream[nStream] = stream;
- if ( stream->IsOpened() ) {
- if ( stream->Setup() ) {
- if (position != 0)
- stream->SetPosMS(position);
+ if ( stream->Setup() ) {
+ if (position != 0)
+ stream->SetPosMS(position);
- stream->Start();
- }
+ stream->Start();
return true;
} else {
@@ -1963,6 +1951,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