changeset 493:bb78ca3fe7de

Remove "using" from some headers
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 31 May 2019 17:24:50 +0100
parents 2892ecc40f86
children 3f649fbb1172
files dsp/segmentation/ClusterMeltSegmenter.cpp dsp/segmentation/ClusterMeltSegmenter.h dsp/segmentation/Segmenter.cpp dsp/segmentation/Segmenter.h dsp/tempotracking/DownBeat.cpp dsp/tempotracking/DownBeat.h dsp/tempotracking/TempoTrack.cpp dsp/tempotracking/TempoTrack.h dsp/tempotracking/TempoTrackV2.cpp dsp/tempotracking/TempoTrackV2.h dsp/tonal/ChangeDetectionFunction.h maths/CosineDistance.cpp maths/CosineDistance.h maths/KLDivergence.cpp maths/KLDivergence.h
diffstat 15 files changed, 59 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/dsp/segmentation/ClusterMeltSegmenter.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/segmentation/ClusterMeltSegmenter.cpp	Fri May 31 17:24:50 2019 +0100
@@ -25,6 +25,8 @@
 #include "dsp/rateconversion/Decimator.h"
 #include "dsp/mfcc/MFCC.h"
 
+using std::vector;
+
 ClusterMeltSegmenter::ClusterMeltSegmenter(ClusterMeltSegmenterParams params) :
     window(NULL),
     fft(NULL),
--- a/dsp/segmentation/ClusterMeltSegmenter.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/segmentation/ClusterMeltSegmenter.h	Fri May 31 17:24:50 2019 +0100
@@ -23,8 +23,6 @@
 #include "hmm/hmm.h"
 #include "base/Window.h"
 
-using std::vector;
-
 class Decimator;
 class ConstantQ;
 class MFCC;
@@ -68,7 +66,7 @@
     virtual int getWindowsize();
     virtual int getHopsize();
     virtual void extractFeatures(const double* samples, int nsamples);
-    void setFeatures(const vector<vector<double> >& f);         // provide the features yourself
+    void setFeatures(const std::vector<std::vector<double> >& f);         // provide the features yourself
     virtual void segment();             // segment into default number of segment-types
     void segment(int m);                // segment into m segment-types
     int getNSegmentTypes() { return nclusters; }
@@ -85,7 +83,7 @@
     MFCC* mfcc;
     model_t* model;                             // the HMM
     int* q;                                     // the decoded HMM state sequence
-    vector<vector<double> > histograms; 
+    std::vector<std::vector<double> > histograms; 
     
     feature_types featureType;  
     double hopSize;             // in seconds
--- a/dsp/segmentation/Segmenter.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/segmentation/Segmenter.cpp	Fri May 31 17:24:50 2019 +0100
@@ -17,6 +17,8 @@
 
 #include "Segmenter.h"
 
+using std::ostream;
+
 ostream& operator<<(ostream& os, const Segmentation& s)
 {
     os << "structure_name : begin_time end_time\n";
--- a/dsp/segmentation/Segmenter.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/segmentation/Segmenter.h	Fri May 31 17:24:50 2019 +0100
@@ -20,9 +20,6 @@
 #include <vector>
 #include <iostream>
 
-using std::vector;
-using std::ostream;
-
 class Segment
 {
 public:
@@ -36,10 +33,10 @@
 public:
     int nsegtypes;          // number of segment types, so possible types are {0,1,...,nsegtypes-1}
     int samplerate;
-    vector<Segment> segments;       
+    std::vector<Segment> segments;       
 };
 
-ostream& operator<<(ostream& os, const Segmentation& s);
+std::ostream& operator<<(std::ostream& os, const Segmentation& s);
 
 class Segmenter
 {
@@ -55,7 +52,7 @@
     virtual void clear() { features.clear(); }
     const Segmentation& getSegmentation() const { return segmentation; } 
 protected:
-    vector<vector<double> > features;
+    std::vector<std::vector<double> > features;
     Segmentation segmentation;
     int samplerate;
 };
--- a/dsp/tempotracking/DownBeat.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/DownBeat.cpp	Fri May 31 17:24:50 2019 +0100
@@ -23,6 +23,8 @@
 #include <iostream>
 #include <cstdlib>
 
+using std::vector;
+
 DownBeat::DownBeat(float originalSampleRate,
                    size_t decimationFactor,
                    size_t dfIncrement) :
--- a/dsp/tempotracking/DownBeat.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/DownBeat.h	Fri May 31 17:24:50 2019 +0100
@@ -21,8 +21,6 @@
 
 #include "dsp/rateconversion/Decimator.h"
 
-using std::vector;
-
 class FFTReal;
 
 /**
@@ -71,8 +69,8 @@
      */
     void findDownBeats(const float *audio, // downsampled
                        size_t audioLength, // after downsampling
-                       const vector<double> &beats,
-                       vector<int> &downbeats);
+                       const std::vector<double> &beats,
+                       std::vector<int> &downbeats);
 
     /**
      * Return the beat spectral difference function.  This is
@@ -83,7 +81,7 @@
      * difference between region prior to the beat's nominal position
      * and the region following it.
      */
-    void getBeatSD(vector<double> &beatsd) const;
+    void getBeatSD(std::vector<double> &beatsd) const;
     
     /**
      * For your downsampling convenience: call this function
@@ -107,10 +105,10 @@
     void resetAudioBuffer();
 
 private:
-    typedef vector<int> i_vec_t;
-    typedef vector<vector<int> > i_mat_t;
-    typedef vector<double> d_vec_t;
-    typedef vector<vector<double> > d_mat_t;
+    typedef std::vector<int> i_vec_t;
+    typedef std::vector<std::vector<int> > i_mat_t;
+    typedef std::vector<double> d_vec_t;
+    typedef std::vector<std::vector<double> > d_mat_t;
 
     void makeDecimators();
     double measureSpecDiff(d_vec_t oldspec, d_vec_t newspec);
--- a/dsp/tempotracking/TempoTrack.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/TempoTrack.cpp	Fri May 31 17:24:50 2019 +0100
@@ -24,6 +24,8 @@
 #include <cmath>
 #include <cstdlib>
 
+using std::vector;
+
 //#define DEBUG_TEMPO_TRACK 1
 
 //////////////////////////////////////////////////////////////////////
--- a/dsp/tempotracking/TempoTrack.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/TempoTrack.h	Fri May 31 17:24:50 2019 +0100
@@ -24,10 +24,6 @@
 #include "maths/Correlation.h"
 #include "dsp/signalconditioning/Framer.h"
 
-
-
-using std::vector;
-
 struct WinThresh
 {
     int pre;
@@ -52,7 +48,8 @@
     TempoTrack( TTParams Params );
     virtual ~TempoTrack();
 
-    vector<int> process( vector <double> DF, vector <double> *tempoReturn = 0);
+    std::vector<int> process( std::vector <double> DF,
+                              std::vector <double> *tempoReturn = 0);
 
         
 private:
@@ -76,7 +73,7 @@
     double m_sigma;
     double m_DFWVNnorm;
 
-    vector<int>  m_beats; // Vector of detected beats
+    std::vector<int>  m_beats; // Vector of detected beats
 
     double m_lockedTempo;
 
--- a/dsp/tempotracking/TempoTrackV2.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/TempoTrackV2.cpp	Fri May 31 17:24:50 2019 +0100
@@ -21,10 +21,13 @@
 
 #include "maths/MathUtilities.h"
 
+using std::vector;
+
 #define   EPS 0.0000008 // just some arbitrary small number
 
-TempoTrackV2::TempoTrackV2(float rate, size_t increment) :
-    m_rate(rate), m_increment(increment) { }
+TempoTrackV2::TempoTrackV2(float rate, int increment) :
+    m_rate(rate), m_increment(increment) {
+}
 
 TempoTrackV2::~TempoTrackV2() { }
 
--- a/dsp/tempotracking/TempoTrackV2.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tempotracking/TempoTrackV2.h	Fri May 31 17:24:50 2019 +0100
@@ -17,7 +17,6 @@
 #define QM_DSP_TEMPOTRACKV2_H
 
 #include <vector>
-using namespace std;
 
 //!!! Question: how far is this actually sample rate dependent?  I
 // think it does produce plausible results for e.g. 48000 as well as
@@ -35,47 +34,47 @@
      * Currently the sample rate and increment are used only for the
      * conversion from beat frame location to bpm in the tempo array.
      */
-    TempoTrackV2(float sampleRate, size_t dfIncrement);
+    TempoTrackV2(float sampleRate, int dfIncrement);
     ~TempoTrackV2();
 
     // Returned beat periods are given in df increment units; inputtempo and tempi in bpm
-    void calculateBeatPeriod(const vector<double> &df,
-                             vector<double> &beatPeriod,
-                             vector<double> &tempi) {
+    void calculateBeatPeriod(const std::vector<double> &df,
+                             std::vector<double> &beatPeriod,
+                             std::vector<double> &tempi) {
         calculateBeatPeriod(df, beatPeriod, tempi, 120.0, false);
     }
 
     // Returned beat periods are given in df increment units; inputtempo and tempi in bpm
     // MEPD 28/11/12 Expose inputtempo and constraintempo parameters
     // Note, if inputtempo = 120 and constraintempo = false, then functionality is as it was before
-    void calculateBeatPeriod(const vector<double> &df,
-                             vector<double> &beatPeriod,
-                             vector<double> &tempi,
+    void calculateBeatPeriod(const std::vector<double> &df,
+                             std::vector<double> &beatPeriod,
+                             std::vector<double> &tempi,
                              double inputtempo, bool constraintempo);
 
     // Returned beat positions are given in df increment units
-    void calculateBeats(const vector<double> &df,
-                        const vector<double> &beatPeriod,
-                        vector<double> &beats) {
+    void calculateBeats(const std::vector<double> &df,
+                        const std::vector<double> &beatPeriod,
+                        std::vector<double> &beats) {
         calculateBeats(df, beatPeriod, beats, 0.9, 4.0);
     }
 
     // Returned beat positions are given in df increment units
     // MEPD 28/11/12 Expose alpha and tightness parameters
     // Note, if alpha = 0.9 and tightness = 4, then functionality is as it was before
-    void calculateBeats(const vector<double> &df,
-                        const vector<double> &beatPeriod,
-                        vector<double> &beats,
+    void calculateBeats(const std::vector<double> &df,
+                        const std::vector<double> &beatPeriod,
+                        std::vector<double> &beats,
                         double alpha, double tightness);
 
 private:
-    typedef vector<int> i_vec_t;
-    typedef vector<vector<int> > i_mat_t;
-    typedef vector<double> d_vec_t;
-    typedef vector<vector<double> > d_mat_t;
+    typedef std::vector<int> i_vec_t;
+    typedef std::vector<std::vector<int> > i_mat_t;
+    typedef std::vector<double> d_vec_t;
+    typedef std::vector<std::vector<double> > d_mat_t;
 
     float m_rate;
-    size_t m_increment;
+    int m_increment;
 
     void adapt_thresh(d_vec_t &df);
     double mean_array(const d_vec_t &dfin, int start, int end);
--- a/dsp/tonal/ChangeDetectionFunction.h	Fri May 31 16:55:25 2019 +0100
+++ b/dsp/tonal/ChangeDetectionFunction.h	Fri May 31 17:24:50 2019 +0100
@@ -19,9 +19,8 @@
 #include "TCSgram.h"
 
 #include <valarray>
-using std::valarray;
 
-typedef valarray<double> ChangeDistance;
+typedef std::valarray<double> ChangeDistance;
 
 struct ChangeDFConfig
 {
@@ -38,7 +37,7 @@
     void setFilterWidth(const int iWidth);
         
 private:
-    valarray<double> m_vaGaussian;
+    std::valarray<double> m_vaGaussian;
     double m_dFilterSigma;
     int m_iFilterWidth;
 };
--- a/maths/CosineDistance.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/maths/CosineDistance.cpp	Fri May 31 17:24:50 2019 +0100
@@ -19,6 +19,7 @@
 #include <limits>
 
 using std::cerr;
+using std::vector;
 
 double CosineDistance::distance(const vector<double> &v1,
                                 const vector<double> &v2)
--- a/maths/CosineDistance.h	Fri May 31 16:55:25 2019 +0100
+++ b/maths/CosineDistance.h	Fri May 31 17:24:50 2019 +0100
@@ -18,15 +18,14 @@
 #include <vector>
 #include <math.h>
 
-using std::vector;
-
 class CosineDistance
 {
 public:
     CosineDistance() { }
     ~CosineDistance() { }
 
-    double distance(const vector<double> &v1, const vector<double> &v2);
+    double distance(const std::vector<double> &v1,
+                    const std::vector<double> &v2);
 
 protected:
     double dist, dDenTot, dDen1, dDen2, dSum1;
--- a/maths/KLDivergence.cpp	Fri May 31 16:55:25 2019 +0100
+++ b/maths/KLDivergence.cpp	Fri May 31 17:24:50 2019 +0100
@@ -17,6 +17,8 @@
 
 #include <cmath>
 
+using std::vector;
+
 double KLDivergence::distanceGaussian(const vector<double> &m1,
                                       const vector<double> &v1,
                                       const vector<double> &m2,
--- a/maths/KLDivergence.h	Fri May 31 16:55:25 2019 +0100
+++ b/maths/KLDivergence.h	Fri May 31 17:24:50 2019 +0100
@@ -17,8 +17,6 @@
 
 #include <vector>
 
-using std::vector;
-
 /**
  * Helper methods for calculating Kullback-Leibler divergences.
  */
@@ -33,10 +31,10 @@
      * models based on mean and variance vectors.  All input vectors
      * must be of equal size.
      */
-    double distanceGaussian(const vector<double> &means1,
-                            const vector<double> &variances1,
-                            const vector<double> &means2,
-                            const vector<double> &variances2);
+    double distanceGaussian(const std::vector<double> &means1,
+                            const std::vector<double> &variances1,
+                            const std::vector<double> &means2,
+                            const std::vector<double> &variances2);
 
     /**
      * Calculate a Kullback-Leibler divergence of two probability
@@ -44,8 +42,8 @@
      * symmetrised is true, the result will be the symmetrised
      * distance (equal to KL(d1, d2) + KL(d2, d1)).
      */
-    double distanceDistribution(const vector<double> &d1,
-                                const vector<double> &d2,
+    double distanceDistribution(const std::vector<double> &d1,
+                                const std::vector<double> &d2,
                                 bool symmetrised);
 };