linuxsampler 2.3.1
MidiInputPort.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_MIDIINPUTPORT_H__
25#define __LS_MIDIINPUTPORT_H__
26
27#include "../../common/global.h"
28#include "../../common/Mutex.h"
29#include "../../common/Exception.h"
30#include "../DeviceParameter.h"
31#include "midi.h"
32#include "MidiInputDevice.h"
33#include "../../engines/EngineChannel.h"
34#include "../../common/SynchronizedConfig.h"
35
36namespace LinuxSampler {
37
38 // just symbol prototyping
39 class MidiInputDevice;
40 class EngineChannel;
41 class VirtualMidiDevice;
42
44 public:
45
47 // type definitions
48
64
65
66
68 // normal methods
69 // (usually not to be overriden by descendant)
70
83 void Connect(EngineChannel* pEngineChannel, midi_chan_t MidiChannel);
84
92 void Disconnect(EngineChannel* pEngineChannel);
93
98
104
109
114
123
131
136
159
160
162 // dispatch methods
163 // (should be called by the MidiInputDevice descendant on events)
164
181
199
216
234
248 void DispatchPitchbend(int Pitch, uint MidiChannel);
249
265
282
300
317
335
353
372
394
416
438
448
456
466
467 protected:
483
488
493
510 int expectedEventSize(unsigned char byte);
511
513
514 private:
515 static SynchronizedConfig<std::set<Engine*> > SysexListeners;
516
517 uint8_t* handleRunningStatus(uint8_t* pData);
518 };
519
520} // namsepace LinuxSampler
521
522#endif // __LS_MIDIINPUTPORT_H__
Abstract base class for driver parameters of type String.
virtual String Value() OVERRIDE
The current value of this parameter (encoded as String).
Abstracet base class for all driver parameters of the sampler.
Channel Interface for LinuxSampler Sampler Engines.
LinuxSampler Sampler Engine Interface.
Definition Engine.h:41
Exception that will be thrown in NON REAL TIME PARTS of the LinuxSampler application.
Definition Exception.h:37
Abstract base class for MIDI input drivers in LinuxSampler.
virtual String Description() OVERRIDE
A human readable description, explaining the exact purpose of the driver parameter.
virtual std::vector< String > PossibilitiesAsString() OVERRIDE
Must be implemented by descendant, returning a list of possible String values for the parameter.
virtual bool Fix() OVERRIDE
Whether the parameter is read only.
virtual void OnSetValue(String s) OVERRIDE
Must be implemented be a driver's parameter class to react on the parameter value being set / altered...
ParameterName(MidiInputPort *pPort, String val)
void DispatchBankSelectMsb(uint8_t BankMsb, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a MIDI bank select MSB (Most Signific...
void Disconnect(EngineChannel *pEngineChannel)
Disconnect given sampler engine channel from this MIDI input device.
static void AddSysexListener(Engine *engine)
Registers that an engine wants to have sysex messages.
void DispatchSysex(void *pData, uint Size)
Should be called by the implementing MIDI input device whenever a system exclusive message arrived,...
uint GetPortNumber()
Return port number with which this MIDI port is registered to the MIDI device.
void DispatchControlChange(uint8_t Controller, uint8_t Value, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a control change event arrived,...
void Connect(EngineChannel *pEngineChannel, midi_chan_t MidiChannel)
Connect given sampler engine channel with this MIDI input device.
Mutex MidiChannelMapMutex
Used to protect the MidiChannelMap from being used at the same time by different threads.
void DispatchPitchbend(int Pitch, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a pitchbend event arrived,...
void DispatchChannelPressure(uint8_t Value, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a channel pressure event arrived (a....
SynchronizedConfig< MidiChannelMap_t > MidiChannelMap
Contains the list of connected engines for each MIDI channel, where index 0 points to the list of eng...
void DispatchNoteOn(uint8_t Key, uint8_t Velocity, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a note on event arrived,...
SynchronizedConfig< MidiChannelMap_t >::Reader MidiChannelMapReader
MIDI thread access to MidiChannelMap.
std::map< String, DeviceRuntimeParameter * > Parameters
All port parameters.
int expectedEventSize(unsigned char byte)
Takes a MIDI status byte (the first byte of each MIDI event) as argument and returns the expected siz...
SynchronizedConfig< std::vector< uint8_t > > noteOnVelocityFilter
void DispatchPolyphonicKeyPressure(uint8_t Key, uint8_t Value, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a polyphonic key pressure event arriv...
SynchronizedConfig< std::vector< VirtualMidiDevice * > > virtualMidiDevices
void DispatchBankSelectLsb(uint8_t BankLsb, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a MIDI bank select LSB (Least Signifi...
SynchronizedConfig< std::vector< uint8_t > >::Reader noteOnVelocityFilterReader
SynchronizedConfig< std::set< Engine * > >::Reader SysexListenersReader
MIDI thread access to SysexListeners.
void DispatchProgramChange(uint8_t Program, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a program change event arrived.
std::map< String, DeviceRuntimeParameter * > PortParameters()
Return all parameter settings of this MIDI port.
std::set< EngineChannel * > MidiChannelMap_t[17]
void SetNoteOnVelocityFilter(const std::vector< uint8_t > &filter)
Registers the given filter to be applied against all note on events, adjusting their MIDI velocity da...
void DispatchRaw(uint8_t *pData)
Helper function for MIDI input devices that have the MIDI data as raw bytes.
void DispatchNoteOff(uint8_t Key, uint8_t Velocity, uint MidiChannel)
Should be called by the implementing MIDI input device whenever a note off event arrived,...
MidiInputDevice * GetDevice()
Return MIDI device where this MIDI port belongs to.
static bool RemoveSysexListener(Engine *engine)
Removes engine from list of engines getting sysex messages.
SynchronizedConfig< std::vector< VirtualMidiDevice * > >::Reader virtualMidiDevicesReader
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...
Thread-safe management of configuration data, where the data is updated by a single non real time thr...
Light-weight MIDI interface (for MIDI in & out) intended to be used by pure software MIDI "devices",...
#define OVERRIDE
Definition global.h:84
std::string String
Definition global.h:44
midi_chan_t
MIDI channels.
Definition midi.h:34