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 "portaudio.h"
00025 
00026 namespace Jack
00027 {
00028 
00033 class JackPortAudioDriver : public JackAudioDriver
00034 {
00035 
00036     private:
00037 
00038         PaStream* fStream;
00039         float** fInputBuffer;
00040         float** fOutputBuffer;
00041         PaDeviceIndex fInputDevice;
00042         PaDeviceIndex fOutputDevice;
00043 
00044         void PrintSupportedStandardSampleRates(const PaStreamParameters* inputParameters, const PaStreamParameters* outputParameters);
00045         bool GetInputDeviceFromName(const char* name, PaDeviceIndex* device, int* in_max);
00046         bool GetOutputDeviceFromName(const char* name, PaDeviceIndex* device, int* out_max);
00047 
00048         static int Render(const void* inputBuffer, void* outputBuffer,
00049                           unsigned long framesPerBuffer,
00050                           const PaStreamCallbackTimeInfo* timeInfo,
00051                           PaStreamCallbackFlags statusFlags,
00052                           void* userData);
00053 
00054     public:
00055 
00056         JackPortAudioDriver(const char* name, JackEngine* engine, JackSynchro** table)
00057                 : JackAudioDriver(name, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
00058                 fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
00059         {}
00060 
00061         virtual ~JackPortAudioDriver()
00062         {}
00063 
00064         int Open(jack_nframes_t frames_per_cycle,
00065                  jack_nframes_t rate,
00066                  bool capturing,
00067                  bool playing,
00068                  int chan_in,
00069                  int chan_out,
00070                  bool monitor,
00071                  const char* capture_driver_name,
00072                  const char* playback_driver_name,
00073                  jack_nframes_t capture_latency,
00074                  jack_nframes_t playback_latency);
00075 
00076         int Close();
00077 
00078         int Start();
00079         int Stop();
00080 
00081         int Read();
00082         int Write();
00083 
00084         int SetBufferSize(jack_nframes_t buffer_size);
00085 };
00086 
00087 } // end of namespace
00088 
00089 #endif

Generated on Thu Feb 14 11:16:02 2008 for Jackdmp by  doxygen 1.5.1