vequalizer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef NOATUN_VEQUALIZER_H
00040 #define NOATUN_VEQUALIZER_H
00041
00042 #include <qptrlist.h>
00043 #include <qobject.h>
00044 #include <kurl.h>
00045
00046 class VBand;
00047
00051 class VBandsInterface
00052 {
00053 friend class VBand;
00054
00055 public:
00056 VBandsInterface();
00057 virtual ~VBandsInterface();
00058
00059 virtual int bands() const=0;
00060 virtual VBand band(int num)=0;
00064 VBand operator [] (int num);
00065
00066 private:
00067 virtual int level(int index) const=0;
00068 virtual void setLevel(int index, int level)=0;
00069 };
00070
00071
00072 class VInterpolation;
00073 class VEqualizer;
00074
00079 class VBand
00080 {
00081 friend class VInterpolation;
00082 friend class VEqualizer;
00083
00084 struct Private;
00085 VBand::Private *d;
00086
00087 private:
00088 VBand(VBandsInterface *bands, int index, int start, int end);
00089
00090 public:
00091 ~VBand();
00092
00093 VBand(const VBand ©);
00094 VBand & operator =(const VBand ©);
00095
00103 int level() const;
00104 void setLevel(int l);
00105
00106 int start() const;
00107 int end() const;
00108
00112 int center() const;
00113
00114 QString formatStart(bool withHz=true) const;
00115 QString formatEnd(bool withHz=true) const;
00119 QString format(bool withHz=true) const;
00120 };
00121
00122
00137 class VInterpolation : public QObject, public VBandsInterface
00138 {
00139 Q_OBJECT
00140 struct Private;
00141 Private *d;
00142 friend class VBand;
00143
00144 public:
00149 VInterpolation(int bands);
00150 virtual ~VInterpolation();
00151
00152 virtual int bands() const;
00153 virtual VBand band(int num);
00154 virtual int level(int index) const;
00155 virtual void setLevel(int index, int level);
00156
00157 signals:
00158 void changed();
00159
00160 private:
00161 void refresh();
00162 void getFrequencies(int num, int *high, int *low) const;
00167 double onSpline(int bandNum) const;
00168 };
00169
00170 class VPreset;
00171
00176 class VEqualizer : public QObject, public VBandsInterface
00177 {
00178 Q_OBJECT
00179 friend class VBand;
00180 friend class VPreset;
00181 friend class Engine;
00182 friend class NoatunApp;
00183 friend class VInterpolation;
00184
00185 struct Private;
00186 Private *d;
00187
00188 VEqualizer();
00189 ~VEqualizer();
00190 void init();
00191
00192 public:
00193
00200 static QValueList<int> frequencies(int num);
00201
00207 int bands() const;
00208
00214 static int start();
00218 static int end();
00219
00223 int maxBands() const;
00224
00228 int minBands() const;
00229
00230 VBand band(int num);
00231
00232 bool isEnabled() const;
00233
00237 int preamp() const;
00238
00239 public:
00246 bool save(const KURL &file, const QString &friendly) const;
00247
00251 bool load(const KURL &file);
00252
00259 QString toString(const QString &name="stored") const;
00260
00266 bool fromString(const QString &str);
00267
00268 public:
00277 VPreset createPreset(const QString &name, bool smart=true);
00278
00283 QValueList<VPreset> presets() const;
00284
00289 VPreset presetByName(const QString &name);
00290
00295 VPreset presetByFile(const QString &file);
00296
00301 bool presetExists(const QString &name) const;
00302
00303 signals:
00308 void changedBands();
00309
00314 void changed();
00320 void modified();
00321
00322 void preampChanged();
00323 void preampChanged(int);
00324
00325 void enabled();
00326 void disabled();
00327
00328 void enabled(bool e);
00329
00333 void created(VPreset preset);
00334
00339 void selected(VPreset preset);
00340
00344 void renamed(VPreset preset);
00345
00349 void removed(VPreset preset);
00350 public slots:
00358 void setPreamp(int p);
00362 void enable();
00366 void disable();
00370 void setEnabled(bool e);
00371 void setBands(int bands);
00372 void setBands(int bands, bool interpolate);
00373
00374 private:
00375 virtual int level(int index) const;
00376 virtual void setLevel(int index, int level);
00377 void setLevels(const QValueList<int> &levels);
00378
00379 private:
00386 void update(bool full=false);
00387 };
00388
00400 class VPreset
00401 {
00402 friend class VEqualizer;
00403
00404 struct Private;
00405 Private *d;
00406
00407 void *_bc;
00408 VPreset(const QString &file);
00409 public:
00410 VPreset();
00411 VPreset(const VPreset ©);
00412 VPreset & operator=(const VPreset ©);
00413 ~VPreset();
00414 bool operator ==(const VPreset &other) const;
00415
00419 QString name() const;
00428 bool setName(const QString &name);
00429
00433 QString file() const;
00434
00435 bool isValid() const;
00436 bool isNull() const { return !isValid(); }
00437 operator bool() const { return isValid(); }
00438
00442 void save();
00443
00447 void load() const;
00448
00452 void remove();
00453 };
00454
00455 #endif
This file is part of the documentation for Noatun 2.6.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 23:49:45 2004 by
doxygen 1.3.8-20040913 written by
Dimitri van Heesch, © 1997-2003