summaryrefslogtreecommitdiffstats
path: root/src/audio/oal/stream.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-02-14 16:07:21 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-02-14 18:45:58 +0100
commitbe550853033e631e85f122bc459533643c230bac (patch)
treebd0870a7c476b65d07143e74259509e6f96dce13 /src/audio/oal/stream.cpp
parentcannon fix (diff)
downloadre3-be550853033e631e85f122bc459533643c230bac.tar
re3-be550853033e631e85f122bc459533643c230bac.tar.gz
re3-be550853033e631e85f122bc459533643c230bac.tar.bz2
re3-be550853033e631e85f122bc459533643c230bac.tar.lz
re3-be550853033e631e85f122bc459533643c230bac.tar.xz
re3-be550853033e631e85f122bc459533643c230bac.tar.zst
re3-be550853033e631e85f122bc459533643c230bac.zip
Diffstat (limited to '')
-rw-r--r--src/audio/oal/stream.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 61cd243d..44cc1c93 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -1095,6 +1095,7 @@ void CStream::SetPan(uint8 nPan)
m_nPan = nPan;
}
+// Should only be called if source is stopped
void CStream::SetPosMS(uint32 nPos)
{
if ( !IsOpened() ) return;
@@ -1177,12 +1178,16 @@ void CStream::ClearBuffers()
alSourceUnqueueBuffers(m_pAlSources[1], 1, &value);
}
-bool CStream::Setup()
+bool CStream::Setup(bool imSureQueueIsEmpty)
{
if ( IsOpened() )
{
alSourcei(m_pAlSources[0], AL_LOOPING, AL_FALSE);
alSourcei(m_pAlSources[1], AL_LOOPING, AL_FALSE);
+ if (!imSureQueueIsEmpty) {
+ SetPlay(false);
+ ClearBuffers();
+ }
m_pSoundFile->Seek(0);
//SetPosition(0.0f, 0.0f, 0.0f);
SetPitch(1.0f);
@@ -1286,7 +1291,7 @@ void CStream::Update()
// We should wait queue to be cleared to loop track, because position calculation relies on queue.
if (m_nLoopCount != 1 && m_bActive && totalBuffers[0] == 0)
{
- Setup();
+ Setup(true);
buffersRefilled = FillBuffers() != 0;
if (m_nLoopCount != 0)
m_nLoopCount--;
@@ -1319,7 +1324,7 @@ void CStream::ProviderInit()
{
if ( m_bReset )
{
- if ( Setup() )
+ if ( Setup(true) )
{
SetPan(m_nPan);
SetVolume(m_nVolume);