Mercurial > hg > qm-dsp
comparison dsp/tempotracking/DownBeat.cpp @ 162:a2b3fd07d862
Avoid pathological FFT length of 1 in plugin tester
author | Chris Cannam |
---|---|
date | Tue, 03 Dec 2013 10:16:49 +0000 |
parents | f6ccde089491 |
children | 7e52c034cf62 |
comparison
equal
deleted
inserted
replaced
161:fe7552b4f80a | 162:a2b3fd07d862 |
---|---|
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 } |