//vocoder.h
/*
    Vocoder class for the Sound Processing Kit
    Copyright (C) 2002 Jarno Wuolijoki and Pilvari Pirtola

    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_VOCODER_H__
#define __SPKIT_VOCODER_H__
#include <spkit/processo.h>
#include <spkit/mult.h>
#include "fbank.h"
class SPKitVocoder : public SPKitProcessor {
public:
    int getFilterCount() { return filterCount; }
    SPKitError setInput(SPKitProcessor *input);
    SPKitError setModulatorInput(SPKitProcessor *modinput);
    SPKitError setFilters(SPKitFilterbank *modfb, SPKitFilterbank *carfb, SPKitJoiner *joiner);
    SPKitError setAnalyzers(SPKitProcessor **mod, SPKitProcessor **car);
    SPKitError setDefaultFilters(SPKitFloat lowfrq, SPKitFloat highfrq, int cnt);
    SPKitError setMatrix();
    int getSample(SPKitSample &outputSample, SPKitProcessor *caller);
    SPKitVocoder();
protected:
    SPKitFilterbank *modfb, *carfb;
    SPKitJoiner *joiner;
    SPKitProcessor **modaz, **caraz;
    SPKitMult **multipliers;
    SPKitProcessor *modinput, **modout, **carout, **modout2, **carout2;
    int filterCount;
};
#endif

