Skip to content

Commit

Permalink
stb_vorbis: fix interleaved appends silence at end
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Jan 21, 2024
1 parent fdcecaf commit 0187e9a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/stb_vorbis.h
Original file line number Diff line number Diff line change
Expand Up @@ -5637,6 +5637,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float
int len = num_floats / channels;
int n=0;
int z = f->channels;
unsigned int lgs=stb_vorbis_stream_length_in_samples(f);
if (z > channels) z = channels;
while (n < len) {
int i,j;
Expand All @@ -5656,6 +5657,11 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float
break;
}
f->current_playback_loc += n;
if(f->current_playback_loc > lgs) {
int r = n - (f->current_playback_loc - lgs);
f->current_playback_loc = lgs;
return r;
}
return n;
}

Expand Down

0 comments on commit 0187e9a

Please sign in to comment.