linuxsampler 2.3.1
MidiInputDevice.h
Go to the documentation of this file.
1/***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2014 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_MIDIINPUTDEVICE_H__
25#define __LS_MIDIINPUTDEVICE_H__
26
27#include <stdexcept>
28#include <set>
29#include <map>
30#include <vector>
31
32#include "../../common/global.h"
33#include "../../common/Exception.h"
34#include "../DeviceParameter.h"
35#include "MidiInputPort.h"
36#include "../../engines/Engine.h"
37#include "../../EventListeners.h"
38
39namespace LinuxSampler {
40
41 // just symbol prototyping
42 class MidiInputPort;
43 class Engine;
44 class MidiInputDeviceFactory;
45
53 public:
54 MidiInputException(const std::string& msg) : Exception(msg) {}
55 };
56
66 class MidiInputDevice : public Device {
67 public:
68
70 // type definitions
71
88
109
110
111
113 // abstract methods
114 // (these have to be implemented by the descendant)
115
122 virtual void Listen() = 0;
123
129 virtual void StopListen() = 0;
130
135
142
143
144
146 // normal methods
147 // (usually not to be overriden by descendant)
148
155
161
166
177
183
189
190 protected:
193 void* pSampler;
195
206
211
218
225
232
242
245 friend class MidiInputDeviceFactory; // allow MidiInputDeviceFactory class to destroy midi devices
246 friend class MidiInputPort; // allow MidiInputPort to access pSampler
247 };
248}
249
250#endif // __LS_MIDIINPUTDEVICE_H__
Abstract base class for driver parameters of type Bool.
Abstract base class for driver parameters of type int.
Abstract base class for parameters at driver instanciation time.
Abstract base class for all kind of drivers in LinuxSampler.
Definition Device.h:35
Exception that will be thrown in NON REAL TIME PARTS of the LinuxSampler application.
Definition Exception.h:37
virtual optional< bool > DefaultAsBool(std::map< String, String > Parameters) OVERRIDE
virtual std::map< String, DeviceCreationParameter * > DependsAsParameters() OVERRIDE
Might return a unique key-value pair list (map) reflecting the dependencies of this parameter to othe...
virtual bool Fix() OVERRIDE
Whether the parameter is read only.
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
virtual bool Mandatory() OVERRIDE
Whether the parameter must be supplied by the user at device creation time.
virtual void OnSetValue(bool b) OVERRIDE
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
Abstract base class for MIDI input drivers in LinuxSampler.
virtual MidiInputPort * CreateMidiPort()=0
Create new Midi port This will be called by AcquirePorts Each individual device must implement this.
std::map< int, MidiInputPort * > Ports
All MIDI ports.
MidiInputPort * GetPort(uint iPort)
Return midi port iPort.
std::map< String, DeviceCreationParameter * > Parameters
All device parameters.
std::map< String, DeviceCreationParameter * > DeviceParameters()
Return all device parameter settings.
void * pSampler
Sampler instance. FIXME: should actually be of type Sampler*.
void AddMidiPortCountListener(MidiPortCountListener *l)
Registers the specified listener to be notified when the number of MIDI input ports is changed.
virtual void Listen()=0
Start listen to MIDI input events on the MIDI input port.
void fireMidiPortCountChanged(int NewCount)
Notifies listeners that the amount of MIDI inpurt ports have been changed.
uint PortCount()
Returns amount of MIDI ports this MIDI input device currently provides.
void AcquirePorts(uint Ports)
Set number of MIDI ports required by the engine This can either do nothing, create more ports or dest...
int MidiInputDeviceID()
Returns the unique ID number associated with this MIDIInputDevice instance.
void fireMidiPortAdded(MidiInputPort *pPort)
Notifies listeners that the supplied MIDI input port has just been added.
void fireMidiPortToBeRemoved(MidiInputPort *pPort)
Notifies listeners that the supplied MIDI input port is going to be removed soon.
virtual void StopListen()=0
Stop to listen to MIDI input events on the MIDI input port.
virtual String Driver()=0
Return device driver name.
ListenerList< MidiPortCountListener * > portCountListeners
void RemoveMidiPortCountListener(MidiPortCountListener *l)
Removes the specified listener, to stop being notified of further MIDI input port count chances.
Midi input exception that should be thrown by the MidiInputDevice descendants in case initialization ...
MidiInputException(const std::string &msg)
This class is used as a listener, which is notified when the number of MIDI input ports is changed.
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...
#define OVERRIDE
Definition global.h:84
std::string String
Definition global.h:44