src/io/source_{avcodec,sndfile}.c: add and improve warnings about upsampling
authorPaul Brossier <piem@piem.org>
Sun, 8 Dec 2013 16:52:09 +0000 (11:52 -0500)
committerPaul Brossier <piem@piem.org>
Sun, 8 Dec 2013 16:52:09 +0000 (11:52 -0500)
src/io/source_avcodec.c
src/io/source_sndfile.c

index 2b61c91..ad0797b 100644 (file)
@@ -161,6 +161,11 @@ aubio_source_avcodec_t * new_aubio_source_avcodec(char_t * path, uint_t samplera
   }
   s->samplerate = samplerate;
 
+  if (s->samplerate >  s->input_samplerate) {
+    AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+        s->input_samplerate, s->samplerate);
+  }
+
   AVFrame *avFrame = s->avFrame;
   avFrame = avcodec_alloc_frame();
   if (!avFrame) {
index 15f3868..0fa7fc5 100644 (file)
@@ -121,10 +121,12 @@ aubio_source_sndfile_t * new_aubio_source_sndfile(char_t * path, uint_t samplera
     if (s->ratio > 1) {
       // we would need to add a ring buffer for these
       if ( (uint_t)(s->input_hop_size * s->ratio + .5)  != s->hop_size ) {
-        AUBIO_ERR("can not upsample from %d to %d\n", s->input_samplerate, s->samplerate);
+        AUBIO_ERR("can not upsample %s from %d to %d\n", s->path,
+            s->input_samplerate, s->samplerate);
         goto beach;
       }
-      AUBIO_WRN("upsampling %s from %d to % d\n", s->path, s->input_samplerate, s->samplerate);
+      AUBIO_WRN("upsampling %s from %d to %d\n", s->path,
+          s->input_samplerate, s->samplerate);
     }
   }
 #else