call IO::prepare_for_reset() on BOTH IO nodes of a PortInsert's XML state, not just...
[ardour.git] / libs / ardour / onset_detector.cc
index 60fea6dabb33dac17accf227ab16da7be146e984..73f94b061b9af8f1eaa86f53e7af5418ff7eb550 100644 (file)
@@ -20,7 +20,7 @@
 #include <cmath>
 #include "ardour/onset_detector.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Vamp;
 using namespace ARDOUR;
@@ -69,7 +69,7 @@ OnsetDetector::use_features (Plugin::FeatureSet& features, ostream* out)
                                (*out) << (*f).timestamp.toString() << endl;
                        }
 
-                       current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (framecnt_t) floor(sample_rate)));
+                       current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (samplecnt_t) floor(sample_rate)));
                }
        }
 
@@ -92,6 +92,16 @@ OnsetDetector::set_peak_threshold (float val)
        }
 }
 
+void
+OnsetDetector::set_minioi (float val)
+{
+#ifdef HAVE_AUBIO4
+       if (plugin) {
+               plugin->setParameter ("minioi", val);
+       }
+#endif
+}
+
 void
 OnsetDetector::set_function (int val)
 {
@@ -113,7 +123,7 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs
 
        AnalysisFeatureList::iterator i = t.begin();
        AnalysisFeatureList::iterator f, b;
-       const framecnt_t gap_frames = (framecnt_t) floor (gap_msecs * (sr / 1000.0));
+       const samplecnt_t gap_samples = (samplecnt_t) floor (gap_msecs * (sr / 1000.0));
 
        while (i != t.end()) {
 
@@ -125,7 +135,7 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs
 
                // move f until we find a new value that is far enough away
 
-               while ((f != t.end()) && (((*f) - (*i)) < gap_frames)) {
+               while ((f != t.end()) && (((*f) - (*i)) < gap_samples)) {
                        ++f;
                }