Mercurial > hg > btrack
comparison src/OnsetDetectionFunction.h @ 92:f6708e4c69f1
More code style updates
author | Adam Stark <adamstark.uk@gmail.com> |
---|---|
date | Wed, 11 May 2016 00:19:06 +0100 |
parents | b387d8327729 |
children | 4aa362058011 |
comparison
equal
deleted
inserted
replaced
91:a88d887bd281 | 92:f6708e4c69f1 |
---|---|
61 /** Constructor that defaults the onset detection function type to ComplexSpectralDifferenceHWR | 61 /** Constructor that defaults the onset detection function type to ComplexSpectralDifferenceHWR |
62 * and the window type to HanningWindow | 62 * and the window type to HanningWindow |
63 * @param hopSize_ the hop size in audio samples | 63 * @param hopSize_ the hop size in audio samples |
64 * @param frameSize_ the frame size in audio samples | 64 * @param frameSize_ the frame size in audio samples |
65 */ | 65 */ |
66 OnsetDetectionFunction(int hopSize_,int frameSize_); | 66 OnsetDetectionFunction (int hopSize_, int frameSize_); |
67 | 67 |
68 | 68 |
69 /** Constructor | 69 /** Constructor |
70 * @param hopSize_ the hop size in audio samples | 70 * @param hopSize_ the hop size in audio samples |
71 * @param frameSize_ the frame size in audio samples | 71 * @param frameSize_ the frame size in audio samples |
72 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 72 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
73 * @param windowType the type of window to use (see WindowType) | 73 * @param windowType the type of window to use (see WindowType) |
74 */ | 74 */ |
75 OnsetDetectionFunction(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType_); | 75 OnsetDetectionFunction (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); |
76 | 76 |
77 /** Destructor */ | 77 /** Destructor */ |
78 ~OnsetDetectionFunction(); | 78 ~OnsetDetectionFunction(); |
79 | 79 |
80 /** Initialisation function for only updating hop size and frame size (and not window type | 80 /** Initialisation function for only updating hop size and frame size (and not window type |
81 * or onset detection function type | 81 * or onset detection function type |
82 * @param hopSize_ the hop size in audio samples | 82 * @param hopSize_ the hop size in audio samples |
83 * @param frameSize_ the frame size in audio samples | 83 * @param frameSize_ the frame size in audio samples |
84 */ | 84 */ |
85 void initialise(int hopSize_,int frameSize_); | 85 void initialise (int hopSize_, int frameSize_); |
86 | 86 |
87 /** Initialisation Function | 87 /** Initialisation Function |
88 * @param hopSize_ the hop size in audio samples | 88 * @param hopSize_ the hop size in audio samples |
89 * @param frameSize_ the frame size in audio samples | 89 * @param frameSize_ the frame size in audio samples |
90 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 90 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
91 * @param windowType the type of window to use (see WindowType) | 91 * @param windowType the type of window to use (see WindowType) |
92 */ | 92 */ |
93 void initialise(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType_); | 93 void initialise (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); |
94 | 94 |
95 /** Process input frame and calculate detection function sample | 95 /** Process input frame and calculate detection function sample |
96 * @param buffer a pointer to an array containing the audio samples to be processed | 96 * @param buffer a pointer to an array containing the audio samples to be processed |
97 * @returns the onset detection function sample | 97 * @returns the onset detection function sample |
98 */ | 98 */ |
99 double calculateOnsetDetectionFunctionSample(double *buffer); | 99 double calculateOnsetDetectionFunctionSample (double* buffer); |
100 | 100 |
101 /** Set the detection function type | 101 /** Set the detection function type |
102 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 102 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
103 */ | 103 */ |
104 void setOnsetDetectionFunctionType(int onsetDetectionFunctionType_); | 104 void setOnsetDetectionFunctionType (int onsetDetectionFunctionType_); |
105 | 105 |
106 private: | 106 private: |
107 | 107 |
108 /** Perform the FFT on the data in 'frame' */ | 108 /** Perform the FFT on the data in 'frame' */ |
109 void performFFT(); | 109 void performFFT(); |
169 int hopSize; /**< audio hopsize */ | 169 int hopSize; /**< audio hopsize */ |
170 int onsetDetectionFunctionType; /**< type of detection function */ | 170 int onsetDetectionFunctionType; /**< type of detection function */ |
171 int windowType; /**< type of window used in calculations */ | 171 int windowType; /**< type of window used in calculations */ |
172 | 172 |
173 fftw_plan p; /**< fftw plan */ | 173 fftw_plan p; /**< fftw plan */ |
174 fftw_complex *complexIn; /**< to hold complex fft values for input */ | 174 fftw_complex* complexIn; /**< to hold complex fft values for input */ |
175 fftw_complex *complexOut; /**< to hold complex fft values for output */ | 175 fftw_complex* complexOut; /**< to hold complex fft values for output */ |
176 | 176 |
177 bool initialised; /**< flag indicating whether buffers and FFT plans are initialised */ | 177 bool initialised; /**< flag indicating whether buffers and FFT plans are initialised */ |
178 | 178 |
179 std::vector<double> frame; /**< audio frame */ | 179 std::vector<double> frame; /**< audio frame */ |
180 std::vector<double> window; /**< window */ | 180 std::vector<double> window; /**< window */ |