Jack2  1.9.8
JackAudioDriver.h
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         jack_default_audio_sample_t* GetInputBuffer(int port_index);
00039         jack_default_audio_sample_t* GetOutputBuffer(int port_index);
00040         jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
00041 
00042         void HandleLatencyCallback(int status);
00043         virtual void UpdateLatencies();
00044 
00045         int ProcessAsync();
00046         void ProcessGraphAsync();
00047         void ProcessGraphAsyncMaster();
00048         void ProcessGraphAsyncSlave();
00049 
00050         int ProcessSync();
00051         void ProcessGraphSync();
00052         void ProcessGraphSyncMaster();
00053         void ProcessGraphSyncSlave();
00054 
00055     public:
00056 
00057         JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
00058         virtual ~JackAudioDriver();
00059 
00060         virtual int Open(jack_nframes_t buffer_size,
00061                         jack_nframes_t samplerate,
00062                         bool capturing,
00063                         bool playing,
00064                         int inchannels,
00065                         int outchannels,
00066                         bool monitor,
00067                         const char* capture_driver_name,
00068                         const char* playback_driver_name,
00069                         jack_nframes_t capture_latency,
00070                         jack_nframes_t playback_latency);
00071 
00072         virtual int Open(bool capturing,
00073                         bool playing,
00074                         int inchannels,
00075                         int outchannels,
00076                         bool monitor,
00077                         const char* capture_driver_name,
00078                         const char* playback_driver_name,
00079                         jack_nframes_t capture_latency,
00080                         jack_nframes_t playback_latency);
00081 
00082         virtual int Process();
00083 
00084         virtual int Attach();
00085         virtual int Detach();
00086 
00087         virtual int Write();
00088 
00089         virtual int SetBufferSize(jack_nframes_t buffer_size);
00090         virtual int SetSampleRate(jack_nframes_t sample_rate);
00091 
00092         virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
00093 
00094 };
00095 
00096 } // end of namespace
00097 
00098 #endif