forked from MoonsideGames/FAudioGMS
tweak stream looping behavior
parent
e17d7e0da8
commit
e12914177f
BIN
gamemaker/extensions/FAudioGMS/FAudioGMS.dll (Stored with Git LFS)
BIN
gamemaker/extensions/FAudioGMS/FAudioGMS.dll (Stored with Git LFS)
Binary file not shown.
|
@ -356,13 +356,20 @@ static void FAudioGMS_INTERNAL_OnBufferEndCallback(
|
||||||
instance->soundData.streamingSound.streamBufferSize /
|
instance->soundData.streamingSound.streamBufferSize /
|
||||||
(instance->format.nChannels * sizeof(float));
|
(instance->format.nChannels * sizeof(float));
|
||||||
|
|
||||||
instance->soundData.streamingSound.mostRecentSampleOffset = SDL_min(
|
instance->soundData.streamingSound.mostRecentSampleOffset %= instance->playLength;
|
||||||
instance->soundData.streamingSound.mostRecentSampleOffset,
|
|
||||||
instance->playLength);
|
|
||||||
|
|
||||||
if (instance->soundData.streamingSound.isFinalBuffer)
|
if (instance->soundData.streamingSound.isFinalBuffer)
|
||||||
{
|
{
|
||||||
FAudioGMS_INTERNAL_SoundInstance_Stop(instance);
|
if (instance->loop)
|
||||||
|
{
|
||||||
|
stb_vorbis_seek(instance->soundData.streamingSound.fileHandle, instance->playBegin);
|
||||||
|
instance->soundData.streamingSound.mostRecentSampleOffset = instance->playBegin;
|
||||||
|
FAudioGMS_INTERNAL_SoundInstance_AddBuffers(instance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FAudioGMS_INTERNAL_SoundInstance_Stop(instance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1031,14 +1038,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_AddBuffers(FAudioGMS_SoundInstance
|
||||||
|
|
||||||
if (sampleCount < defaultRequestedSampleCount)
|
if (sampleCount < defaultRequestedSampleCount)
|
||||||
{
|
{
|
||||||
if (instance->loop)
|
instance->soundData.streamingSound.isFinalBuffer = 1;
|
||||||
{
|
|
||||||
stb_vorbis_seek(instance->soundData.streamingSound.fileHandle, instance->playBegin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
instance->soundData.streamingSound.isFinalBuffer = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
instance->soundData.streamingSound.nextStreamBufferIndex =
|
instance->soundData.streamingSound.nextStreamBufferIndex =
|
||||||
|
|
Loading…
Reference in New Issue