DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/mt32/DelayReverb.h
00001 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
00002  * Copyright (C) 2011, 2012, 2013 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
00003  *
00004  *  This program is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 2.1 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef MT32EMU_DELAYREVERB_H
00019 #define MT32EMU_DELAYREVERB_H
00020 
00021 namespace MT32Emu {
00022 
00023 class DelayReverb : public ReverbModel {
00024 private:
00025         Bit8u time;
00026         Bit8u level;
00027 
00028         Bit32u bufIx;
00029         float *buf;
00030 
00031         Bit32u delayLeft;
00032         Bit32u delayRight;
00033         Bit32u delayFeedback;
00034 
00035         float amp;
00036         float feedback;
00037 
00038         void recalcParameters();
00039 
00040 public:
00041         DelayReverb();
00042         ~DelayReverb();
00043         void open();
00044         void close();
00045         void setParameters(Bit8u newTime, Bit8u newLevel);
00046         void process(const float *inLeft, const float *inRight, float *outLeft, float *outRight, unsigned long numSamples);
00047         bool isActive() const;
00048 
00049         void saveState( std::ostream &stream );
00050         void loadState( std::istream &stream );
00051 };
00052 }
00053 #endif