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

AlsaMidiDriver.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: AlsaMidiDriver.h,v 1.11 2003/06/09 08:53:50 comix Exp $
00022  *
00023  */
00024 
00025 #include "config.h"
00026 
00027 // check if ALSA_SEQ support is enabled
00028 #ifdef USE_ALSA_SEQ
00029 
00030 
00031 #ifndef ALSA_MIDI_DRIVER_H
00032 #define ALSA_MIDI_DRIVER_H
00033 
00034 #include <alsa/asoundlib.h>
00035 #include <string>
00036 #include <vector>
00037 using std::string;
00038 using std::vector;
00039 
00040 #include "Object.h"
00041 #include "Hydrogen.h"
00042 #include "Song.h"
00043 
00044 class MidiPortInfo
00045 {
00046     public:
00047         string name;
00048         int client;
00049         int port;
00050 };
00051 
00056 class AlsaMidiDriver : public Object
00057 {
00058     public:
00059         virtual string getClassName() { return "AlsaMidiDriver";    }
00060 
00061         AlsaMidiDriver();
00062         ~AlsaMidiDriver();
00063 
00064         void open();
00065         void close();
00066         void setActive(bool isActive) { this->active = isActive;    }
00067         void midi_action(snd_seq_t *seq_handle);
00068         vector<MidiPortInfo> listAlsaOutputPorts();
00069 
00070     private:
00071         bool active;
00072         void noteOnEvent( snd_seq_event_t* ev );
00073         void noteOffEvent( snd_seq_event_t* ev );
00074         void controllerEvent( snd_seq_event_t* ev );
00075         void sysexEvent( unsigned char *midiBuffer, int nBytes );
00076         void playEvent();
00077         void stopEvent();
00078 
00079         void midiDump( unsigned char *buffer, int bufSize );
00080 };
00081 
00082 
00083 #endif // USE_ALSA_SEQ
00084 
00085 #endif

 
 
Hydrogen (c) 2002..2003 Comix