Skip to content

Commit

Permalink
Merge pull request #896 from pabloEntropia/compilation_warnings_fixes
Browse files Browse the repository at this point in the history
Compilation warnings fixes
  • Loading branch information
dbogdanov authored Aug 3, 2019
2 parents 2081d51 + d93fcb3 commit d8293a1
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/algorithms/audioproblems/clickdetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void ClickDetector::configure() {
_startProc = int(_frameSize / 2 - _hopSize / 2);
_endProc = int(_frameSize / 2 + _hopSize / 2);

if (_startProc < _order) {
if (_startProc < (uint)_order) {
uint unproc = _order - _startProc;
uint maxHop = _frameSize - 2 * _order;
E_INFO("ClickDetector: non-optimal 'HopSize' parameter. The " << unproc << " first samples will not be processed."
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/spectral/triangularbands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void TriangularBands::compute() {
throw EssentiaException("TriangularBands: the size of the input spectrum is not greater than one");
}

if (_filterCoefficients.empty() || int(_filterCoefficients[0].size()) != spectrum.size()) {
if (_filterCoefficients.empty() || _filterCoefficients[0].size() != spectrum.size()) {
E_INFO("TriangularBands: input spectrum size (" << spectrum.size() << ") does not correspond to the \"inputSize\" parameter (" << _filterCoefficients[0].size() << "). Recomputing the filter bank.");
createFilters(spectrum.size());
}
Expand Down
10 changes: 5 additions & 5 deletions src/algorithms/standard/peakdetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,20 @@ void PeakDetection::compute() {
std::sort(peaks.begin(), peaks.end(),
ComparePeakMagnitude<std::greater<Real>, std::less<Real> >());

int k = 0;
size_t k = 0;
while (k < peaks.size() - 1) {
minPos = peaks[k].position - _minPeakDistance;
maxPos = peaks[k].position + _minPeakDistance;

for (int l = k+1; l < peaks.size(); l++) {
for (size_t l = k+1; l < peaks.size(); l++) {
if (peaks[l].position > minPos && peaks[l].position < maxPos)
deletedPeaks.push_back(l);
}

// delete peaks starting from the end so the indexes are not altered
std::sort(deletedPeaks.begin(), deletedPeaks.end(), std::greater<int>());

for (int l = 0; l < deletedPeaks.size(); l++)
for (size_t l = 0; l < deletedPeaks.size(); l++)
peaks.erase(peaks.begin() + deletedPeaks[l]);

deletedPeaks.clear();
Expand Down Expand Up @@ -232,12 +232,12 @@ void PeakDetection::compute() {


// we only want this many peaks
int nWantedPeaks = std::min((int)_maxPeaks, (int)peaks.size());
size_t nWantedPeaks = std::min((size_t)_maxPeaks, peaks.size());

peakPosition.resize(nWantedPeaks);
peakValue.resize(nWantedPeaks);

for (int k=0; k<nWantedPeaks; k++) {
for (size_t k=0; k<nWantedPeaks; k++) {
peakPosition[k] = peaks[k].position;
peakValue[k] = peaks[k].magnitude;
}
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/stats/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void Histogram::compute() {
histogram.resize(_numberBins);
binEdges.assign(tempBinEdges.begin(), tempBinEdges.end());

for(int i = 0; i < array.size(); i++){
for(size_t i = 0; i < array.size(); i++){
if(array[i] < _maxValue && array[i] >= _minValue)
histogram[floor(array[i]/(Real)binWidth)]++;
else if(array[i] == _maxValue)
Expand Down
1 change: 0 additions & 1 deletion src/algorithms/tonal/pitchyinprobabilistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ AlgorithmStatus PitchYinProbabilistic::process() {

const vector<vector<Real> >& pitchCandidates = _pool.value<vector<vector<Real> > >("frequencies");
const vector<vector<Real> >& probabilities = _pool.value<vector<vector<Real> > >("probabilities");
const vector<Real>& _RMS = _pool.value<vector<Real> >("RMS");

vector<Real> tempPitch;
_yinProbabilitiesHMM->input("pitchCandidates").set(pitchCandidates);
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/tonal/pitchyinprobabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void PitchYinProbabilities::compute() {

Real nonPeakProb = 1.0;
if (sumProb > 0) {
for (int i = minTau; i < maxTau; ++i)
for (size_t i = minTau; i < maxTau; ++i)
{
_peakProb[i] = _peakProb[i] / sumProb * _peakProb[minInd];
nonPeakProb -= _peakProb[i];
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/tonal/pitchyinprobabilitieshmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void PitchYinProbabilitiesHMM::configure() {
for (size_t iPitch = 0; iPitch < _nPitch; ++iPitch)
{
int theoreticalMinNextPitch = static_cast<int>(iPitch)-static_cast<int>(_transitionWidth / 2);
int minNextPitch = iPitch > _transitionWidth/2 ? iPitch - _transitionWidth / 2 : 0;
int maxNextPitch = iPitch < _nPitch - _transitionWidth / 2 ? iPitch + _transitionWidth / 2 : _nPitch - 1;
size_t minNextPitch = iPitch > _transitionWidth/2 ? iPitch - _transitionWidth / 2 : 0;
size_t maxNextPitch = iPitch < _nPitch - _transitionWidth / 2 ? iPitch + _transitionWidth / 2 : _nPitch - 1;

// WEIGHT VECTOR
Real weightSum = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/essentia/configurable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void Configurable::setParameters(const ParameterMap& params) {

// check that the parameter fits in its valid range, if specified
const string& srange = parameterRange[name];
auto_ptr<Range> r(Range::create(srange));
unique_ptr<Range> r(Range::create(srange));

if (!r->contains(value)) {
ostringstream msg;
Expand Down
2 changes: 1 addition & 1 deletion src/essentia/utils/metadatautils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void pcmMetadata(const std::string& filename, int& sr, int& ch, int& bitrate) {
}

// (trick) create an audioloader to know the original samplerate
std::auto_ptr<streaming::Algorithm> audioloader(streaming::AlgorithmFactory::create("AudioLoader",
std::unique_ptr<streaming::Algorithm> audioloader(streaming::AlgorithmFactory::create("AudioLoader",
"filename", filename));

sr = (int)streaming::lastTokenProduced<Real>(audioloader->output("sampleRate"));
Expand Down

0 comments on commit d8293a1

Please sign in to comment.