comparison dsp/segmentation/Segmenter.h @ 480:175e51ae78eb

Untabify, indent, tidy
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 31 May 2019 10:53:39 +0100
parents d5014ab8b0e5
children d48276a3ae24
comparison
equal deleted inserted replaced
479:7e52c034cf62 480:175e51ae78eb
23 using std::ostream; 23 using std::ostream;
24 24
25 class Segment 25 class Segment
26 { 26 {
27 public: 27 public:
28 int start; // in samples 28 int start; // in samples
29 int end; 29 int end;
30 int type; 30 int type;
31 }; 31 };
32 32
33 class Segmentation 33 class Segmentation
34 { 34 {
35 public: 35 public:
36 int nsegtypes; // number of segment types, so possible types are {0,1,...,nsegtypes-1} 36 int nsegtypes; // number of segment types, so possible types are {0,1,...,nsegtypes-1}
37 int samplerate; 37 int samplerate;
38 vector<Segment> segments; 38 vector<Segment> segments;
39 }; 39 };
40 40
41 ostream& operator<<(ostream& os, const Segmentation& s); 41 ostream& operator<<(ostream& os, const Segmentation& s);
42 42
43 class Segmenter 43 class Segmenter
44 { 44 {
45 public: 45 public:
46 Segmenter() {} 46 Segmenter() {}
47 virtual ~Segmenter() {} 47 virtual ~Segmenter() {}
48 virtual void initialise(int samplerate) = 0; // must be called before any other methods 48 virtual void initialise(int samplerate) = 0; // must be called before any other methods
49 virtual int getWindowsize() = 0; // required window size for calls to extractFeatures() 49 virtual int getWindowsize() = 0; // required window size for calls to extractFeatures()
50 virtual int getHopsize() = 0; // required hop size for calls to extractFeatures() 50 virtual int getHopsize() = 0; // required hop size for calls to extractFeatures()
51 virtual void extractFeatures(const double* samples, int nsamples) = 0; 51 virtual void extractFeatures(const double* samples, int nsamples) = 0;
52 virtual void segment() = 0; // call once all the features have been extracted 52 virtual void segment() = 0; // call once all the features have been extracted
53 virtual void segment(int m) = 0; // specify desired number of segment-types 53 virtual void segment(int m) = 0; // specify desired number of segment-types
54 virtual void clear() { features.clear(); } 54 virtual void clear() { features.clear(); }
55 const Segmentation& getSegmentation() const { return segmentation; } 55 const Segmentation& getSegmentation() const { return segmentation; }
56 protected: 56 protected:
57 vector<vector<double> > features; 57 vector<vector<double> > features;
58 Segmentation segmentation; 58 Segmentation segmentation;
59 int samplerate; 59 int samplerate;
60 }; 60 };
61 61
62 #endif 62 #endif