examples/aubioonset.c: avoid saturation in when using --mix-input
authorPaul Brossier <piem@piem.org>
Fri, 10 Mar 2017 19:17:36 +0000 (20:17 +0100)
committerPaul Brossier <piem@piem.org>
Fri, 10 Mar 2017 19:17:36 +0000 (20:17 +0100)
examples/aubioonset.c

index 032eb00..680471c 100644 (file)
@@ -43,10 +43,12 @@ void process_block(fvec_t *ibuf, fvec_t *obuf)
   } else {
     aubio_wavetable_stop ( wavetable );
   }
-  if (mix_input)
+  if (mix_input) {
     aubio_wavetable_do (wavetable, ibuf, obuf);
-  else
+    fvec_clamp(obuf, 1.);
+  } else {
     aubio_wavetable_do (wavetable, obuf, obuf);
+  }
 }
 
 void process_print (void)