diff --git a/playback.cpp b/playback.cpp index 3a0821e..aea5283 100644 --- a/playback.cpp +++ b/playback.cpp @@ -94,14 +94,14 @@ void PlaybackInstance::SDLCallbackInner(Uint8 *stream, int len) { size_t new_samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream); #else size_t new_samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream); - samples = new_samples; - vgmstream_spec.samples = samples; - SDL_AudioStreamPut(sdl_stream, buf, samples * sizeof(sample_t) * this->stream->channels); + vgmstream_spec.samples = new_samples; + SDL_AudioStreamPut(sdl_stream, buf, new_samples * sizeof(sample_t) * this->stream->channels); new_bufsize = SDL_AudioStreamGet(sdl_stream, buf, bufsize); #endif if (samples > new_samples) { reset_vgmstream(this->stream); } + samples = new_samples; for (int i = 0; i < new_bufsize / sizeof(SAMPLETYPE); i++) { ((SAMPLETYPE*)new_buf)[i] *= real_volume; }