2 Copyright (C) 2004 Paul Davis
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __alsa_sequencer_midiport_h__
20 #define __alsa_sequencer_midiport_h__
28 #include <alsa/asoundlib.h>
29 #include <midi++/port.h>
33 class ALSA_SequencerMidiPort : public Port
37 ALSA_SequencerMidiPort (const XMLNode&);
38 virtual ~ALSA_SequencerMidiPort ();
40 int write (byte *msg, size_t msglen, timestamp_t timestamp);
41 int read (byte *buf, size_t max);
43 /* select(2)/poll(2)-based I/O */
45 virtual int selectable() const;
47 static int discover (std::vector<PortSet>&);
48 static std::string typestring;
50 XMLNode& get_state() const;
51 void set_state (const XMLNode&);
55 std::string get_typestring () const {
60 snd_midi_event_t *decoder, *encoder;
64 int create_ports (const Port::Descriptor&);
66 static int init_client (std::string name);
67 static snd_seq_t* seq;
69 typedef std::pair<int,int> SequencerPortAddress;
70 void get_connections (std::vector<SequencerPortAddress>&, int dir) const;
73 }; /* namespace MIDI */
75 #endif // __alsa_sequencer_midiport_h__