# HG changeset patch # User Chris Cannam # Date 1557939167 -3600 # Node ID 475571f398fedbfb7f5fecc1282c49c37fc7b4e6 # Parent aaf8fa1cde19b7e4143eb478a5f7363e717794f2 Fix a couple of compiler warnings diff -r aaf8fa1cde19 -r 475571f398fe src/TuningDifference.cpp --- a/src/TuningDifference.cpp Mon Jul 17 15:46:04 2017 +0100 +++ b/src/TuningDifference.cpp Wed May 15 17:52:47 2019 +0100 @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -199,7 +200,7 @@ d.isQuantized = false; d.sampleType = OutputDescriptor::VariableSampleRate; d.hasDuration = false; - m_outputs[d.identifier] = list.size(); + m_outputs[d.identifier] = int(list.size()); list.push_back(d); d.identifier = "tuningfreq"; @@ -212,7 +213,7 @@ d.isQuantized = false; d.sampleType = OutputDescriptor::VariableSampleRate; d.hasDuration = false; - m_outputs[d.identifier] = list.size(); + m_outputs[d.identifier] = int(list.size()); list.push_back(d); d.identifier = "reffeature"; @@ -226,7 +227,7 @@ d.sampleType = OutputDescriptor::FixedSampleRate; d.sampleRate = 1; d.hasDuration = false; - m_outputs[d.identifier] = list.size(); + m_outputs[d.identifier] = int(list.size()); list.push_back(d); d.identifier = "otherfeature"; @@ -240,7 +241,7 @@ d.sampleType = OutputDescriptor::FixedSampleRate; d.sampleRate = 1; d.hasDuration = false; - m_outputs[d.identifier] = list.size(); + m_outputs[d.identifier] = int(list.size()); list.push_back(d); d.identifier = "rotfeature"; @@ -254,7 +255,7 @@ d.sampleType = OutputDescriptor::FixedSampleRate; d.sampleRate = 1; d.hasDuration = false; - m_outputs[d.identifier] = list.size(); + m_outputs[d.identifier] = int(list.size()); list.push_back(d); return list; @@ -267,8 +268,9 @@ channels > getMaxChannelCount()) return false; if (stepSize != blockSize) return false; + if (m_blockSize > INT_MAX) return false; - m_blockSize = blockSize; + m_blockSize = int(blockSize); reset(); @@ -363,7 +365,8 @@ TuningDifference::process(const float *const *inputBuffers, Vamp::RealTime) { if (m_maxDuration > 0) { - int maxFrames = (m_maxDuration * m_inputSampleRate) / m_blockSize; + int maxFrames = int((m_maxDuration * m_inputSampleRate) / + float(m_blockSize)); if (m_frameCount > maxFrames) return FeatureSet(); } @@ -480,11 +483,11 @@ f.timestamp = Vamp::RealTime::zeroTime; f.values.clear(); - for (auto v: m_refFeature) f.values.push_back(v); + for (auto v: m_refFeature) f.values.push_back(float(v)); fs[m_outputs["reffeature"]].push_back(f); f.values.clear(); - for (auto v: otherFeature) f.values.push_back(v); + for (auto v: otherFeature) f.values.push_back(float(v)); fs[m_outputs["otherfeature"]].push_back(f); int rotation = findBestRotation(otherFeature); @@ -507,7 +510,7 @@ //!!! This should be returning the fine chroma, not the coarse f.values.clear(); - for (auto v: coarseFeature) f.values.push_back(v); + for (auto v: coarseFeature) f.values.push_back(float(v)); fs[m_outputs["rotfeature"]].push_back(f); pair fine = findFineFrequency(coarseCents, coarseScore); @@ -515,11 +518,11 @@ double fineHz = fine.second; f.values.clear(); - f.values.push_back(fineHz); + f.values.push_back(float(fineHz)); fs[m_outputs["tuningfreq"]].push_back(f); f.values.clear(); - f.values.push_back(fineCents); + f.values.push_back(float(fineCents)); fs[m_outputs["cents"]].push_back(f); cerr << "overall best Hz = " << fineHz << endl;