Fix disabled streaming audio not resetting state correctly.

This commit is contained in:
Chandler Cox
2024-08-05 17:55:38 -05:00
parent 0b03a5da0d
commit 17a444ad49
2 changed files with 19 additions and 0 deletions

View File

@@ -338,6 +338,7 @@ void AudioSource::PlayInternal()
AudioBackend::Source::Play(this);
_isActuallyPlayingSth = true;
_startingToPlay = true;
}
#if USE_EDITOR
@@ -419,6 +420,23 @@ void AudioSource::Update()
AudioBackend::Source::VelocityChanged(this);
}
if (!UseStreaming() && GetTime() == GetStartTime() && _isActuallyPlayingSth && !_startingToPlay)
{
if (GetIsLooping())
{
Stop();
Play();
}
else
{
Stop();
}
}
if (_startingToPlay)
{
_startingToPlay = false;
}
// Skip other update logic if it's not valid streamable source
if (!UseStreaming() || SourceIDs.IsEmpty())
return;

View File

@@ -57,6 +57,7 @@ private:
bool _clipChanged = false;
bool _isActuallyPlayingSth = false;
bool _startingToPlay = false;
bool _needToUpdateStreamingBuffers = false;
States _state = States::Stopped;