00001 /******************************************************************************* 00002 * JackClient.h (JackFX) 00003 ******************************************************************************/ 00004 00005 #ifndef _JACK_CLIENT_H_ 00006 #define _JACK_CLIENT_H_ 00007 00008 #include "common.h" 00009 #include <pthread.h> 00010 00011 class ISoundElement; 00012 class ISoundSource; 00013 class JackMidiPort; 00014 00018 class JackClient 00019 { 00020 friend class ISoundElement; 00021 friend class ISoundSource; 00022 friend class JackMidiPort; 00023 public: 00026 JackClient(); 00027 00030 ~JackClient(); 00031 00032 jack_client_t* GetClient() const; 00033 pthread_t GetThread() const; 00034 00035 static JackClient* GetSingleton(); 00036 00037 protected: 00038 private: 00039 static void JackShutdown(void* arg); 00040 static int JackProcess(jack_nframes_t nframes, void* arg); 00041 00042 void Process(jack_nframes_t nframes); 00043 00044 jack_client_t* m_client; 00045 00046 list<ISoundElement*> m_elements; 00047 list<ISoundSource*> m_sources; 00048 list<JackMidiPort*> m_midiports; 00049 00050 static JackClient* m_singleton; 00051 }; 00052 00053 class jack_init_error : public std::runtime_error 00054 { 00055 public: 00056 jack_init_error(const string& what) : std::runtime_error(what) {} 00057 }; 00058 00059 class jack_client_error : public std::runtime_error 00060 { 00061 public: 00062 jack_client_error(const string& what) : std::runtime_error(what) {} 00063 }; 00064 00065 #endif