ref: c05958186d19e052f95121826be14e86880f4e58
parent: c19f9e573b86231d4f8bdaa7cd6b6d2b0cf7c8aa
parent: b8389deb101c95e4b7f796b9f0052d4d6445abbf
author: Paul Brossier <piem@piem.org>
date: Fri Mar 22 15:55:50 EDT 2013
Merge /Users/piem/projects/aubio/aubio into device
--- a/src/io/source_apple_audio.c
+++ b/src/io/source_apple_audio.c
@@ -204,10 +204,19 @@
buf[c][v] = SHORT_TO_FLOAT(data[ v * s->channels + c]);
}
}
+ // if read_data has more channels than the file
+ if (read_to->height > s->channels) {
+ // copy last channel to all additional channels
+ for (v = 0; v < loadedPackets; v++) {
+ for (c = s->channels; c < read_to->height; c++) {
+ buf[c][v] = SHORT_TO_FLOAT(data[ v * s->channels + (s->channels - 1)]);
+ }
+ }
+ }
// short read, fill with zeros
if (loadedPackets < s->block_size) {
for (v = loadedPackets; v < s->block_size; v++) {
- for (c = 0; c < s->channels; c++) {
+ for (c = 0; c < read_to->height; c++) {
buf[c][v] = 0.;
}
}
--- a/tests/src/synth/test-sampler.c
+++ b/tests/src/synth/test-sampler.c
@@ -13,7 +13,7 @@
}
uint_t samplerate = 0; // default is the samplerate of input_path
- uint_t hop_size = 512;
+ uint_t hop_size = 256;
uint_t n_frames = 0, read = 0;
char_t *source_path = argv[1];
@@ -35,7 +35,10 @@
if (n_frames / hop_size == 10) {
aubio_sampler_play ( sampler );
}
- if (n_frames / hop_size == 20) {
+ if (n_frames / hop_size == 40) {
+ aubio_sampler_play ( sampler );
+ }
+ if (n_frames / hop_size == 70) {
aubio_sampler_play ( sampler );
}
if (n_frames > 10.0 * samplerate) {