/[svn]/linuxsampler/trunk/src/drivers/midi/MidiInputDeviceAlsa.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/drivers/midi/MidiInputDeviceAlsa.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 277 - (show annotations) (download) (as text)
Sat Oct 9 15:48:32 2004 UTC (19 years, 6 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4971 byte(s)
* compatibility fixes for old gcc 2.95.4

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #ifndef __LS_MIDIINPUTDEVICEALSA_H__
24 #define __LS_MIDIINPUTDEVICEALSA_H__
25
26 #include <alsa/asoundlib.h>
27
28 #include "../../common/global.h"
29 #include "../../common/Thread.h"
30 #include "../../common/RingBuffer.h"
31 #include "MidiInputDevice.h"
32
33 namespace LinuxSampler {
34
35 /** ALSA MIDI input driver
36 *
37 * Implements MIDI input for the Advanced Linux Sound Architecture
38 * (ALSA).
39 */
40 class MidiInputDeviceAlsa : public MidiInputDevice, public Thread {
41 public:
42
43 /**
44 * MIDI Port implementation for the ALSA MIDI input driver.
45 */
46 class MidiInputPortAlsa : public MidiInputPort {
47 public:
48 /** MIDI Port Parameter 'NAME'
49 *
50 * Used to assign an arbitrary name to the MIDI port.
51 */
52 class ParameterName : public MidiInputPort::ParameterName {
53 public:
54 ParameterName(MidiInputPort* pPort) throw (LinuxSamplerException);
55 virtual void OnSetValue(String s) throw (LinuxSamplerException);
56 };
57
58 /** MIDI Port Parameter 'ALSA_SEQ_BINDINGS'
59 *
60 * Used to connect to other Alsa sequencer clients.
61 */
62 class ParameterAlsaSeqBindings : public DeviceRuntimeParameterStrings {
63 public:
64 ParameterAlsaSeqBindings(MidiInputPortAlsa* pPort);
65 virtual String Description();
66 virtual bool Fix();
67 virtual std::vector<String> PossibilitiesAsString();
68 virtual void OnSetValue(std::vector<String> vS) throw (LinuxSamplerException);
69 protected:
70 MidiInputPortAlsa* pPort;
71 };
72
73 void ConnectToAlsaMidiSource(const char* MidiSource);
74 protected:
75 MidiInputPortAlsa(MidiInputDeviceAlsa* pDevice) throw (MidiInputException);
76 ~MidiInputPortAlsa();
77 friend class MidiInputDeviceAlsa;
78 private:
79 MidiInputDeviceAlsa* pDevice;
80
81 friend class ParameterName;
82 friend class ParameterAlsaSeqBindings;
83 };
84
85 MidiInputDeviceAlsa(std::map<String,DeviceCreationParameter*> Parameters);
86 ~MidiInputDeviceAlsa();
87
88 // derived abstract methods from class 'MidiInputDevice'
89 void Listen();
90 void StopListen();
91 virtual String Driver();
92 static String Name();
93 static String Description();
94 static String Version();
95
96 MidiInputPortAlsa* CreateMidiPort();
97 protected:
98 int Main(); ///< Implementation of virtual method from class Thread
99 private:
100 snd_seq_t* hAlsaSeq;
101 int hAlsaSeqClient; ///< Alsa Sequencer client ID
102
103 friend class MidiInputPortAlsa;
104 friend class MidiInputPortAlsa::ParameterName;
105 friend class MidiInputPortAlsa::ParameterAlsaSeqBindings;
106 };
107 }
108
109 #endif // __LS_MIDIINPUTDEVICEALSA_H__

  ViewVC Help
Powered by ViewVC