00001 #ifndef __DEV_SOUND_H__ 00002 #define __DEV_SOUND_H__ 00003 00004 #include <portaudio.h> 00005 #include <pablio.h> 00006 00007 #include <config.h> 00008 #ifdef HAVE_JACK 00009 #include <jack/jack.h> 00010 #endif 00011 #include <pipe.h> 00012 00013 class SoundDevice { 00014 public: 00015 SoundDevice(); 00017 ~SoundDevice(); 00019 00029 bool open(bool read, bool write); 00031 00032 bool input(bool state); 00033 bool output(bool state); 00034 00035 void close(); 00036 00037 int read(void *buf, int len); 00038 00039 int write(void *buf, int len); 00040 00041 bool jack; 00042 bool jack_in; 00043 bool jack_out; 00044 00045 00046 private: 00047 PABLIO_Stream *aInStream; 00048 PABLIO_Stream *aOutStream; 00049 00050 const PaDeviceInfo *info_input; 00051 const PaDeviceInfo *info_output; 00052 00053 bool pablio_input(bool state); 00054 bool pablio_output(bool state); 00055 00056 PaError err; 00057 00058 Pipe *jack_in_pipe; 00059 Pipe *jack_out_pipe; 00060 #ifdef HAVE_JACK 00061 jack_client_t *jack_client; 00062 jack_port_t *jack_in_port; 00063 jack_port_t *jack_out_port; 00064 jack_default_audio_sample_t *jack_in_buf; 00065 jack_default_audio_sample_t *jack_out_buf; 00066 size_t jack_sample_size; 00067 int jack_samplerate; 00068 #endif 00069 00070 }; 00071 00072 #endif