LinuxSampler::MidiInputPort Class Reference

#include <MidiInputPort.h>

List of all members.

Classes

class  ParameterName
 MIDI Port Parameter 'NAME'. More...

Public Member Functions

void Connect (EngineChannel *pEngineChannel, midi_chan_t MidiChannel)
 Connect given sampler engine channel with this MIDI input device.
void Disconnect (EngineChannel *pEngineChannel)
 Disconnect given sampler engine channel from this MIDI input device.
MidiInputDeviceGetDevice ()
 Return MIDI device where this MIDI port belongs to.
uint GetPortNumber ()
 Return port number with which this MIDI port is registered to the MIDI device.
std::map< String,
DeviceRuntimeParameter * > 
PortParameters ()
 Return all parameter settings of this MIDI port.
void Connect (VirtualMidiDevice *pDevice)
 Connects the given virtual MIDI device to this MIDI input device.
void Disconnect (VirtualMidiDevice *pDevice)
 Disconnect the previously connected virtual MIDI device.
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, this will cause the note on event to be forwarded to all connected engines on the corresponding MIDI channel.
void DispatchNoteOn (uint8_t Key, uint8_t Velocity, uint MidiChannel, int32_t FragmentPos)
 Should be called by the implementing MIDI input device whenever a note on event arrived, this will cause the note on event to be forwarded to all connected engines on the corresponding MIDI channel.
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, this will cause the note off event to be forwarded to all connected engines on the corresponding MIDI channel.
void DispatchNoteOff (uint8_t Key, uint8_t Velocity, uint MidiChannel, int32_t FragmentPos)
 Should be called by the implementing MIDI input device whenever a note off event arrived, this will cause the note off event to be forwarded to all connected engines on the corresponding MIDI channel.
void DispatchPitchbend (int Pitch, uint MidiChannel)
 Should be called by the implementing MIDI input device whenever a pitchbend event arrived, this will cause the pitchbend event to be forwarded to all connected engines.
void DispatchPitchbend (int Pitch, uint MidiChannel, int32_t FragmentPos)
 Should be called by the implementing MIDI input device whenever a pitchbend event arrived, this will cause the pitchbend event to be forwarded to all connected engines.
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, this will cause the control change event to be forwarded to all engines on the corresponding MIDI channel.
void DispatchControlChange (uint8_t Controller, uint8_t Value, uint MidiChannel, int32_t FragmentPos)
 Should be called by the implementing MIDI input device whenever a control change event arrived, this will cause the control change event to be forwarded to all engines on the corresponding MIDI channel.
void DispatchProgramChange (uint8_t Program, uint MidiChannel)
 Should be called by the implementing MIDI input device whenever a program change event arrived.
void DispatchBankSelectMsb (uint8_t BankMsb, uint MidiChannel)
void DispatchBankSelectLsb (uint8_t BankLsb, uint MidiChannel)
void DispatchSysex (void *pData, uint Size)
 Should be called by the implementing MIDI input device whenever a system exclusive message arrived, this will cause the message to be forwarded to all connected engines.
void DispatchRaw (uint8_t *pData)
 Helper function for MIDI input devices that have the MIDI data as raw bytes.
void DispatchRaw (uint8_t *pData, int32_t FragmentPos)
 Helper function for MIDI input devices that have the MIDI data as raw bytes.

Static Public Member Functions

static void AddSysexListener (Engine *engine)
 Registers that an engine wants to have sysex messages.
static bool RemoveSysexListener (Engine *engine)
 Removes engine from list of engines getting sysex messages.

Protected Types

typedef std::set< EngineChannel * > MidiChannelMap_t [17]

Protected Member Functions

 MidiInputPort (MidiInputDevice *pDevice, int portNumber)
 Constructor.
virtual ~MidiInputPort ()
 Destructor.

Protected Attributes

MidiInputDevicepDevice
int portNumber
std::map< String,
DeviceRuntimeParameter * > 
Parameters
 All port parameters.
SynchronizedConfig
< MidiChannelMap_t
MidiChannelMap
 Contains the list of connected engines for each MIDI channel, where index 0 points to the list of engines which are connected to all MIDI channels. Usually it's not necessary for the descendant to use this map, instead it should just use the Dispatch* methods.
SynchronizedConfig
< MidiChannelMap_t >::Reader 
MidiChannelMapReader
 MIDI thread access to MidiChannelMap.
Mutex MidiChannelMapMutex
 Used to protect the MidiChannelMap from being used at the same time by different threads.
SynchronizedConfig< std::set
< Engine * > >::Reader 
SysexListenersReader
 MIDI thread access to SysexListeners.
SynchronizedConfig
< std::vector
< VirtualMidiDevice * > > 
virtualMidiDevices
SynchronizedConfig
< std::vector
< VirtualMidiDevice * >
>::Reader 
virtualMidiDevicesReader
Mutex virtualMidiDevicesMutex

Friends

class MidiInputDevice


Detailed Description

Definition at line 43 of file MidiInputPort.h.


Member Typedef Documentation

Definition at line 336 of file MidiInputPort.h.


Constructor & Destructor Documentation

LinuxSampler::MidiInputPort::MidiInputPort ( MidiInputDevice pDevice,
int  portNumber 
) [protected]

Constructor.

virtual LinuxSampler::MidiInputPort::~MidiInputPort (  )  [protected, virtual]

Destructor.


Member Function Documentation

static void LinuxSampler::MidiInputPort::AddSysexListener ( Engine engine  )  [static]

Registers that an engine wants to have sysex messages.

void LinuxSampler::MidiInputPort::Connect ( VirtualMidiDevice pDevice  ) 

Connects the given virtual MIDI device to this MIDI input device.

This can be used to listen to MIDI data arriving on the MIDI input device's MIDI ports, e.g. to show an MIDI activity indicator somewhere.

void LinuxSampler::MidiInputPort::Connect ( EngineChannel pEngineChannel,
midi_chan_t  MidiChannel 
)

Connect given sampler engine channel with this MIDI input device.

The engine channel can either be connected to one specific MIDI channel or all MIDI channels. If an engine channel gets connected twice to this MIDI input device, then the engine's old connection will be detached (no matter on which MIDI channel).

Parameters:
pEngineChannel - sampler engine
MidiChannel - MIDI channel to connect to
Exceptions:
MidiInputException if MidiChannel argument invalid

void LinuxSampler::MidiInputPort::Disconnect ( VirtualMidiDevice pDevice  ) 

Disconnect the previously connected virtual MIDI device.

void LinuxSampler::MidiInputPort::Disconnect ( EngineChannel pEngineChannel  ) 

Disconnect given sampler engine channel from this MIDI input device.

If the given engine channel was not connected with this device, nothing happens.

Parameters:
pEngineChannel - sampler engine

void LinuxSampler::MidiInputPort::DispatchBankSelectLsb ( uint8_t  BankLsb,
uint  MidiChannel 
)

void LinuxSampler::MidiInputPort::DispatchBankSelectMsb ( uint8_t  BankMsb,
uint  MidiChannel 
)

void LinuxSampler::MidiInputPort::DispatchControlChange ( uint8_t  Controller,
uint8_t  Value,
uint  MidiChannel,
int32_t  FragmentPos 
)

Should be called by the implementing MIDI input device whenever a control change event arrived, this will cause the control change event to be forwarded to all engines on the corresponding MIDI channel.

This method is meant for offline rendering and / or in case the exact fragment position of the event is already known.

Parameters:
Controller - MIDI controller number
Value - MIDI control change value
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)
FragmentPos - event's sample point position in the current audio fragment

void LinuxSampler::MidiInputPort::DispatchControlChange ( uint8_t  Controller,
uint8_t  Value,
uint  MidiChannel 
)

Should be called by the implementing MIDI input device whenever a control change event arrived, this will cause the control change event to be forwarded to all engines on the corresponding MIDI channel.

This method is meant for realtime rendering, this way an event is immediately created with the current system time as time stamp.

Parameters:
Controller - MIDI controller number
Value - MIDI control change value
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)

void LinuxSampler::MidiInputPort::DispatchNoteOff ( uint8_t  Key,
uint8_t  Velocity,
uint  MidiChannel,
int32_t  FragmentPos 
)

Should be called by the implementing MIDI input device whenever a note off event arrived, this will cause the note off event to be forwarded to all connected engines on the corresponding MIDI channel.

This method is meant for offline rendering and / or in case the exact fragment position of the event is already known.

Parameters:
Key - MIDI key number of the released key
Velocity - MIDI velocity of the released key
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)
FragmentPos - event's sample point position in the current audio fragment

void LinuxSampler::MidiInputPort::DispatchNoteOff ( uint8_t  Key,
uint8_t  Velocity,
uint  MidiChannel 
)

Should be called by the implementing MIDI input device whenever a note off event arrived, this will cause the note off event to be forwarded to all connected engines on the corresponding MIDI channel.

This method is meant for realtime rendering, this way an event is immediately created with the current system time as time stamp.

Parameters:
Key - MIDI key number of the released key
Velocity - MIDI velocity of the released key
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)

void LinuxSampler::MidiInputPort::DispatchNoteOn ( uint8_t  Key,
uint8_t  Velocity,
uint  MidiChannel,
int32_t  FragmentPos 
)

Should be called by the implementing MIDI input device whenever a note on event arrived, this will cause the note on event to be forwarded to all connected engines on the corresponding MIDI channel.

This method is meant for offline rendering and / or in case the exact fragment position of the event is already known.

Parameters:
Key - MIDI key number of the triggered key
Velocity - MIDI velocity of the triggered key
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)
FragmentPos - event's sample point position in the current audio fragment

void LinuxSampler::MidiInputPort::DispatchNoteOn ( uint8_t  Key,
uint8_t  Velocity,
uint  MidiChannel 
)

Should be called by the implementing MIDI input device whenever a note on event arrived, this will cause the note on event to be forwarded to all connected engines on the corresponding MIDI channel.

This method is meant for realtime rendering, this way an event is immediately created with the current system time as time stamp.

Parameters:
Key - MIDI key number of the triggered key
Velocity - MIDI velocity of the triggered key
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)

void LinuxSampler::MidiInputPort::DispatchPitchbend ( int  Pitch,
uint  MidiChannel,
int32_t  FragmentPos 
)

Should be called by the implementing MIDI input device whenever a pitchbend event arrived, this will cause the pitchbend event to be forwarded to all connected engines.

This method is meant for offline rendering and / or in case the exact fragment position of the event is already known.

Parameters:
Pitch - MIDI pitch value
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)
FragmentPos - event's sample point position in the current audio fragment

void LinuxSampler::MidiInputPort::DispatchPitchbend ( int  Pitch,
uint  MidiChannel 
)

Should be called by the implementing MIDI input device whenever a pitchbend event arrived, this will cause the pitchbend event to be forwarded to all connected engines.

This method is meant for realtime rendering, this way an event is immediately created with the current system time as time stamp.

Parameters:
Pitch - MIDI pitch value
MidiChannel - MIDI channel on which event occured on (low level indexing, means 0..15)

void LinuxSampler::MidiInputPort::DispatchProgramChange ( uint8_t  Program,
uint  MidiChannel 
)

Should be called by the implementing MIDI input device whenever a program change event arrived.

In case the respective sampler channel(s) are enabled for MIDI instrument mapping, the respective sampler engine and instrument will be loaded on the connected sampler channel(s) as defined by the respective entry in the MIDI instrument map.

Note: the MIDI instrument map is empty by default on sampler startup. It has to be explicitly filled with entries and the sampler channel(s) have to be enabled for a certain MIDI instrument table, otherwise program change messages are ignored!

Parameters:
Program - MIDI program change number
MidiChannel - MIDI channel on which this program change occured
See also:
MidiInstrumentMapper

void LinuxSampler::MidiInputPort::DispatchRaw ( uint8_t *  pData,
int32_t  FragmentPos 
)

Helper function for MIDI input devices that have the MIDI data as raw bytes.

Parameters:
pData - pointer to the raw MIDI data
FragmentPos - event's sample point position in the current audio fragment

void LinuxSampler::MidiInputPort::DispatchRaw ( uint8_t *  pData  ) 

Helper function for MIDI input devices that have the MIDI data as raw bytes.

Parameters:
pData - pointer to the raw MIDI data

void LinuxSampler::MidiInputPort::DispatchSysex ( void *  pData,
uint  Size 
)

Should be called by the implementing MIDI input device whenever a system exclusive message arrived, this will cause the message to be forwarded to all connected engines.

Parameters:
pData - pointer to the sysex data
Size - length of the sysex data (in bytes)

MidiInputDevice* LinuxSampler::MidiInputPort::GetDevice (  ) 

Return MIDI device where this MIDI port belongs to.

uint LinuxSampler::MidiInputPort::GetPortNumber (  ) 

Return port number with which this MIDI port is registered to the MIDI device.

std::map<String,DeviceRuntimeParameter*> LinuxSampler::MidiInputPort::PortParameters (  ) 

Return all parameter settings of this MIDI port.

static bool LinuxSampler::MidiInputPort::RemoveSysexListener ( Engine engine  )  [static]

Removes engine from list of engines getting sysex messages.

Returns:
true if engine was removed, false if it wasn't present in the list.


Friends And Related Function Documentation

friend class MidiInputDevice [friend]

Definition at line 355 of file MidiInputPort.h.


Member Data Documentation

Contains the list of connected engines for each MIDI channel, where index 0 points to the list of engines which are connected to all MIDI channels. Usually it's not necessary for the descendant to use this map, instead it should just use the Dispatch* methods.

Definition at line 337 of file MidiInputPort.h.

Used to protect the MidiChannelMap from being used at the same time by different threads.

Definition at line 339 of file MidiInputPort.h.

MIDI thread access to MidiChannelMap.

Definition at line 338 of file MidiInputPort.h.

All port parameters.

Definition at line 335 of file MidiInputPort.h.

Definition at line 333 of file MidiInputPort.h.

Definition at line 334 of file MidiInputPort.h.

SynchronizedConfig<std::set<Engine*> >::Reader LinuxSampler::MidiInputPort::SysexListenersReader [protected]

MIDI thread access to SysexListeners.

Definition at line 340 of file MidiInputPort.h.

SynchronizedConfig<std::vector<VirtualMidiDevice*> > LinuxSampler::MidiInputPort::virtualMidiDevices [protected]

Definition at line 341 of file MidiInputPort.h.

Definition at line 343 of file MidiInputPort.h.

SynchronizedConfig<std::vector<VirtualMidiDevice*> >::Reader LinuxSampler::MidiInputPort::virtualMidiDevicesReader [protected]

Definition at line 342 of file MidiInputPort.h.


The documentation for this class was generated from the following file:

doxygen