logic bug fix
This commit is contained in:
parent
d38d7a1bed
commit
86fbf4fd8f
1 changed files with 5 additions and 5 deletions
10
src/audio.c
10
src/audio.c
|
@ -996,10 +996,10 @@ static bool BufferMusicStream(int index)
|
|||
bool active = true; // We can get more data from stream (not finished)
|
||||
|
||||
|
||||
if(!currentMusic[index].ctx->playing && currentMusic[index].totalSamplesLeft > 0)
|
||||
if (!currentMusic[index].ctx->playing && currentMusic[index].totalSamplesLeft > 0)
|
||||
{
|
||||
UpdateAudioContext(currentMusic[index].ctx, NULL, 0);
|
||||
return true; // it is still active, only it is paused
|
||||
return true; // it is still active but it is paused
|
||||
}
|
||||
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ void UpdateMusicStream(int index)
|
|||
|
||||
if (!active && currentMusic[index].loop && currentMusic[index].ctx->playing)
|
||||
{
|
||||
if(currentMusic[index].chipTune)
|
||||
if (currentMusic[index].chipTune)
|
||||
{
|
||||
currentMusic[index].totalSamplesLeft = currentMusic[index].totalLengthSeconds * currentMusic[index].ctx->sampleRate;
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ void UpdateMusicStream(int index)
|
|||
stb_vorbis_seek_start(currentMusic[index].stream);
|
||||
currentMusic[index].totalSamplesLeft = stb_vorbis_stream_length_in_samples(currentMusic[index].stream) * currentMusic[index].ctx->channels;
|
||||
}
|
||||
active = BufferMusicStream(index);
|
||||
active = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ void UpdateMusicStream(int index)
|
|||
|
||||
alGetSourcei(currentMusic[index].ctx->alSource, AL_SOURCE_STATE, &state);
|
||||
|
||||
if ((state != AL_PLAYING) && active) alSourcePlay(currentMusic[index].ctx->alSource);
|
||||
if (state != AL_PLAYING && active && currentMusic[index].ctx->playing) alSourcePlay(currentMusic[index].ctx->alSource);
|
||||
|
||||
if (!active) StopMusicStream(index);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue