changeset 138:d71170f5ba76 vamp-fft-revision

Fix some compiler warnings
author Chris Cannam
date Fri, 19 Aug 2016 13:26:55 +0100
parents 109c3a2ad930
children 9287a83b1243
files LocalCandidatePYIN.cpp Makefile.linux64 MonoPitchHMM.cpp MonoPitchHMM.h PYinVamp.cpp SparseHMM.cpp YinVamp.cpp
diffstat 7 files changed, 24 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/LocalCandidatePYIN.cpp	Fri Aug 19 13:26:40 2016 +0100
+++ b/LocalCandidatePYIN.cpp	Fri Aug 19 13:26:55 2016 +0100
@@ -228,7 +228,7 @@
 }
 
 void
-LocalCandidatePYIN::selectProgram(string name)
+LocalCandidatePYIN::selectProgram(string)
 {
 }
 
@@ -387,7 +387,6 @@
         }
 
         vector<float> mpOut = mp.process(tempPitchProb);
-        float prevFreq = 0;
         for (size_t iFrame = 0; iFrame < nFrame; ++iFrame)
         {
             if (mpOut[iFrame] > 0) {
@@ -395,8 +394,6 @@
                 pitchTracks[iCandidate][iFrame] = mpOut[iFrame];
                 freqSum[iCandidate] += mpOut[iFrame];
                 freqNumber[iCandidate]++;
-                prevFreq = mpOut[iFrame];
-
             }
         }
         freqMean[iCandidate] = freqSum[iCandidate]*1.0/freqNumber[iCandidate];
--- a/Makefile.linux64	Fri Aug 19 13:26:40 2016 +0100
+++ b/Makefile.linux64	Fri Aug 19 13:26:55 2016 +0100
@@ -1,5 +1,6 @@
 
 CFLAGS := $(CFLAGS) -Wall -O3 -fPIC -I../vamp-plugin-sdk/ -I../../vamp-plugin-sdk/
+#CFLAGS := $(CFLAGS) -Wall -Wextra -Werror -g -fPIC -I../vamp-plugin-sdk/ -I../../vamp-plugin-sdk/
 
 CXXFLAGS := $(CXXFLAGS) $(CFLAGS)
 
--- a/MonoPitchHMM.cpp	Fri Aug 19 13:26:40 2016 +0100
+++ b/MonoPitchHMM.cpp	Fri Aug 19 13:26:55 2016 +0100
@@ -22,18 +22,18 @@
 using std::pair;
 
 MonoPitchHMM::MonoPitchHMM() :
-m_minFreq(61.735),
-m_nBPS(5),
-m_nPitch(0),
-m_transitionWidth(0),
-m_selfTrans(0.99),
-m_yinTrust(.5),
-m_freqs(0)
+    m_minFreq(61.735),
+    m_nBPS(5),
+    m_nPitch(0),
+    m_transitionWidth(0),
+    m_selfTrans(0.99),
+    m_yinTrust(.5),
+    m_freqs(0)
 {
     m_transitionWidth = 5*(m_nBPS/2) + 1;
     m_nPitch = 69 * m_nBPS;
     m_freqs = vector<double>(2*m_nPitch);
-    for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
+    for (int iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
         m_freqs[iPitch] = m_minFreq * std::pow(2, iPitch * 1.0 / (12 * m_nBPS));
         m_freqs[iPitch+m_nPitch] = -m_freqs[iPitch];
@@ -47,13 +47,13 @@
     vector<double> out = vector<double>(2*m_nPitch+1);
     double probYinPitched = 0;
     // BIN THE PITCHES
-    for (size_t iPair = 0; iPair < pitchProb.size(); ++iPair)
+    for (int iPair = 0; iPair < int(pitchProb.size()); ++iPair)
     {
         double freq = 440. * std::pow(2, (pitchProb[iPair].first - 69)/12);
         if (freq <= m_minFreq) continue;
         double d = 0;
         double oldd = 1000;
-        for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
+        for (int iPitch = 0; iPitch < m_nPitch; ++iPitch)
         {
             d = std::abs(freq-m_freqs[iPitch]);
             if (oldd < d && iPitch > 0)
@@ -70,7 +70,7 @@
     double probReallyPitched = m_yinTrust * probYinPitched;
     // std::cerr << probReallyPitched << " " << probYinPitched << std::endl;
     // damn, I forget what this is all about...
-    for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
+    for (int iPitch = 0; iPitch < m_nPitch; ++iPitch)
     {
         if (probYinPitched > 0) out[iPitch] *= (probReallyPitched/probYinPitched) ;
         out[iPitch+m_nPitch] = (1 - probReallyPitched) / m_nPitch;
@@ -86,16 +86,16 @@
     init = vector<double>(2*m_nPitch, 1.0 / 2*m_nPitch);
     
     // TRANSITIONS
-    for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
+    for (int iPitch = 0; iPitch < int(m_nPitch); ++iPitch)
     {
-        int theoreticalMinNextPitch = static_cast<int>(iPitch)-static_cast<int>(m_transitionWidth/2);
+        int theoreticalMinNextPitch = iPitch-m_transitionWidth/2;
         int minNextPitch = iPitch>m_transitionWidth/2 ? iPitch-m_transitionWidth/2 : 0;
         int maxNextPitch = iPitch<m_nPitch-m_transitionWidth/2 ? iPitch+m_transitionWidth/2 : m_nPitch-1;
         
         // WEIGHT VECTOR
         double weightSum = 0;
         vector<double> weights;
-        for (size_t i = minNextPitch; i <= maxNextPitch; ++i)
+        for (int i = minNextPitch; i <= maxNextPitch; ++i)
         {
             if (i <= iPitch)
             {
@@ -110,7 +110,7 @@
         
         // std::cerr << minNextPitch << "  " << maxNextPitch << std::endl;
         // TRANSITIONS TO CLOSE PITCH
-        for (size_t i = minNextPitch; i <= maxNextPitch; ++i)
+        for (int i = minNextPitch; i <= maxNextPitch; ++i)
         {
             from.push_back(iPitch);
             to.push_back(i);
@@ -146,7 +146,7 @@
     // to.push_back(2*m_nPitch);
     // transProb.push_back(m_selfTrans);
     
-    // for (size_t i = 0; i < from.size(); ++i) {
+    // for (int i = 0; i < from.size(); ++i) {
     //     std::cerr << "P(["<< from[i] << " --> " << to[i] << "]) = " << transProb[i] << std::endl;
     // }
     
--- a/MonoPitchHMM.h	Fri Aug 19 13:26:40 2016 +0100
+++ b/MonoPitchHMM.h	Fri Aug 19 13:26:55 2016 +0100
@@ -28,13 +28,11 @@
 public:
     MonoPitchHMM();
     const std::vector<double> calculateObsProb(const vector<pair<double, double> >);
-    // double getMidiPitch(size_t index);
-    // double getFrequency(size_t index);
     void build();
     double m_minFreq; // 82.40689f/2
-    size_t m_nBPS;
-    size_t m_nPitch;
-    size_t m_transitionWidth;
+    int m_nBPS;
+    int m_nPitch;
+    int m_transitionWidth;
     double m_selfTrans;
     double m_yinTrust;
     vector<double> m_freqs;
--- a/PYinVamp.cpp	Fri Aug 19 13:26:40 2016 +0100
+++ b/PYinVamp.cpp	Fri Aug 19 13:26:55 2016 +0100
@@ -281,7 +281,7 @@
 }
 
 void
-PYinVamp::selectProgram(string name)
+PYinVamp::selectProgram(string)
 {
 }
 
--- a/SparseHMM.cpp	Fri Aug 19 13:26:40 2016 +0100
+++ b/SparseHMM.cpp	Fri Aug 19 13:26:55 2016 +0100
@@ -20,7 +20,7 @@
 using std::pair;
 
 const vector<double>
-SparseHMM::calculateObsProb(const vector<pair<double, double> > data)
+SparseHMM::calculateObsProb(const vector<pair<double, double> > )
 {
     // dummy (virtual?) implementation to be overloaded
     return(vector<double>());
--- a/YinVamp.cpp	Fri Aug 19 13:26:40 2016 +0100
+++ b/YinVamp.cpp	Fri Aug 19 13:26:55 2016 +0100
@@ -192,7 +192,7 @@
 }
 
 void
-YinVamp::selectProgram(string name)
+YinVamp::selectProgram(string)
 {
 }