handling of end of .ogg file

This commit is contained in:
veclavtalica 2024-07-08 09:57:04 +03:00
parent 8a8f62dc25
commit 3bd25b2067

View File

@ -180,6 +180,16 @@ static void audio_sample_and_mixin_channel(struct audio_channel *channel,
(int16_t *)buffer,
n_frames);
/* handle end of file */
if (samples_per_channel == 0) {
if (channel->args.repeat)
/* seek to start and try sampling some more */
stb_vorbis_seek_start(channel->context.vorbis.handle);
else
/* leave silence */
break;
}
/* panning and mixing */
#if AUDIO_N_CHANNELS == 2