Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stb_vorbis: fix interleaved appends silence at end #97

Open
wants to merge 2 commits into
base: stable-2.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 && lgs > 0 && lgs != SAMPLE_unknown) {
int r = n - (f->current_playback_loc - lgs);
f->current_playback_loc = lgs;
return r;
}
return n;
}

Expand Down