Jack2 1.9.6

JackPortAudioDriver.h

00001 /*
00002 Copyright (C) 2004-2008 Grame
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #ifndef __JackPortAudioDriver__
00021 #define __JackPortAudioDriver__
00022 
00023 #include "JackAudioDriver.h"
00024 #include "JackPortAudioDevices.h"
00025 
00026 namespace Jack
00027 {
00028 
00033 class JackPortAudioDriver : public JackAudioDriver
00034 {
00035 
00036     private:
00037 
00038         PortAudioDevices* fPaDevices;
00039         PaStream* fStream;
00040         float** fInputBuffer;
00041         float** fOutputBuffer;
00042         PaDeviceIndex fInputDevice;
00043         PaDeviceIndex fOutputDevice;
00044 
00045         static int Render(const void* inputBuffer, void* outputBuffer,
00046                           unsigned long framesPerBuffer,
00047                           const PaStreamCallbackTimeInfo* timeInfo,
00048                           PaStreamCallbackFlags statusFlags,
00049                           void* userData);
00050 
00051     public:
00052 
00053         JackPortAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, PortAudioDevices* pa_devices)
00054                 : JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
00055                 fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
00056         {
00057             fPaDevices = pa_devices;
00058         }
00059 
00060         virtual ~JackPortAudioDriver()
00061         {
00062             delete fPaDevices;
00063         }
00064 
00065         int Open(jack_nframes_t buffe_size,
00066                  jack_nframes_t samplerate,
00067                  bool capturing,
00068                  bool playing,
00069                  int chan_in,
00070                  int chan_out,
00071                  bool monitor,
00072                  const char* capture_driver_name,
00073                  const char* playback_driver_name,
00074                  jack_nframes_t capture_latency,
00075                  jack_nframes_t playback_latency);
00076 
00077         int Close();
00078 
00079         int Start();
00080         int Stop();
00081 
00082         int Read();
00083         int Write();
00084 
00085         int SetBufferSize(jack_nframes_t buffer_size);
00086 };
00087 
00088 } // end of namespace
00089 
00090 #endif