Parse loop_target manually (get_vgmstream_play_samples is just a helper)

This commit is contained in:
bnnm 2017-08-18 19:32:51 +02:00
parent d9fb118412
commit 3c14d3fdb4
2 changed files with 6 additions and 1 deletions

View File

@ -871,7 +871,7 @@ int32_t get_vgmstream_play_samples(double looptimes, double fadeseconds, double
* Most files cut abruply after the loop, but some do have proper endings.
* With looptimes = 1 this option should give the same output vs loop disabled */
int loop_count = (int)looptimes; /* no half loops allowed */
vgmstream->loop_target = loop_count;
//vgmstream->loop_target = loop_count; /* handled externally, as this is into-only */
return vgmstream->loop_start_sample
+ (vgmstream->loop_end_sample - vgmstream->loop_start_sample) * loop_count
+ (vgmstream->num_samples - vgmstream->loop_end_sample);

View File

@ -292,6 +292,11 @@ int main(int argc, char ** argv) {
if (!play && !adxencd && !oggenc && !batchvar) printf("samples to play: %d (%.4lf seconds)\n",len,(double)len/s->sample_rate);
fade_samples = fade_seconds * s->sample_rate;
if (loop_count && fade_ignore) {
s->loop_target = (int)loop_count;
}
/* slap on a .wav header */
if (only_stereo != -1) {
make_wav_header((uint8_t*)buf, len, s->sample_rate, 2);