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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 551 - (show annotations) (download) (as text)
Tue May 17 18:16:54 2005 UTC (18 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4584 byte(s)
* Implemented MIDI program change as general, engine independant solution.
  The program number will determine the sampler channel to which the MIDI
  device will be connected to and the given MIDI channel defines on which
  MIDI channel that sampler channel should listen to. Also the program
  change will disconnect probably established connection from the previous
  program change event.

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

  ViewVC Help
Powered by ViewVC