changeset 61:b83587573996

plugins/Pitch.cpp: use aubio_miditofreq
author Paul Brossier <piem@piem.org>
date Tue, 31 Dec 2013 01:24:53 -0400
parents 9d15e92f2c18
children b8148ed9ffe1
files plugins/Pitch.cpp
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/Pitch.cpp	Tue Dec 31 00:18:26 2013 -0400
+++ b/plugins/Pitch.cpp	Tue Dec 31 01:24:53 2013 -0400
@@ -22,20 +22,14 @@
 using std::cerr;
 using std::endl;
 
-static float
-getFrequencyForMIDIPitch(int midiPitch)
-{
-    return 440.f * powf(2.0, (float(midiPitch) - 69.0) / 12.0);
-}
-
 Pitch::Pitch(float inputSampleRate) :
     Plugin(inputSampleRate),
     m_ibuf(0),
     m_obuf(0),
     m_pitchdet(0),
     m_pitchtype(PitchYinFFT),
-    m_minfreq(getFrequencyForMIDIPitch(32)),
-    m_maxfreq(getFrequencyForMIDIPitch(95)),
+    m_minfreq(aubio_miditofreq(32)),
+    m_maxfreq(aubio_miditofreq(95)),
     m_silence(-90),
     m_wrapRange(false),
     m_stepSize(0),
@@ -156,7 +150,7 @@
     desc.name = "Minimum Fundamental Frequency";
     desc.minValue = 1;
     desc.maxValue = m_inputSampleRate/2;
-    desc.defaultValue = getFrequencyForMIDIPitch(32);
+    desc.defaultValue = aubio_miditofreq(32);
     desc.unit = "Hz";
     desc.isQuantized = false;
     list.push_back(desc);
@@ -166,7 +160,7 @@
     desc.name = "Maximum Fundamental Frequency";
     desc.minValue = 1;
     desc.maxValue = m_inputSampleRate/2;
-    desc.defaultValue = getFrequencyForMIDIPitch(95);
+    desc.defaultValue = aubio_miditofreq(95);
     desc.unit = "Hz";
     desc.isQuantized = false;
     list.push_back(desc);