Mercurial > hg > btrack
changeset 111:8fb1610c9192
Code style updates
author | Adam Stark <adamstark.uk@gmail.com> |
---|---|
date | Thu, 17 Aug 2023 09:31:30 +0200 |
parents | 0fdaf082ad1a |
children | 33be76921da9 |
files | src/BTrack.cpp src/BTrack.h src/CircularBuffer.h src/OnsetDetectionFunction.h |
diffstat | 4 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/BTrack.cpp Sun Oct 31 23:34:44 2021 +0000 +++ b/src/BTrack.cpp Thu Aug 17 09:31:30 2023 +0200 @@ -36,7 +36,7 @@ //======================================================================= BTrack::BTrack (int hop) : odf (hop, 2 * hop, ComplexSpectralDifferenceHWR, HanningWindow) -{ +{ initialise (hop); } @@ -110,13 +110,14 @@ double x; // create tempo transition matrix m_sig = 41/8; - for (int i = 0;i < 41;i++) + + for (int i = 0; i < 41; i++) { - for (int j = 0;j < 41;j++) + for (int j = 0; j < 41; j++) { - x = j+1; - t_mu = i+1; - tempoTransitionMatrix[i][j] = (1 / (m_sig * sqrt (2 * M_PI))) * exp( (-1*pow((x-t_mu),2)) / (2*pow(m_sig,2)) ); + x = j + 1; + t_mu = i + 1; + tempoTransitionMatrix[i][j] = (1 / (m_sig * sqrt (2 * M_PI))) * exp((-1 * pow ((x - t_mu), 2)) / (2 * pow (m_sig, 2)) ); } } @@ -503,7 +504,7 @@ #ifdef USE_FFTW // copy into complex array and zero pad - for (int i = 0;i < FFTLengthForACFCalculation;i++) + for (int i = 0; i < FFTLengthForACFCalculation; i++) { if (i < onsetDetectionFunctionLength) { @@ -523,7 +524,7 @@ // multiply by complex conjugate for (int i = 0;i < FFTLengthForACFCalculation;i++) { - complexOut[i][0] = complexOut[i][0]*complexOut[i][0] + complexOut[i][1]*complexOut[i][1]; + complexOut[i][0] = complexOut[i][0] * complexOut[i][0] + complexOut[i][1] * complexOut[i][1]; complexOut[i][1] = 0.0; } @@ -534,7 +535,7 @@ #ifdef USE_KISS_FFT // copy into complex array and zero pad - for (int i = 0;i < FFTLengthForACFCalculation;i++) + for (int i = 0; i < FFTLengthForACFCalculation; i++) { if (i < onsetDetectionFunctionLength) { @@ -569,7 +570,7 @@ { #ifdef USE_FFTW // calculate absolute value of result - double absValue = sqrt (complexIn[i][0]*complexIn[i][0] + complexIn[i][1]*complexIn[i][1]); + double absValue = sqrt (complexIn[i][0] * complexIn[i][0] + complexIn[i][1] * complexIn[i][1]); #endif #ifdef USE_KISS_FFT
--- a/src/BTrack.h Sun Oct 31 23:34:44 2021 +0000 +++ b/src/BTrack.h Thu Aug 17 09:31:30 2023 +0200 @@ -59,7 +59,7 @@ * @param hopSize the hop size in audio samples * @param frameSize the frame size in audio samples */ - void updateHopAndFrameSize (int hopSize_, int frameSize_); + void updateHopAndFrameSize (int hopSize, int frameSize); //======================================================================= /** Process a single audio frame
--- a/src/CircularBuffer.h Sun Oct 31 23:34:44 2021 +0000 +++ b/src/CircularBuffer.h Thu Aug 17 09:31:30 2023 +0200 @@ -1,6 +1,6 @@ //======================================================================= /** @file CircularBuffer.h - * @brief A class for calculating onset detection functions + * @brief A circular buffer * @author Adam Stark * @copyright Copyright (C) 2008-2014 Queen Mary University of London *
--- a/src/OnsetDetectionFunction.h Sun Oct 31 23:34:44 2021 +0000 +++ b/src/OnsetDetectionFunction.h Thu Aug 17 09:31:30 2023 +0200 @@ -70,7 +70,7 @@ * @param hopSize_ the hop size in audio samples * @param frameSize_ the frame size in audio samples */ - OnsetDetectionFunction (int hopSize_, int frameSize_); + OnsetDetectionFunction (int hopSize, int frameSize); /** Constructor @@ -79,7 +79,7 @@ * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) * @param windowType the type of window to use (see WindowType) */ - OnsetDetectionFunction (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); + OnsetDetectionFunction (int hopSize, int frameSize, int onsetDetectionFunctionType, int windowType); /** Destructor */ ~OnsetDetectionFunction(); @@ -89,7 +89,7 @@ * @param hopSize_ the hop size in audio samples * @param frameSize_ the frame size in audio samples */ - void initialise (int hopSize_, int frameSize_); + void initialise (int hopSize, int frameSize); /** Initialisation Function * @param hopSize_ the hop size in audio samples @@ -97,7 +97,7 @@ * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) * @param windowType the type of window to use (see WindowType) */ - void initialise (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); + void initialise (int hopSize, int frameSize, int onsetDetectionFunctionType, int windowType); /** Process input frame and calculate detection function sample * @param buffer a pointer to an array containing the audio samples to be processed @@ -108,7 +108,7 @@ /** Set the detection function type * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) */ - void setOnsetDetectionFunctionType (int onsetDetectionFunctionType_); + void setOnsetDetectionFunctionType (int onsetDetectionFunctionType); private: @@ -207,8 +207,7 @@ std::vector<double> phase; /**< FFT phase values */ std::vector<double> prevPhase; /**< previous phase values */ std::vector<double> prevPhase2; /**< second order previous phase values */ - }; -#endif \ No newline at end of file +#endif