annotate dsp/segmentation/Segmenter.h @ 209:ccd2019190bf msvc

Some MSVC fixes, including (temporarily, probably) renaming the FFT source file to avoid getting it mixed up with the Vamp SDK one in our object dir
author Chris Cannam
date Thu, 01 Feb 2018 16:34:08 +0000
parents e5907ae6de17
children 175e51ae78eb
rev   line source
cannam@18 1 #ifndef _SEGMENTER_H
cannam@18 2 #define _SEGMENTER_H
cannam@18 3
cannam@18 4 /*
cannam@18 5 * Segmenter.h
cannam@18 6 * soundbite
cannam@18 7 *
cannam@18 8 * Created by Mark Levy on 23/03/2006.
Chris@84 9 * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
Chris@84 10
Chris@84 11 This program is free software; you can redistribute it and/or
Chris@84 12 modify it under the terms of the GNU General Public License as
Chris@84 13 published by the Free Software Foundation; either version 2 of the
Chris@84 14 License, or (at your option) any later version. See the file
Chris@84 15 COPYING included with this distribution for more information.
cannam@18 16 *
cannam@18 17 */
cannam@18 18
cannam@18 19 #include <vector>
cannam@18 20 #include <iostream>
cannam@18 21
cannam@18 22 using std::vector;
cannam@18 23 using std::ostream;
cannam@18 24
cannam@18 25 class Segment
cannam@18 26 {
cannam@18 27 public:
cannam@18 28 int start; // in samples
cannam@18 29 int end;
cannam@18 30 int type;
cannam@18 31 };
cannam@18 32
cannam@18 33 class Segmentation
cannam@18 34 {
cannam@18 35 public:
cannam@18 36 int nsegtypes; // number of segment types, so possible types are {0,1,...,nsegtypes-1}
cannam@18 37 int samplerate;
cannam@18 38 vector<Segment> segments;
cannam@18 39 };
cannam@18 40
cannam@18 41 ostream& operator<<(ostream& os, const Segmentation& s);
cannam@18 42
cannam@18 43 class Segmenter
cannam@18 44 {
cannam@18 45 public:
cannam@18 46 Segmenter() {}
cannam@18 47 virtual ~Segmenter() {}
cannam@18 48 virtual void initialise(int samplerate) = 0; // must be called before any other methods
cannam@18 49 virtual int getWindowsize() = 0; // required window size for calls to extractFeatures()
cannam@18 50 virtual int getHopsize() = 0; // required hop size for calls to extractFeatures()
cannam@24 51 virtual void extractFeatures(const double* samples, int nsamples) = 0;
cannam@18 52 virtual void segment() = 0; // call once all the features have been extracted
cannam@18 53 virtual void segment(int m) = 0; // specify desired number of segment-types
cannam@18 54 virtual void clear() { features.clear(); }
cannam@18 55 const Segmentation& getSegmentation() const { return segmentation; }
cannam@18 56 protected:
cannam@18 57 vector<vector<double> > features;
cannam@18 58 Segmentation segmentation;
cannam@18 59 int samplerate;
cannam@18 60 };
cannam@18 61
cannam@18 62 #endif