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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2434 - (show annotations) (download) (as text)
Thu Mar 7 19:23:24 2013 UTC (11 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 5860 byte(s)
* Started to spread new C++ keyword "override" over the code base
  (keyword introduced with C++11 standard).

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2013 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_MIDIINPUTDEVICEMME_H__
25 #define __LS_MIDIINPUTDEVICEMME_H__
26
27 #define MME_MAX_SYSEX_BUF_SIZE 32768
28
29 #include "../../common/global_private.h"
30 #include "MidiInputDevice.h"
31
32 #include <windows.h>
33 #include <mmsystem.h>
34
35 namespace LinuxSampler {
36
37 /** MME MIDI input driver
38 *
39 * Implements MIDI input for the Windows Multimedia Extensions
40 * (MME).
41 */
42 class MidiInputDeviceMme : public MidiInputDevice {
43 public:
44
45 class ParameterPorts : public DeviceCreationParameterInt {
46 public:
47 ParameterPorts();
48 ParameterPorts(String val);
49 virtual String Description() OVERRIDE;
50 virtual bool Fix() OVERRIDE;
51 virtual bool Mandatory() OVERRIDE;
52 virtual std::map<String,DeviceCreationParameter*> DependsAsParameters() OVERRIDE;
53 virtual optional<int> DefaultAsInt(std::map<String,String> Parameters) OVERRIDE;
54 virtual optional<int> RangeMinAsInt(std::map<String,String> Parameters) OVERRIDE;
55 virtual optional<int> RangeMaxAsInt(std::map<String,String> Parameters) OVERRIDE;
56 virtual std::vector<int> PossibilitiesAsInt(std::map<String,String> Parameters) OVERRIDE;
57 virtual void OnSetValue(int i) throw (Exception) OVERRIDE;
58 static String Name();
59 };
60
61 /**
62 * MIDI Port implementation for the MME MIDI input driver.
63 */
64 class MidiInputPortMme : public MidiInputPort {
65 public:
66
67 /** MIDI Port Parameter 'Port'
68 *
69 * MME MIDI ports
70 *
71 */
72 class ParameterPort : public DeviceRuntimeParameterString {
73 public:
74 ParameterPort(MidiInputPortMme* pPort);
75 virtual bool Fix() OVERRIDE;
76 virtual String Description() OVERRIDE;
77 virtual std::vector<String> PossibilitiesAsString() OVERRIDE;
78 virtual void OnSetValue(String s) OVERRIDE;
79 private:
80 MidiInputPortMme* pPort;
81
82 };
83
84 protected:
85 MidiInputPortMme(MidiInputDeviceMme* pDevice) throw (MidiInputException);
86 ~MidiInputPortMme();
87 void ConnectToMmeMidiSource(const char* MidiSource);
88 void CloseMmeMidiPort(void);
89 void MmeCallbackDispatcher(HMIDIIN handle, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
90 friend class MidiInputDeviceMme;
91 private:
92 MidiInputDeviceMme* pDevice;
93 static void CALLBACK win32_midiin_callback(HMIDIIN handle, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
94 HMIDIIN MidiInHandle;
95 MIDIHDR midiHdr;
96 bool MidiInOpened;
97 int SysExOffset;
98 char *SysExBuf;
99 char *TmpSysExBuf;
100 bool ExitFlag;
101 bool FirstSysExBlock;
102 bool SysExMsgComplete;
103 };
104
105 MidiInputDeviceMme(std::map<String,DeviceCreationParameter*> Parameters, void* pSampler);
106 ~MidiInputDeviceMme();
107
108 // derived abstract methods from class 'MidiInputDevice'
109 void Listen() OVERRIDE;
110 void StopListen() OVERRIDE;
111 virtual String Driver() OVERRIDE;
112 static String Name();
113 static String Description();
114 static String Version();
115
116 MidiInputPortMme* CreateMidiPort();
117 private:
118 friend class MidiInputPortMme;
119 friend class MidiInputPortMme::ParameterPort;
120 };
121 }
122
123 #endif // __LS_MIDIINPUTDEVICEMME_H__

  ViewVC Help
Powered by ViewVC