JackASIODriver.h

00001 /*
00002 Copyright (C) 2006 Grame
00003 
00004 Portable Audio I/O Library for ASIO Drivers
00005 Author: Stephane Letz
00006 Based on the Open Source API proposed by Ross Bencina
00007 Copyright (c) 2000-2002 Stephane Letz, Phil Burk, Ross Bencina
00008 
00009 This program is free software; you can redistribute it and/or modify
00010 it under the terms of the GNU General Public License as published by
00011 the Free Software Foundation; either version 2 of the License, or
00012 (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022 
00023 */
00024 
00025 #ifndef __JackASIODriver__
00026 #define __JackASIODriver__
00027 
00028 #include "JackAudioDriver.h"
00029 #include "portaudio.h"
00030 
00031 namespace Jack
00032 {
00033 
00038 class JackASIODriver : public JackAudioDriver
00039 {
00040 
00041     private:
00042 
00043                 PaStream* fStream;
00044                 float** fInputBuffer;
00045                 float** fOutputBuffer;
00046                 PaDeviceIndex fInputDevice;
00047                 PaDeviceIndex fOutputDevice;
00048 
00049                 static int Render(const void* inputBuffer, void* outputBuffer,
00050                                                         unsigned long framesPerBuffer,
00051                                                         const PaStreamCallbackTimeInfo* timeInfo,
00052                                                         PaStreamCallbackFlags statusFlags,
00053                                                         void* userData);
00054 
00055     public:
00056 
00057         JackASIODriver(const char* name, JackEngine* engine, JackSynchro** table)
00058                         : JackAudioDriver(name, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
00059                         fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
00060                 {}
00061 
00062         virtual ~JackASIODriver()
00063                 {}
00064 
00065         int Open(jack_nframes_t frames_per_cycle,
00066                  jack_nframes_t rate,
00067                  int capturing,
00068                  int 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 nframes);
00086 
00087         void PrintState();
00088 };
00089 
00090 } // end of namespace
00091 
00092 #endif

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