comparison dsp/tempotracking/DownBeat.cpp @ 387:00f66226db5b

Avoid pathological FFT length of 1 in plugin tester
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 03 Dec 2013 10:16:49 +0000
parents 9c8ee77db9de
children 7e52c034cf62
comparison
equal deleted inserted replaced
386:6acd63422d44 387:00f66226db5b
42 // beat frame size is next power of two up from 1.3 seconds at the 42 // beat frame size is next power of two up from 1.3 seconds at the
43 // downsampled rate (happens to produce 4096 for 44100 or 48000 at 43 // downsampled rate (happens to produce 4096 for 44100 or 48000 at
44 // 16x decimation, which is our expected normal situation) 44 // 16x decimation, which is our expected normal situation)
45 m_beatframesize = MathUtilities::nextPowerOfTwo 45 m_beatframesize = MathUtilities::nextPowerOfTwo
46 (int((m_rate / decimationFactor) * 1.3)); 46 (int((m_rate / decimationFactor) * 1.3));
47 // std::cerr << "rate = " << m_rate << ", bfs = " << m_beatframesize << std::endl; 47 if (m_beatframesize < 2) {
48 m_beatframesize = 2;
49 }
50 // std::cerr << "rate = " << m_rate << ", dec = " << decimationFactor << ", bfs = " << m_beatframesize << std::endl;
48 m_beatframe = new double[m_beatframesize]; 51 m_beatframe = new double[m_beatframesize];
49 m_fftRealOut = new double[m_beatframesize]; 52 m_fftRealOut = new double[m_beatframesize];
50 m_fftImagOut = new double[m_beatframesize]; 53 m_fftImagOut = new double[m_beatframesize];
51 m_fft = new FFTReal(m_beatframesize); 54 m_fft = new FFTReal(m_beatframesize);
52 } 55 }