comparison src/ConstantQ.cpp @ 145:ff8ae033615f

No reason getBinFrequency shouldn't work for non-integer bin numbers too
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 22 May 2014 16:58:59 +0100
parents 9bdabd830609
children 1060a19e2334
comparison
equal deleted inserted replaced
144:88b8d34bfc77 145:ff8ae033615f
76 { 76 {
77 return m_p.minFrequency / pow(2.0, m_octaves - 1); 77 return m_p.minFrequency / pow(2.0, m_octaves - 1);
78 } 78 }
79 79
80 double 80 double
81 ConstantQ::getBinFrequency(int bin) const 81 ConstantQ::getBinFrequency(double bin) const
82 { 82 {
83 // our bins are returned in high->low order 83 // our bins are returned in high->low order
84 bin = (getBinsPerOctave() * getOctaves()) - bin - 1; 84 bin = (getBinsPerOctave() * getOctaves()) - bin - 1;
85 return getMinFrequency() * pow(2, (double(bin) / getBinsPerOctave())); 85 return getMinFrequency() * pow(2, (bin / getBinsPerOctave()));
86 } 86 }
87 87
88 void 88 void
89 ConstantQ::initialise() 89 ConstantQ::initialise()
90 { 90 {