Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

equalizer.h

Go to the documentation of this file.
00001 #ifndef NOATUN_EQUALIZER_H
00002 #define NOATUN_EQUALIZER_H
00003 
00004 #include <qptrlist.h>
00005 #include <qobject.h>
00006 #include <kurl.h>
00007 
00008 namespace Arts { class StereoEffect; }
00009 class Engine;
00010 class Equalizer;
00011 
00012 class Preset
00013 {
00014 friend class Equalizer;
00015         Preset(const QString &file);
00016         Preset();
00017 public:
00018         QString name() const;
00019         bool setName(const QString &name);
00020         bool save() const;
00021         bool load();
00022 
00023         void remove();
00024 
00025         QString file() const;
00026 private:
00027         QString mFile;
00028 };
00029 
00030 class Band
00031 {
00032 friend class Equalizer;
00033 friend class QPtrList<Band>;
00034 
00035 private:
00036         Band();
00037         Band(int start, int end);
00038         virtual ~Band();
00039 public:
00047         int level();
00048         void setLevel(int l);
00049         
00050         int start() const;
00051         int end() const;
00052 
00056         int center() const;
00057 
00058         QString formatStart(bool withHz=true) const;
00059         QString formatEnd(bool withHz=true) const;
00063         QString format(bool withHz=true) const;
00064         
00065 private:
00066         int mLevel;
00067         int mStart, mEnd;
00068 };
00069 
00070 class Equalizer : public QObject
00071 {
00072 friend class Band;
00073 friend class Preset;
00074 friend class Engine;
00075 Q_OBJECT
00076 public:
00077         Equalizer();
00078         ~Equalizer();
00079         
00080         const QPtrList<Band> &bands() const;
00081         Band *band(int num) const;
00082         int bandCount() const;
00083 
00084         int preamp() const;
00085         bool isEnabled() const;
00086         
00087         void init();
00088 
00089 public slots:
00097         void setPreamp(int p);
00098         void enable();
00099         void disable();
00100         void setEnabled(bool e);
00101 
00102 
00103 public:
00104 // saving eq stuff
00111         bool save(const KURL &file, const QString &friendly) const;
00112 
00116         bool load(const KURL &file);
00117 
00124         QString toString(const QString &name="stored") const;
00125 
00131         bool fromString(const QString &str);
00132 
00141         Preset *createPreset(const QString &name, bool smart=true);
00142 
00147         QPtrList<Preset> presets() const;
00148         
00149         Preset *preset(const QString &file);
00150         bool presetExists(const QString &name) const;
00151                 
00152 signals:
00153         void changed(Band *band);
00154         void changed();
00155         void enabled();
00156         void disabled();
00157         void enabled(bool e);
00158 
00159         void preampChanged(int p);
00160         void preampChanged();
00161 
00166         void changed(Preset *);
00167 
00171         void created(Preset*);
00172 
00176         void renamed(Preset *);
00177 
00181         void removed(Preset *);
00182         
00183 private:
00184         void add(Band*);
00185         void remove(Band*);
00186         // apply the data to artsd
00187         void enableUpdates(bool on=true);
00188         void update(bool full=false);
00189         
00190 private:
00191         QPtrList<Band> mBands;
00192         bool mUpdates;
00193         int mPreamp;
00194 };
00195 
00196 
00197 
00198 #endif
00199 

Generated on Sat May 24 15:10:27 2003 for Noatun by doxygen1.3-rc3