00001 /*************************************************************************** 00002 * Copyright (C) 2007-2009 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef EFFECT_H 00021 #define EFFECT_H 00022 00023 #include <QList> 00024 #include <QStringList> 00025 #include <QHash> 00026 #include "audioparameters.h" 00027 #include "buffer.h" 00028 00029 class EffectFactory; 00030 00034 class Effect 00035 { 00036 public: 00040 Effect(); 00044 virtual ~Effect(); 00049 virtual void applyEffect(Buffer *b) = 0; 00057 virtual void configure(quint32 srate = 44100, int chan = 2, Qmmp::AudioFormat f = Qmmp::PCM_S16LE); 00061 quint32 sampleRate(); 00065 int channels(); 00069 Qmmp::AudioFormat format(); 00073 const AudioParameters audioParameters() const; 00077 EffectFactory* factory() const; 00082 static Effect* create(EffectFactory *factory); 00086 static QList<EffectFactory*> *factories(); 00091 static QString file(EffectFactory *factory); 00097 static void setEnabled(EffectFactory* factory, bool enable = true); 00102 static bool isEnabled(EffectFactory* factory); 00103 00104 private: 00105 EffectFactory *m_factory; 00106 quint32 m_freq; 00107 int m_chan; 00108 Qmmp::AudioFormat m_format; 00109 static void checkFactories(); 00110 static QList<EffectFactory*> *m_factories; 00111 static QHash <EffectFactory*, QString> *m_files; 00112 }; 00113 00114 #endif