fix bug with SetLoop while Playing
parent
3568028dc3
commit
1d3c0dcbc8
|
@ -342,7 +342,14 @@ static void FAudioGMS_INTERNAL_OnBufferEndCallback(
|
|||
|
||||
if (instance->isStatic)
|
||||
{
|
||||
FAudioGMS_INTERNAL_SoundInstance_Stop(instance);
|
||||
FAudioVoiceState state;
|
||||
FAudioSourceVoice_GetState(instance->voice.handle, &state, 0);
|
||||
|
||||
/* We don't want to stop if we re-queued sound for SetLoop or something so we check that we're actually done */
|
||||
if (state.BuffersQueued == 0)
|
||||
{
|
||||
FAudioGMS_INTERNAL_SoundInstance_Stop(instance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -810,6 +817,8 @@ static FAudioGMS_SoundInstance *FAudioGMS_INTERNAL_SoundInstance_CreateFromStati
|
|||
instance->isStatic = 1;
|
||||
instance->soundData.staticSound = staticSound;
|
||||
|
||||
instance->playLength = instance->soundData.staticSound->buffer.PlayLength;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -1057,6 +1066,8 @@ double FAudioGMS_StreamingSound_LoadOGG(char *filePath)
|
|||
instance->soundData.streamingSound.mostRecentBufferOffset = 0;
|
||||
instance->soundData.streamingSound.isFinalBuffer = 0;
|
||||
|
||||
instance->playLength = stb_vorbis_stream_length_in_samples(fileHandle);
|
||||
|
||||
FAudioGMS_INTERNAL_SoundInstance_AddBuffer(instance);
|
||||
|
||||
return instance->id;
|
||||
|
@ -1133,11 +1144,12 @@ static void FAudioGMS_INTERNAL_SoundInstance_Play(FAudioGMS_SoundInstance *insta
|
|||
|
||||
if (instance->soundState == SoundState_Paused)
|
||||
{
|
||||
FAudioSourceVoice_FlushSourceBuffers(instance->voice.handle);
|
||||
|
||||
instance->soundData.staticSound->buffer.PlayBegin =
|
||||
instance->voice.handle->src.curBufferOffset;
|
||||
instance->soundData.staticSound->buffer.PlayLength = instance->playLength;
|
||||
|
||||
FAudioSourceVoice_Stop(instance->voice.handle, 0, 0);
|
||||
FAudioSourceVoice_FlushSourceBuffers(instance->voice.handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue