Chris@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@7: /* Chris@7: Permission is hereby granted, free of charge, to any person Chris@7: obtaining a copy of this software and associated documentation Chris@7: files (the "Software"), to deal in the Software without Chris@7: restriction, including without limitation the rights to use, copy, Chris@7: modify, merge, publish, distribute, sublicense, and/or sell copies Chris@7: of the Software, and to permit persons to whom the Software is Chris@7: furnished to do so, subject to the following conditions: Chris@7: Chris@7: The above copyright notice and this permission notice shall be Chris@7: included in all copies or substantial portions of the Software. Chris@7: Chris@7: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Chris@7: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Chris@7: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND Chris@7: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR Chris@7: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF Chris@7: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION Chris@7: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Chris@7: */ Chris@0: Chris@0: #ifndef _SIMPLE_CEPSTRUM_H_ Chris@0: #define _SIMPLE_CEPSTRUM_H_ Chris@0: Chris@0: #include Chris@0: Chris@0: class SimpleCepstrum : public Vamp::Plugin Chris@0: { Chris@0: public: Chris@0: SimpleCepstrum(float inputSampleRate); Chris@0: virtual ~SimpleCepstrum(); Chris@0: Chris@0: std::string getIdentifier() const; Chris@0: std::string getName() const; Chris@0: std::string getDescription() const; Chris@0: std::string getMaker() const; Chris@0: int getPluginVersion() const; Chris@0: std::string getCopyright() const; Chris@0: Chris@0: InputDomain getInputDomain() const; Chris@0: size_t getPreferredBlockSize() const; Chris@0: size_t getPreferredStepSize() const; Chris@0: size_t getMinChannelCount() const; Chris@0: size_t getMaxChannelCount() const; Chris@0: Chris@0: ParameterList getParameterDescriptors() const; Chris@0: float getParameter(std::string identifier) const; Chris@0: void setParameter(std::string identifier, float value); Chris@0: Chris@0: ProgramList getPrograms() const; Chris@0: std::string getCurrentProgram() const; Chris@0: void selectProgram(std::string name); Chris@0: Chris@0: OutputList getOutputDescriptors() const; Chris@0: Chris@0: bool initialise(size_t channels, size_t stepSize, size_t blockSize); Chris@0: void reset(); Chris@0: Chris@0: FeatureSet process(const float *const *inputBuffers, Chris@0: Vamp::RealTime timestamp); Chris@0: Chris@0: FeatureSet getRemainingFeatures(); Chris@0: Chris@0: protected: Chris@0: size_t m_channels; Chris@0: size_t m_stepSize; Chris@0: size_t m_blockSize; Chris@0: float m_fmin; Chris@0: float m_fmax; Chris@5: int m_histlen; Chris@10: int m_vflen; Chris@0: bool m_clamp; Chris@0: Chris@3: enum Method { Chris@3: InverseSymmetric, Chris@3: InverseAsymmetric, Chris@4: InverseComplex, Chris@3: ForwardMagnitude, Chris@3: ForwardDifference Chris@3: }; Chris@3: Chris@3: Method m_method; Chris@3: Chris@5: mutable int m_pkOutput; Chris@0: mutable int m_varOutput; Chris@5: mutable int m_p2rOutput; Chris@0: mutable int m_cepOutput; Chris@0: mutable int m_pvOutput; Chris@0: mutable int m_amOutput; Chris@2: mutable int m_envOutput; Chris@2: mutable int m_esOutput; Chris@6: mutable int m_ppOutput; Chris@6: mutable int m_totOutput; Chris@20: mutable int m_pkoOutput; Chris@0: Chris@5: int m_binFrom; Chris@5: int m_binTo; Chris@5: int m_bins; // count of "interesting" bins, those returned in m_cepOutput Chris@5: Chris@5: double **m_history; Chris@5: Chris@5: void filter(const double *in, double *out); Chris@0: void fft(unsigned int n, bool inverse, Chris@0: double *ri, double *ii, double *ro, double *io); Chris@5: Chris@5: void addStatisticalOutputs(FeatureSet &fs, const double *data); Chris@5: void addEnvelopeOutputs(FeatureSet &fs, const float *const *inputBuffers, Chris@5: const double *raw); Chris@0: }; Chris@0: Chris@0: #endif