comparison src/OnsetDetectionFunction.cpp @ 100:6aea5918992d

More code style updates
author Adam Stark <adamstark.uk@gmail.com>
date Sun, 13 Aug 2017 11:00:31 +0100
parents 4aa362058011
children 54c657d621dd
comparison
equal deleted inserted replaced
99:b91eb3b6de86 100:6aea5918992d
179 double OnsetDetectionFunction::calculateOnsetDetectionFunctionSample (double* buffer) 179 double OnsetDetectionFunction::calculateOnsetDetectionFunctionSample (double* buffer)
180 { 180 {
181 double odfSample; 181 double odfSample;
182 182
183 // shift audio samples back in frame by hop size 183 // shift audio samples back in frame by hop size
184 for (int i = 0; i < (frameSize-hopSize);i++) 184 std::rotate (frame.begin(), frame.begin() + hopSize, frame.end());
185 {
186 frame[i] = frame[i+hopSize];
187 }
188 185
189 // add new samples to frame from input buffer 186 // add new samples to frame from input buffer
190 int j = 0; 187 int j = 0;
191 for (int i = (frameSize-hopSize);i < frameSize;i++) 188 for (int i = (frameSize - hopSize); i < frameSize; i++)
192 { 189 {
193 frame[i] = buffer[j]; 190 frame[i] = buffer[j];
194 j++; 191 j++;
195 } 192 }
196 193