Fix looping and length getting of non-loop metadata holding files
This commit is contained in:
parent
91b2c5a56d
commit
21ad4f5759
1 changed files with 8 additions and 6 deletions
14
playback.cpp
14
playback.cpp
|
@ -91,9 +91,13 @@ void PlaybackInstance::SDLCallbackInner(Uint8 *stream, int len) {
|
|||
if (this->stream != nullptr) {
|
||||
size_t samples = (int)bytes_per_iter / sizeof(SAMPLETYPE) / this->stream->channels;
|
||||
#ifdef SOUNDTOUCH_INTEGER_SAMPLES
|
||||
samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream);
|
||||
size_t new_samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream);
|
||||
#else
|
||||
samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream);
|
||||
size_t new_samples = render_vgmstream((sample_t*)(buf), (int)samples, this->stream);
|
||||
if (samples > new_samples) {
|
||||
reset_vgmstream(this->stream);
|
||||
}
|
||||
samples = new_samples;
|
||||
vgmstream_spec.samples = samples;
|
||||
SDL_AudioStreamPut(sdl_stream, buf, samples * sizeof(sample_t) * this->stream->channels);
|
||||
new_bufsize = SDL_AudioStreamGet(sdl_stream, buf, bufsize);
|
||||
|
@ -178,14 +182,12 @@ VGMSTREAM *PlaybackInstance::Load2(const char *file) {
|
|||
vgmstream_cfg_t cfg = {0};
|
||||
cfg.allow_play_forever = 1;
|
||||
cfg.play_forever = 1;
|
||||
cfg.force_loop = 1;
|
||||
cfg.really_force_loop = 1;
|
||||
cfg.disable_config_override = 1;
|
||||
//cfg.disable_config_override = 1;
|
||||
vgmstream_apply_config(output, &cfg);
|
||||
vgmstream_spec.channels = output->channels;
|
||||
vgmstream_spec.freq = output->sample_rate;
|
||||
|
||||
length = (double)output->loop_end_sample / (double)output->sample_rate;
|
||||
length = (double)output->num_samples / (double)output->sample_rate;
|
||||
update.store(true);
|
||||
current_file_mutex.lock();
|
||||
current_file = std::string(file);
|
||||
|
|
Loading…
Reference in a new issue