Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2021-02-14 20:09:16 +03:00
commit 3d90a146d8
3 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<img src="https://github.com/GTAmodding/re3/blob/miami/logo.png?raw=true" alt="reVC logo" width="200"> <img src="https://github.com/GTAmodding/re3/blob/miami/logo.png?raw=true" alt="reVC logo" width="200">
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmiami&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=miami) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmiami&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=miami)
<a href="https://discord.gg/7yyJtQZ93N"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a> <a href="https://discord.gg/ERYg58ttcE"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
## Intro ## Intro

View File

@ -1152,6 +1152,7 @@ void CStream::SetPan(uint8 nPan)
m_nPan = nPan; m_nPan = nPan;
} }
// Should only be called if source is stopped
void CStream::SetPosMS(uint32 nPos) void CStream::SetPosMS(uint32 nPos)
{ {
if ( !IsOpened() ) return; if ( !IsOpened() ) return;
@ -1234,12 +1235,16 @@ void CStream::ClearBuffers()
alSourceUnqueueBuffers(m_pAlSources[1], 1, &value); alSourceUnqueueBuffers(m_pAlSources[1], 1, &value);
} }
bool CStream::Setup() bool CStream::Setup(bool imSureQueueIsEmpty)
{ {
if ( IsOpened() ) if ( IsOpened() )
{ {
alSourcei(m_pAlSources[0], AL_LOOPING, AL_FALSE); alSourcei(m_pAlSources[0], AL_LOOPING, AL_FALSE);
alSourcei(m_pAlSources[1], AL_LOOPING, AL_FALSE); alSourcei(m_pAlSources[1], AL_LOOPING, AL_FALSE);
if (!imSureQueueIsEmpty) {
SetPlay(false);
ClearBuffers();
}
m_pSoundFile->Seek(0); m_pSoundFile->Seek(0);
//SetPosition(0.0f, 0.0f, 0.0f); //SetPosition(0.0f, 0.0f, 0.0f);
SetPitch(1.0f); SetPitch(1.0f);
@ -1343,7 +1348,7 @@ void CStream::Update()
// We should wait queue to be cleared to loop track, because position calculation relies on queue. // 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) if (m_nLoopCount != 1 && m_bActive && totalBuffers[0] == 0)
{ {
Setup(); Setup(true);
buffersRefilled = FillBuffers() != 0; buffersRefilled = FillBuffers() != 0;
if (m_nLoopCount != 0) if (m_nLoopCount != 0)
m_nLoopCount--; m_nLoopCount--;
@ -1376,7 +1381,7 @@ void CStream::ProviderInit()
{ {
if ( m_bReset ) if ( m_bReset )
{ {
if ( Setup() ) if ( Setup(true) )
{ {
SetPan(m_nPan); SetPan(m_nPan);
SetVolume(m_nVolume); SetVolume(m_nVolume);

View File

@ -100,7 +100,7 @@ public:
uint32 GetPosMS(); uint32 GetPosMS();
uint32 GetLengthMS(); uint32 GetLengthMS();
bool Setup(); bool Setup(bool imSureQueueIsEmpty = false);
void Start(); void Start();
void Stop(); void Stop();
void Update(void); void Update(void);