// ampanlzr.h
/*
    An amplitude analyzer class for the Vocoder
    Copyright (C) 2002 Jarno Wuolijoki and Pilvari Pirtola
    Partially based on bwlowpas.cc Copyright (C) 1994-1998 Kai Lassfolk

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef _SPKIT_AMPLITUDEANALYZER_H_
#define _SPKIT_AMPLITUDEANALYZER_H_

#include <spkit/processo.h>



class SPKitAmplitudeAnalyzer : public SPKitProcessor {
public:
    SPKitAmplitudeAnalyzer();
    SPKitError setInput(SPKitProcessor *);
    void setCutOffFreq(SPKitFloat val);
    int getSample(SPKitSample &outputSample, SPKitProcessor *caller);
protected:
    void convertSample(SPKitSample &smp);
    SPKitFloat cutOff;
    int index, indmax;
    SPKitFloat km2, km1, k0, k1, k2;
    SPKitFloat *buf_a, *buf_b, *buf_c, *buf_d, *buf_e;
};
class SPKitAmplitudeNormalizer : public SPKitAmplitudeAnalyzer {
public:
    int getSample(SPKitSample &outputSample, SPKitProcessor *caller);
};

#endif
