Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members

dev_sound.h

00001 #ifndef __DEV_SOUND_H__
00002 #define __DEV_SOUND_H__
00003 
00004 #include <config.h>
00005 
00006 #ifdef HAVE_JACK
00007 #include <jack/jack.h>
00008 #endif
00009 
00010 //#ifdef HAVE_PORTAUDIO
00011 #include <portaudio.h>
00012 //#endif
00013 
00014 #include <pipe.h>
00015 
00016 typedef struct {
00017   PaDeviceID id;
00018   PortAudioStream *stream;
00019   PaDeviceInfo *info;
00020   Pipe *pipe;
00021 } PaDevInfo;
00022 
00023 typedef struct {
00024    PaDevInfo *input;
00025    PaDevInfo *output;
00026 } PaDevices;
00028 
00029 class SoundDevice {
00030  public:
00031   SoundDevice();
00033   ~SoundDevice();
00035 
00045   bool open(bool read, bool write);
00047 
00048   bool input(bool state); 
00049   bool output(bool state); 
00050 
00051   void close(); 
00052   
00053   int read(void *buf, int len); 
00054   
00055   int write(void *buf, int len); 
00056   void flush_input();
00057   void flush_output();
00058 
00059   bool jack;
00060   bool jack_in;
00061   bool jack_out;
00062 
00063  private:
00064   bool pa_open(bool state,int mode);
00065   PaError pa_real_open(int mode);
00066   
00067   PaError err;
00068 
00069   PaDevInfo input_device; 
00070   PaDevInfo output_device; 
00071   PaDevices pa_dev;
00072   int pa_mode; 
00073 #define PaNull 0
00074 #define PaInput 1
00075 #define PaOutput 2
00076 
00077   Pipe *jack_in_pipe;
00078   Pipe *jack_out_pipe;
00079 #ifdef HAVE_JACK
00080   jack_client_t *jack_client;
00081   jack_port_t *jack_in_port;
00082   jack_port_t *jack_out_port;
00083   jack_default_audio_sample_t *jack_in_buf;
00084   jack_default_audio_sample_t *jack_out_buf;
00085   size_t jack_sample_size;
00086   int jack_samplerate;
00087 #endif
00088 
00089 };
00090 
00091 #endif

Generated on Mon Apr 25 12:22:38 2005 for MuSE by doxygen 1.3.4