changeset 32:8a20f3488d88

(Start to) remove the channel counts from everywhere: they should always be 1 anyway as that's what Vamp::Plugin::getMaxChannelCount always defaulted to
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 09 Jul 2012 15:50:30 +0100
parents 2e979622bd93
children a2301c902711
files 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
diffstat 10 files changed, 47 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/Notes.cpp	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Notes.cpp	Mon Jul 09 15:50:30 2012 +0100
@@ -96,7 +96,11 @@
 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 @@
         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);
--- a/plugins/Notes.h	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Notes.h	Mon Jul 09 15:50:30 2012 +0100
@@ -71,7 +71,6 @@
     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;
--- a/plugins/Onset.cpp	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Onset.cpp	Mon Jul 09 15:50:30 2012 +0100
@@ -32,8 +32,7 @@
     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 @@
 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 @@
     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;
--- a/plugins/Onset.h	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Onset.h	Mon Jul 09 15:50:30 2012 +0100
@@ -66,7 +66,6 @@
     float m_silence;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     Vamp::RealTime m_delay;
     Vamp::RealTime m_lastOnset;
 };
--- a/plugins/Pitch.cpp	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Pitch.cpp	Mon Jul 09 15:50:30 2012 +0100
@@ -38,8 +38,7 @@
     m_silence(-90),
     m_wrapRange(false),
     m_stepSize(0),
-    m_blockSize(0),
-    m_channelCount(0)
+    m_blockSize(0)
 {
 }
 
@@ -88,11 +87,15 @@
 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,
--- a/plugins/Pitch.h	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Pitch.h	Mon Jul 09 15:50:30 2012 +0100
@@ -65,7 +65,6 @@
 
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
 };
 
 
--- a/plugins/Silence.cpp	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Silence.cpp	Mon Jul 09 15:50:30 2012 +0100
@@ -78,12 +78,16 @@
 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;
--- a/plugins/Silence.h	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Silence.h	Mon Jul 09 15:50:30 2012 +0100
@@ -59,7 +59,6 @@
     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;
--- a/plugins/Tempo.cpp	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Tempo.cpp	Mon Jul 09 15:50:30 2012 +0100
@@ -38,8 +38,7 @@
     m_btout(0),
     m_btcounter(0),
     m_threshold(0.3),
-    m_silence(-90),
-    m_channelCount(1)
+    m_silence(-90)
 {
 }
 
@@ -95,17 +94,21 @@
 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));
--- a/plugins/Tempo.h	Mon Jul 09 15:44:07 2012 +0100
+++ b/plugins/Tempo.h	Mon Jul 09 15:50:30 2012 +0100
@@ -71,7 +71,6 @@
     float m_silence;
     size_t m_stepSize;
     size_t m_blockSize;
-    size_t m_channelCount;
     Vamp::RealTime m_delay;
     Vamp::RealTime m_lastBeat;
 };