Jack2
1.9.7
|
00001 /* 00002 Copyright (C) 2001 Paul Davis 00003 Copyright (C) 2004-2008 Grame 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 */ 00020 00021 #ifndef __JackAudioDriver__ 00022 #define __JackAudioDriver__ 00023 00024 #include "JackDriver.h" 00025 00026 namespace Jack 00027 { 00028 00033 class SERVER_EXPORT JackAudioDriver : public JackDriver 00034 { 00035 00036 protected: 00037 00038 void ProcessGraphAsync(); 00039 int ProcessGraphSync(); 00040 void WaitUntilNextCycle(); 00041 00042 virtual int ProcessAsync(); 00043 virtual int ProcessSync(); 00044 00045 int fCaptureChannels; 00046 int fPlaybackChannels; 00047 00048 // Static tables since the actual number of ports may be changed by the real driver 00049 // thus dynamic allocation is more difficult to handle 00050 jack_port_id_t fCapturePortList[DRIVER_PORT_NUM]; 00051 jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM]; 00052 jack_port_id_t fMonitorPortList[DRIVER_PORT_NUM]; 00053 00054 bool fWithMonitorPorts; 00055 00056 jack_default_audio_sample_t* GetInputBuffer(int port_index); 00057 jack_default_audio_sample_t* GetOutputBuffer(int port_index); 00058 jack_default_audio_sample_t* GetMonitorBuffer(int port_index); 00059 00060 void HandleLatencyCallback(int status); 00061 00062 public: 00063 00064 JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table); 00065 virtual ~JackAudioDriver(); 00066 00067 virtual int Open(jack_nframes_t buffer_size, 00068 jack_nframes_t samplerate, 00069 bool capturing, 00070 bool playing, 00071 int inchannels, 00072 int outchannels, 00073 bool monitor, 00074 const char* capture_driver_name, 00075 const char* playback_driver_name, 00076 jack_nframes_t capture_latency, 00077 jack_nframes_t playback_latency); 00078 00079 virtual int Open(bool capturing, 00080 bool playing, 00081 int inchannels, 00082 int outchannels, 00083 bool monitor, 00084 const char* capture_driver_name, 00085 const char* playback_driver_name, 00086 jack_nframes_t capture_latency, 00087 jack_nframes_t playback_latency); 00088 00089 virtual int Process(); 00090 virtual int ProcessNull(); 00091 00092 virtual int Attach(); 00093 virtual int Detach(); 00094 00095 virtual int Start(); 00096 virtual int Stop(); 00097 00098 virtual int Write(); 00099 00100 virtual int SetBufferSize(jack_nframes_t buffer_size); 00101 virtual int SetSampleRate(jack_nframes_t sample_rate); 00102 00103 virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); 00104 00105 }; 00106 00107 } // end of namespace 00108 00109 #endif