/[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 476 - (show annotations) (download) (as text)
Fri Mar 18 18:16:27 2005 UTC (19 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5771 byte(s)
* ALSA MIDI driver: added MIDI port parameter 'ALSA_SEQ_ID' which reflects
  the ALSA sequencer ID of a port (read only)

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

  ViewVC Help
Powered by ViewVC