vequalizer.h
Go to the documentation of this file.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
00048 class VBandsInterface
00049 {
00050 friend class VBand;
00051
00052 public:
00053 VBandsInterface();
00054 virtual ~VBandsInterface();
00055
00056 virtual int bands() const=0;
00057 virtual VBand band(int num)=0;
00061 VBand operator [] (int num);
00062
00063 private:
00064 virtual int level(int index) const=0;
00065 virtual void setLevel(int index, int level)=0;
00066 };
00067
00068
00069 class VInterpolation;
00070 class VEqualizer;
00071
00076 class VBand
00077 {
00078 friend class VInterpolation;
00079 friend class VEqualizer;
00080
00081 struct Private;
00082 VBand::Private *d;
00083
00084 private:
00085 VBand(VBandsInterface *bands, int index, int start, int end);
00086
00087 public:
00088 ~VBand();
00089
00090 VBand(const VBand ©);
00091 VBand & operator =(const VBand ©);
00092
00100 int level() const;
00101 void setLevel(int l);
00102
00103 int start() const;
00104 int end() const;
00105
00109 int center() const;
00110
00111 QString formatStart(bool withHz=true) const;
00112 QString formatEnd(bool withHz=true) const;
00116 QString format(bool withHz=true) const;
00117 };
00118
00119
00135 class VInterpolation : public QObject, public VBandsInterface
00136 {
00137 Q_OBJECT
00138 struct Private;
00139 Private *d;
00140 friend class VBand;
00141
00142 public:
00147 VInterpolation(int bands);
00148 virtual ~VInterpolation();
00149
00150 virtual int bands() const;
00151 virtual VBand band(int num);
00152 virtual int level(int index) const;
00153 virtual void setLevel(int index, int level);
00154
00155 signals:
00156 void changed();
00157
00158 private:
00159 void refresh();
00160 void getFrequencies(int num, int *high, int *low) const;
00165 double onSpline(int bandNum) const;
00166 };
00167
00168 class VPreset;
00169
00174 class VEqualizer : public QObject, public VBandsInterface
00175 {
00176 Q_OBJECT
00177 friend class VBand;
00178 friend class VPreset;
00179 friend class Engine;
00180 friend class NoatunApp;
00181 friend class VInterpolation;
00182
00183 struct Private;
00184 Private *d;
00185
00186 VEqualizer();
00187 ~VEqualizer();
00188 void init();
00189
00190 public:
00191
00198 static QValueList<int> frequencies(int num);
00199
00205 int bands() const;
00206
00212 static int start();
00216 static int end();
00217
00221 int maxBands() const;
00222
00226 int minBands() const;
00227
00228 VBand band(int num);
00229
00230 bool isEnabled() const;
00231
00235 int preamp() const;
00236
00237 public:
00244 bool save(const KURL &file, const QString &friendly) const;
00245
00249 bool load(const KURL &file);
00250
00257 QString toString(const QString &name="stored") const;
00258
00264 bool fromString(const QString &str);
00265
00266 public:
00275 VPreset createPreset(const QString &name, bool smart=true);
00276
00281 QValueList<VPreset> presets() const;
00282
00287 VPreset presetByName(const QString &name);
00288
00293 VPreset presetByFile(const QString &file);
00294
00299 bool presetExists(const QString &name) const;
00300
00301 signals:
00306 void changedBands();
00307
00312 void changed();
00318 void modified();
00319
00320 void preampChanged();
00321 void preampChanged(int);
00322
00323 void enabled();
00324 void disabled();
00325
00326 void enabled(bool e);
00327
00331 void created(VPreset preset);
00332
00337 void selected(VPreset preset);
00338
00342 void renamed(VPreset preset);
00343
00347 void removed(VPreset preset);
00348 public slots:
00356 void setPreamp(int p);
00360 void enable();
00364 void disable();
00368 void setEnabled(bool e);
00369 void setBands(int bands);
00370 void setBands(int bands, bool interpolate);
00371
00372 private:
00373 virtual int level(int index) const;
00374 virtual void setLevel(int index, int level);
00375 void setLevels(const QValueList<int> &levels);
00376
00377 private:
00384 void update(bool full=false);
00385 };
00386
00398 class VPreset
00399 {
00400 friend class VEqualizer;
00401
00402 struct Private;
00403 Private *d;
00404
00405 void *_bc;
00406 VPreset(const QString &file);
00407 public:
00408 VPreset();
00409 VPreset(const VPreset ©);
00410 VPreset & operator=(const VPreset ©);
00411 ~VPreset();
00412 bool operator ==(const VPreset &other) const;
00413
00417 QString name() const;
00426 bool setName(const QString &name);
00427
00431 QString file() const;
00432
00433 bool isValid() const;
00434 bool isNull() const { return !isValid(); }
00435 operator bool() const { return isValid(); }
00436
00440 void save();
00441
00445 void load() const;
00446
00450 void remove();
00451 };
00452
00453
00454
00455 #endif
00456
This file is part of the documentation for Noatun 2.6.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 22 00:20:36 2004 by
doxygen 1.3.8-20040913 written by
Dimitri van Heesch, © 1997-2003