Hydrogen - Linux Drum Machine
Main Page | Class Hierarchy | Compound List | File List | Compound Members

JackDriver.h

00001 /*
00002  * Hydrogen
00003  * Copyright(c) 2002-2003 by Alex >Comix< Cominu [comix@users.sourceforge.net]
00004  *
00005  * http://hydrogen.sourceforge.net
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * $Id: JackDriver.h,v 1.18 2003/06/30 09:07:21 comix Exp $
00022  *
00023  */
00024 
00025 #include "config.h"
00026 
00027 // check if jack support is enabled
00028 #ifdef JACK_SUPPORT
00029 
00030 
00031 #ifndef JACK_DRIVER_H
00032 #define JACK_DRIVER_H
00033 
00034 #include <pthread.h>
00035 #include <jack/jack.h>
00036 #include <jack/transport.h>
00037 
00038 #include "Hydrogen.h"
00039 #include "GenericDriver.h"
00040 #include "PreferencesMng.h"
00041 using std::cout;
00042 using std::endl;
00043 
00044 //----------------------------------------------------------------------------
00048 class JackDriver : public GenericDriver {
00049     public:
00050         jack_client_t *client;
00051 
00052         virtual string getClassName() { return "JackDriver";    }
00053 
00055         JackDriver(JackProcessCallback processCallback);
00056 
00058         ~JackDriver();
00059 
00060         int connect();
00061 
00062         void disconnect();
00063 
00064         void write(float* buffer_L, float* buffer_R, unsigned int bufferSize);
00065 
00066         void setBufferSize(uint bufferSize);
00067         uint getBufferSize();
00068 
00069         uint getSampleRate();
00070 
00071         void updateTransportInfo();
00072         jack_nframes_t getNFrames() {   return transport_nFrames;   }
00073         jack_transport_info_t   getTransportInfo() {    return transport_info;  }
00074 
00075     private:
00076         JackProcessCallback processCallback;
00077         jack_port_t *output_port_1;
00078         jack_port_t *output_port_2;
00079         string output_port_name_1;
00080         string output_port_name_2;
00081 
00082         jack_nframes_t transport_nFrames;
00083         jack_transport_info_t transport_info;
00084 };
00085 
00086 
00087 #endif // JACK_SUPPORT
00088 
00089 #endif
00090 

 
 
Hydrogen (c) 2002..2003 Comix