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
00016
00017 #define NOATUNPLUGIND
00018 #define NOATUNPLUGINC(classname) { }
00019
00020 class Playlist;
00021 class Player;
00022 class ExitNotifier;
00023 class NoatunApp;
00024
00025 class Plugin
00026 {
00027 public:
00028 Plugin();
00029 virtual ~Plugin();
00030
00035 virtual void init();
00036
00043 virtual bool unload();
00044
00050 virtual Playlist *playlist() { return 0; }
00051 };
00052
00053 class UserInterface : public Plugin
00054 {
00055 public:
00056 UserInterface();
00057 virtual ~UserInterface();
00058 };
00059
00060
00061 class TimerThingy;
00062
00063
00074 class Visualization
00075 {
00076 friend class TimerThingy;
00077 friend class ThingThatTellsAVisualizationThatNoatunIsGone;
00078 friend class ExitNotifier;
00079 friend class NoatunApp;
00080 public:
00090 Visualization(int interval=125, int pid=0);
00091 virtual ~Visualization();
00092
00097 virtual void start();
00101 virtual void stop();
00102
00106 int interval() const;
00107
00113 virtual void setInterval(int msecs);
00114
00118 virtual void timeout()=0;
00119
00120 Noatun::StereoEffectStack visualizationStack();
00121 Arts::SoundServerV2 *server();
00122
00132 static int noatunPid();
00133
00137 bool connected();
00138
00143 static void initDispatcher();
00144
00145 private:
00146 int mTimeout;
00147 TimerThingy *mTimerThingy;
00148 QCString mVisualizationStack;
00149 Arts::SoundServerV2 *mServer;
00150 static Arts::Dispatcher *mDispatcher;
00151 static bool internalVis;
00152 };
00153
00154 class FFTScope : public Visualization
00155 {
00156 public:
00157 FFTScope(int interval, int pid=0);
00158
00162 virtual int bands() const=0;
00163
00174 static float magic(int bands);
00175
00187 virtual void setBands(float n)=0;
00188 };
00189
00190 class StereoFFTScope : public FFTScope
00191 {
00192 public:
00193 StereoFFTScope(int timeout=250, int pid=0);
00194 virtual ~StereoFFTScope();
00195
00201 virtual void scopeEvent(float *left, float *right, int len)
00202 { (void)left; (void)right; (void)len; }
00203
00211 void scopeData(std::vector<float> *&left, std::vector<float> *&right);
00212 virtual void timeout();
00213
00214 virtual int bands() const;
00215 virtual void setBands(float f);
00216
00217 private:
00218 Noatun::FFTScopeStereo *mScope;
00219 long mId;
00220 };
00221
00222 class MonoFFTScope : public FFTScope
00223 {
00224 public:
00225 MonoFFTScope(int timeout=250, int pid=0);
00226 virtual ~MonoFFTScope();
00227
00233 virtual void scopeEvent(float *data, int len)
00234 { (void)data; (void)len; }
00235
00243 void scopeData(std::vector<float> *&data);
00244
00249 virtual void timeout();
00250
00251 virtual int bands() const;
00252 virtual void setBands(float f);
00253
00254 private:
00255 Noatun::FFTScope *mScope;
00256 long mId;
00257 };
00258
00259 class Scope : public Visualization
00260 {
00261 public:
00262 Scope(int interval, int pid=0);
00263
00267 virtual int samples() const=0;
00268
00269 virtual void setSamples(int )=0;
00270 };
00271
00272 class MonoScope : public Scope
00273 {
00274 public:
00275 MonoScope(int timeout=250, int pid=0);
00276 virtual ~MonoScope();
00277
00283 virtual void scopeEvent(float *data, int len)
00284 {(void)data; (void)len; }
00285
00293 void scopeData(std::vector<float> *&data);
00294
00299 virtual void timeout();
00300
00301
00302 virtual int samples() const;
00303 virtual void setSamples(int);
00304
00305 private:
00306 Noatun::RawScope *mScope;
00307 long mId;
00308 };
00309
00310 class StereoScope : public Scope
00311 {
00312 public:
00313 StereoScope(int timeout=250, int pid=0);
00314 virtual ~StereoScope();
00315
00321 virtual void scopeEvent(float *left, float *right, int len)
00322 { (void)left; (void)right; (void)len; }
00323
00331 void scopeData(std::vector<float> *&left, std::vector<float> *&right);
00332
00337 virtual void timeout();
00338
00339
00340 virtual int samples() const;
00341 virtual void setSamples(int);
00342
00343
00344 private:
00345 Noatun::RawScopeStereo *mScope;
00346 long mId;
00347 };
00348
00349 class SessionManagement : public Plugin
00350 {
00351 public:
00352 SessionManagement();
00353 virtual ~SessionManagement();
00354
00355 virtual void restore();
00356 };
00357
00358 class NoatunListenerNotif;
00359
00360 class NoatunListener : public QObject
00361 {
00362 Q_OBJECT
00363 friend class NoatunListenerNotif;
00364
00365 public:
00366 NoatunListener(QObject *parent=0);
00367 virtual ~NoatunListener();
00368
00369 signals:
00370 void event();
00371
00372 protected:
00373 virtual void message();
00374
00375 NoatunListenerNotif *mNotif;
00376 };
00377
00384 class ExitNotifier : public NoatunListener
00385 {
00386 public:
00387 ExitNotifier(int pid, QObject *parent=0);
00388 virtual ~ExitNotifier();
00389
00390 private:
00391 QCString appid;
00392 };
00393
00399 class BoolNotifier : public QObject
00400 {
00401 Q_OBJECT
00402 public:
00403 BoolNotifier(bool *value, NoatunListener *listener, QObject *parent=0);
00404
00405 private slots:
00406 void event() {*mValue=false;}
00407
00408 private:
00409 bool *mValue;
00410 };
00411
00412 #endif
00413