Mercurial > hg > constant-q-cpp
changeset 125:b3f72e67e543
Ah, CQKernel does need to be public (it's included by other public headers)
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 15 May 2014 15:24:56 +0100 |
parents | fcf7e33aa56b |
children | b87290781071 |
files | Makefile.inc cq/CQKernel.h src/CQKernel.h |
diffstat | 3 files changed, 113 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.inc Thu May 15 14:47:19 2014 +0100 +++ b/Makefile.inc Thu May 15 15:24:56 2014 +0100 @@ -28,7 +28,7 @@ LIB_HEADERS := \ $(INC_DIR)/CQBase.h \ - $(LIB_DIR)/CQKernel.h \ + $(INC_DIR)/CQKernel.h \ $(INC_DIR)/ConstantQ.h \ $(INC_DIR)/CQSpectrogram.h \ $(INC_DIR)/CQInverse.h \ @@ -107,15 +107,36 @@ # DO NOT DELETE -src/CQKernel.o: src/CQKernel.h src/dsp/MathUtilities.h src/dsp/nan-inf.h -src/CQKernel.o: src/dsp/FFT.h src/dsp/Window.h -src/ConstantQ.o: src/CQKernel.h src/dsp/Resampler.h src/dsp/MathUtilities.h +src/CQKernel.o: src/dsp/MathUtilities.h src/dsp/nan-inf.h src/dsp/FFT.h +src/CQKernel.o: src/dsp/Window.h +src/ConstantQ.o: src/dsp/Resampler.h src/dsp/MathUtilities.h src/ConstantQ.o: src/dsp/nan-inf.h src/dsp/FFT.h src/CQInverse.o: src/dsp/Resampler.h src/dsp/MathUtilities.h src/CQInverse.o: src/dsp/nan-inf.h src/dsp/FFT.h -vamp/CQVamp.o: vamp/CQVamp.h -vamp/CQChromaVamp.o: vamp/CQChromaVamp.h -vamp/libmain.o: vamp/CQVamp.h vamp/CQChromaVamp.h -cq/ConstantQ.o: cq/CQBase.h src/CQKernel.h -cq/CQSpectrogram.o: cq/ConstantQ.h cq/CQBase.h src/CQKernel.h -cq/CQInverse.o: cq/CQBase.h src/CQKernel.h +src/dsp/FFT.o: src/dsp/FFT.h src/dsp/MathUtilities.h src/dsp/nan-inf.h +src/dsp/KaiserWindow.o: src/dsp/KaiserWindow.h src/dsp/MathUtilities.h +src/dsp/KaiserWindow.o: src/dsp/nan-inf.h +src/dsp/MathUtilities.o: src/dsp/MathUtilities.h src/dsp/nan-inf.h +src/dsp/Resampler.o: src/dsp/Resampler.h src/dsp/MathUtilities.h +src/dsp/Resampler.o: src/dsp/nan-inf.h src/dsp/KaiserWindow.h +src/dsp/Resampler.o: src/dsp/SincWindow.h +src/dsp/SincWindow.o: src/dsp/SincWindow.h +src/ext/kissfft/kiss_fft.o: src/ext/kissfft/_kiss_fft_guts.h +src/ext/kissfft/kiss_fft.o: src/ext/kissfft/kiss_fft.h +src/ext/kissfft/tools/kiss_fftr.o: src/ext/kissfft/tools/kiss_fftr.h +src/ext/kissfft/tools/kiss_fftr.o: src/ext/kissfft/kiss_fft.h +src/ext/kissfft/tools/kiss_fftr.o: src/ext/kissfft/_kiss_fft_guts.h +vamp/CQVamp.o: vamp/CQVamp.h cq/CQSpectrogram.h cq/ConstantQ.h cq/CQBase.h +vamp/CQVamp.o: cq/CQKernel.h vamp/Pitch.h +vamp/CQChromaVamp.o: vamp/CQChromaVamp.h cq/CQSpectrogram.h cq/ConstantQ.h +vamp/CQChromaVamp.o: cq/CQBase.h cq/CQKernel.h vamp/Pitch.h +vamp/libmain.o: vamp/CQVamp.h cq/CQSpectrogram.h cq/ConstantQ.h cq/CQBase.h +vamp/libmain.o: cq/CQKernel.h vamp/CQChromaVamp.h +vamp/Pitch.o: vamp/Pitch.h +test/processfile.o: cq/ConstantQ.h cq/CQBase.h cq/CQKernel.h +cq/ConstantQ.o: cq/CQBase.h cq/CQKernel.h +cq/CQSpectrogram.o: cq/ConstantQ.h cq/CQBase.h cq/CQKernel.h +cq/CQInverse.o: cq/CQBase.h cq/CQKernel.h +src/dsp/MathUtilities.o: src/dsp/nan-inf.h +src/ext/kissfft/tools/kiss_fftr.o: src/ext/kissfft/kiss_fft.h +vamp/CQVamp.o: cq/CQSpectrogram.h cq/ConstantQ.h cq/CQBase.h cq/CQKernel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cq/CQKernel.h Thu May 15 15:24:56 2014 +0100 @@ -0,0 +1,82 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +/* + Constant-Q library + Copyright (c) 2013-2014 Queen Mary, University of London + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. +*/ + +#ifndef CQ_KERNEL_H +#define CQ_KERNEL_H + +#include <vector> +#include <complex> + +class FFT; + +class CQKernel +{ +public: + CQKernel(double sampleRate, double maxFreq, int binsPerOctave); + ~CQKernel(); + + struct Properties { + double sampleRate; + double maxFrequency; + double minFrequency; + int binsPerOctave; + int fftSize; + int fftHop; + int atomsPerFrame; + int atomSpacing; + int firstCentre; + int lastCentre; + double Q; + }; + + Properties getProperties() const { return m_p; } + + std::vector<std::complex<double> > processForward + (const std::vector<std::complex<double> > &); + + std::vector<std::complex<double> > processInverse + (const std::vector<std::complex<double> > &); + +private: + Properties m_p; + FFT *m_fft; + + struct KernelMatrix { + std::vector<int> origin; + std::vector<std::vector<std::complex<double> > > data; + }; + KernelMatrix m_kernel; + + void generateKernel(); + void finaliseKernel(); +}; + +#endif
--- a/src/CQKernel.h Thu May 15 14:47:19 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ -/* - Constant-Q library - Copyright (c) 2013-2014 Queen Mary, University of London - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the names of the Centre for - Digital Music; Queen Mary, University of London; and Chris Cannam - shall not be used in advertising or otherwise to promote the sale, - use or other dealings in this Software without prior written - authorization. -*/ - -#ifndef CQ_KERNEL_H -#define CQ_KERNEL_H - -#include <vector> -#include <complex> - -class FFT; - -class CQKernel -{ -public: - CQKernel(double sampleRate, double maxFreq, int binsPerOctave); - ~CQKernel(); - - struct Properties { - double sampleRate; - double maxFrequency; - double minFrequency; - int binsPerOctave; - int fftSize; - int fftHop; - int atomsPerFrame; - int atomSpacing; - int firstCentre; - int lastCentre; - double Q; - }; - - Properties getProperties() const { return m_p; } - - std::vector<std::complex<double> > processForward - (const std::vector<std::complex<double> > &); - - std::vector<std::complex<double> > processInverse - (const std::vector<std::complex<double> > &); - -private: - Properties m_p; - FFT *m_fft; - - struct KernelMatrix { - std::vector<int> origin; - std::vector<std::vector<std::complex<double> > > data; - }; - KernelMatrix m_kernel; - - void generateKernel(); - void finaliseKernel(); -}; - -#endif