ref: c8f411b370ef2c09db04b4484130405f707a345a
parent: a8752a8001c12336ee57bddf958b0da86df66634
author: Paul Brossier <[email protected]>
date: Sat Feb 9 19:30:31 EST 2013
src/io/source_sndfile.c: automagically set samplerate to input file if 0 is requested
--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -69,7 +69,6 @@
}
s->hop_size = hop_size;
- s->samplerate = samplerate;
s->channels = 1;
s->path = path;
@@ -89,6 +88,11 @@
s->input_channels = sfinfo.channels;
s->input_format = sfinfo.format;
+ if (samplerate == 0) {
+ samplerate = s->input_samplerate;
+ AUBIO_WRN("sampling rate set to 0, automagically adjusting to %d", samplerate);
+ }
+ s->samplerate = samplerate;
/* compute input block size required before resampling */
s->ratio = s->samplerate/(float)s->input_samplerate;
s->input_hop_size = (uint_t)FLOOR(s->hop_size / s->ratio + .5);