(Start to) remove the channel counts from everywhere: they should always be 1 anyway...
authorChris Cannam <cannam@all-day-breakfast.com>
Mon, 9 Jul 2012 14:50:30 +0000 (15:50 +0100)
committerChris Cannam <cannam@all-day-breakfast.com>
Mon, 9 Jul 2012 14:50:30 +0000 (15:50 +0100)
plugins/Notes.cpp
plugins/Notes.h
plugins/Onset.cpp
plugins/Onset.h
plugins/Pitch.cpp
plugins/Pitch.h
plugins/Silence.cpp
plugins/Silence.h
plugins/Tempo.cpp
plugins/Tempo.h

index 30ba640..d338690 100644 (file)
@@ -96,7 +96,11 @@ Notes::getCopyright() const
 bool
 Notes::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
-    m_channelCount = channels;
+    if (channels != 1) {
+        std::cerr << "Notes::initialise: channels must be 1" << std::endl;
+        return false;
+    }
+
     m_stepSize = stepSize;
     m_blockSize = blockSize;
 
@@ -108,17 +112,16 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize)
         processingBlockSize = stepSize * 4;
     }
 
-    m_ibuf = new_fvec(stepSize, channels);
-    m_onset = new_fvec(1, channels);
-    m_fftgrain = new_cvec(processingBlockSize, channels);
-    m_pv = new_aubio_pvoc(processingBlockSize, stepSize, channels);
+    m_ibuf = new_fvec(stepSize);
+    m_onset = new_fvec(1);
+    m_fftgrain = new_cvec(processingBlockSize);
+    m_pv = new_aubio_pvoc(processingBlockSize, stepSize);
     m_peakpick = new_aubio_peakpicker(m_threshold);
 
-    m_onsetdet = new_aubio_onsetdetection(m_onsettype, processingBlockSize, channels);
+    m_onsetdet = new_aubio_onsetdetection(m_onsettype, processingBlockSize);
 
     m_pitchdet = new_aubio_pitchdetection(processingBlockSize * 4,
                                           stepSize,
-                                          channels,
                                           lrintf(m_inputSampleRate),
                                           m_pitchtype,
                                           m_pitchmode);
index 9550350..723a81e 100644 (file)
@@ -71,7 +71,6 @@ protected:
     size_t m_median;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     int m_minpitch;
     int m_maxpitch;
     bool m_wrapRange;
index daf0567..3e3f8d9 100644 (file)
@@ -32,8 +32,7 @@ Onset::Onset(float inputSampleRate) :
     m_onsetdet(0),
     m_onsettype(aubio_onset_complex),
     m_threshold(0.3),
-    m_silence(-90),
-    m_channelCount(1)
+    m_silence(-90)
 {
 }
 
@@ -86,17 +85,21 @@ Onset::getCopyright() const
 bool
 Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
-    m_channelCount = channels;
+    if (channels != 1) {
+        std::cerr << "Onset::initialise: channels must be 1" << std::endl;
+        return false;
+    }
+
     m_stepSize = stepSize;
     m_blockSize = blockSize;
 
-    m_ibuf = new_fvec(stepSize, channels);
-    m_onset = new_fvec(1, channels);
-    m_fftgrain = new_cvec(blockSize, channels);
-    m_pv = new_aubio_pvoc(blockSize, stepSize, channels);
+    m_ibuf = new_fvec(stepSize);
+    m_onset = new_fvec(1);
+    m_fftgrain = new_cvec(blockSize);
+    m_pv = new_aubio_pvoc(blockSize, stepSize);
     m_peakpick = new_aubio_peakpicker(m_threshold);
 
-    m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize, channels);
+    m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize);
     
     m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
                                              lrintf(m_inputSampleRate));
@@ -221,7 +224,7 @@ Onset::getOutputDescriptors() const
     d.name = "Onset Detection Function";
     d.unit = "";
     d.hasFixedBinCount = true;
-    d.binCount = m_channelCount;
+    d.binCount = 1;
     d.hasKnownExtents = false;
     d.isQuantized = false;
     d.sampleType = OutputDescriptor::OneSamplePerStep;
index a88409c..80fd0e6 100644 (file)
@@ -66,7 +66,6 @@ protected:
     float m_silence;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     Vamp::RealTime m_delay;
     Vamp::RealTime m_lastOnset;
 };
index 054c69c..40c310e 100644 (file)
@@ -38,8 +38,7 @@ Pitch::Pitch(float inputSampleRate) :
     m_silence(-90),
     m_wrapRange(false),
     m_stepSize(0),
-    m_blockSize(0),
-    m_channelCount(0)
+    m_blockSize(0)
 {
 }
 
@@ -88,11 +87,15 @@ Pitch::getCopyright() const
 bool
 Pitch::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
-    m_channelCount = channels;
+    if (channels != 1) {
+        std::cerr << "Pitch::initialise: channels must be 1" << std::endl;
+        return false;
+    }
+
     m_stepSize = stepSize;
     m_blockSize = blockSize;
 
-    m_ibuf = new_fvec(stepSize, channels);
+    m_ibuf = new_fvec(stepSize);
 
     m_pitchdet = new_aubio_pitchdetection(blockSize,
                                           stepSize,
index f8d7b48..e7b0ec5 100644 (file)
@@ -65,7 +65,6 @@ protected:
 
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
 };
 
 
index 084ac02..cf3dda4 100644 (file)
@@ -78,12 +78,16 @@ Silence::getCopyright() const
 bool
 Silence::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
-    m_channelCount = channels;
+    if (channels != 1) {
+        std::cerr << "Silence::initialise: channels must be 1" << std::endl;
+        return false;
+    }
+
     m_stepSize = stepSize;
     m_blockSize = blockSize;
 
-    m_ibuf = new_fvec(stepSize, channels);
-    m_pbuf = new_fvec(stepSize, channels);
+    m_ibuf = new_fvec(stepSize);
+    m_pbuf = new_fvec(stepSize);
     m_tmpptrs = new smpl_t *[channels];
 
     return true;
index 2a3faca..5b1e4cf 100644 (file)
@@ -59,7 +59,6 @@ protected:
     float m_threshold;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     bool m_prevSilent;
     bool m_first;
     Vamp::RealTime m_lastChange;
index 58b35f0..27b817d 100644 (file)
@@ -38,8 +38,7 @@ Tempo::Tempo(float inputSampleRate) :
     m_btout(0),
     m_btcounter(0),
     m_threshold(0.3),
-    m_silence(-90),
-    m_channelCount(1)
+    m_silence(-90)
 {
 }
 
@@ -95,17 +94,21 @@ Tempo::getCopyright() const
 bool
 Tempo::initialise(size_t channels, size_t stepSize, size_t blockSize)
 {
-    m_channelCount = channels;
+    if (channels != 1) {
+        std::cerr << "Tempo::initialise: channels must be 1" << std::endl;
+        return false;
+    }
+
     m_stepSize = stepSize;
     m_blockSize = blockSize;
 
-    m_ibuf = new_fvec(stepSize, channels);
-    m_onset = new_fvec(1, channels);
-    m_fftgrain = new_cvec(blockSize, channels);
-    m_pv = new_aubio_pvoc(blockSize, stepSize, channels);
+    m_ibuf = new_fvec(stepSize);
+    m_onset = new_fvec(1);
+    m_fftgrain = new_cvec(blockSize);
+    m_pv = new_aubio_pvoc(blockSize, stepSize);
     m_peakpick = new_aubio_peakpicker(m_threshold);
 
-    m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize, channels);
+    m_onsetdet = new_aubio_onsetdetection(m_onsettype, blockSize);
     
     m_delay = Vamp::RealTime::frame2RealTime(3 * stepSize,
                                              lrintf(m_inputSampleRate));
index ac8f6de..c70c068 100644 (file)
@@ -71,7 +71,6 @@ protected:
     float m_silence;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     Vamp::RealTime m_delay;
     Vamp::RealTime m_lastBeat;
 };