Noatun API Documentation

plugin.h

00001 #ifndef NPLUGIN_H
00002 #define NPLUGIN_H
00003 
00004 #include <noatun/pluginloader.h>
00005 #include <qmemarray.h>
00006 #include <vector>
00007 
00008 
00009 namespace Noatun { class FFTScopeStereo; class FFTScope; class RawScope;
00010                    class RawScopeStereo; class StereoEffectStack;
00011                    class Listener;
00012                  }
00013 namespace Arts { class SoundServerV2; class Dispatcher; }
00014 
00015 //backwards compatibility
00016 
00017 #define NOATUNPLUGIND
00018 #define NOATUNPLUGINC(classname)  { }
00019 
00020 class Playlist;
00021 class Player;
00022 class ExitNotifier;
00023 class NoatunApp;
00027 class Plugin
00028 {
00029 public:
00030         Plugin();
00031         virtual ~Plugin();
00032 
00037         virtual void init();
00038 
00045         virtual bool unload();
00046 
00052         virtual Playlist *playlist() { return 0; }
00053 };
00054 
00061 class UserInterface : public Plugin
00062 {
00063 public:
00064         UserInterface();
00065         virtual ~UserInterface();
00066 };
00067 
00068 
00069 class TimerThingy;
00070 
00071 
00082 class Visualization
00083 {
00084 friend class TimerThingy;
00085 friend class ThingThatTellsAVisualizationThatNoatunIsGone;
00086 friend class ExitNotifier;
00087 friend class NoatunApp;
00088 public:
00098         Visualization(int interval=125, int pid=0);
00099         virtual ~Visualization();
00100 
00105         virtual void start();
00109         virtual void stop();
00110 
00114         int interval() const;
00115 
00121         virtual void setInterval(int msecs);
00122 
00126         virtual void timeout()=0;
00127 
00128         Noatun::StereoEffectStack visualizationStack();
00129         Arts::SoundServerV2 *server();
00130 
00140         static int noatunPid();
00141 
00145         bool connected();
00146 
00151         static void initDispatcher();
00152 
00153 private:
00154         int mTimeout;
00155         TimerThingy *mTimerThingy;
00156         QCString mVisualizationStack;
00157         Arts::SoundServerV2 *mServer;
00158         static Arts::Dispatcher *mDispatcher;
00159         static bool internalVis;
00160 };
00161 
00165 class FFTScope : public Visualization
00166 {
00167 public:
00168         FFTScope(int interval, int pid=0);
00169 
00173         virtual int bands() const=0;
00174 
00183         static float magic(int bands);
00184 
00201         virtual void setBands(float n)=0;
00202 };
00203 
00208 class StereoFFTScope : public FFTScope
00209 {
00210 public:
00211         StereoFFTScope(int timeout=250, int pid=0);
00212         virtual ~StereoFFTScope();
00213 
00219         virtual void scopeEvent(float *left, float *right, int len)
00220                 { (void)left; (void)right; (void)len; }
00221 
00229         void scopeData(std::vector<float> *&left, std::vector<float> *&right);
00230         virtual void timeout();
00231 
00232         virtual int bands() const;
00233         virtual void setBands(float f);
00234 
00235 private:
00236         Noatun::FFTScopeStereo *mScope;
00237         long mId;
00238 };
00239 
00240 
00245 class MonoFFTScope : public FFTScope
00246 {
00247 public:
00248         MonoFFTScope(int timeout=250, int pid=0);
00249         virtual ~MonoFFTScope();
00250 
00256         virtual void scopeEvent(float *data, int len)
00257                 { (void)data; (void)len; }
00258 
00266         void scopeData(std::vector<float> *&data);
00267 
00272         virtual void timeout();
00273 
00274         virtual int bands() const;
00275         virtual void setBands(float f);
00276 
00277 private:
00278         Noatun::FFTScope *mScope;
00279         long mId;
00280 };
00281 
00282 
00287 class Scope : public Visualization
00288 {
00289 public:
00290         Scope(int interval, int pid=0);
00291 
00295         virtual int samples() const=0;
00296 
00297         virtual void setSamples(int )=0;
00298 };
00299 
00305 class MonoScope : public Scope
00306 {
00307 public:
00308         MonoScope(int timeout=250, int pid=0);
00309         virtual ~MonoScope();
00310 
00316         virtual void scopeEvent(float *data, int len)
00317                 {(void)data; (void)len; }
00318 
00326         void scopeData(std::vector<float> *&data);
00327 
00332         virtual void timeout();
00333 
00334         virtual int samples() const;
00335         virtual void setSamples(int);
00336 
00337 private:
00338         Noatun::RawScope *mScope;
00339         long mId;
00340 };
00341 
00346 class StereoScope : public Scope
00347 {
00348 public:
00349         StereoScope(int timeout=250, int pid=0);
00350         virtual ~StereoScope();
00351 
00357         virtual void scopeEvent(float *left, float *right, int len)
00358                 { (void)left; (void)right; (void)len; }
00359 
00367         void scopeData(std::vector<float> *&left, std::vector<float> *&right);
00368 
00373         virtual void timeout();
00374 
00375         virtual int samples() const;
00376         virtual void setSamples(int);
00377 
00378 
00379 private:
00380         Noatun::RawScopeStereo *mScope;
00381         long mId;
00382 };
00383 
00390 class SessionManagement : public Plugin
00391 {
00392 public:
00393         SessionManagement();
00394         virtual ~SessionManagement();
00395 
00396         virtual void restore();
00397 };
00398 
00399 class NoatunListenerNotif;
00405 class NoatunListener : public QObject
00406 {
00407 Q_OBJECT
00408 friend class NoatunListenerNotif;
00409 
00410 public:
00411         NoatunListener(QObject *parent=0);
00412         virtual ~NoatunListener();
00413 
00414 signals:
00415         void event();
00416 
00417 protected:
00418         virtual void message();
00419 
00420         NoatunListenerNotif *mNotif;
00421 };
00422 
00432 class ExitNotifier : public NoatunListener
00433 {
00434 public:
00435         ExitNotifier(int pid, QObject *parent=0);
00436         virtual ~ExitNotifier();
00437 
00438 private:
00439         QCString appid;
00440 };
00441 
00453 class BoolNotifier : public QObject
00454 {
00455 Q_OBJECT
00456 public:
00457         BoolNotifier(bool *value, NoatunListener *listener, QObject *parent=0);
00458 
00459 private slots:
00460         void event() {*mValue=false;}
00461 
00462 private:
00463         bool *mValue;
00464 };
00465 
00466 #endif
00467 
KDE Logo
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