OpenWareLaboratory
MidiPolyphonicExpressionProcessor< SynthVoice, VOICES > Class Template Reference

Implementation of MPE (MIDI Polyphonic Expression) message processing. More...

Inheritance diagram for MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >:
Collaboration diagram for MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >:

Public Member Functions

void allNotesOff ()
 
void allNotesOn ()
 
void channelPressure (MidiMessage msg)
 
void controlChange (MidiMessage msg)
 
uint8_t findFreeVoice (MidiMessage msg)
 
uint8_t getNoteChannel (MidiMessage msg)
 
float getPitchBendRange ()
 
bool getSustain ()
 
float getTuning ()
 
SynthVoice * getVoice (size_t index)
 
bool isMasterChannel (MidiMessage msg)
 
 MidiPolyphonicExpressionProcessor ()
 
virtual void modulate (MidiMessage msg)
 
void noteOff (MidiMessage msg)
 
void noteOn (MidiMessage msg)
 
void pitchbend (MidiMessage msg)
 
void polyKeyPressure (MidiMessage msg)
 
virtual void process (MidiMessage msg)
 
void releaseVoicesForNote (MidiMessage msg)
 
void rpn (uint16_t id, uint8_t msb, uint8_t lsb, MidiMessage msg)
 
void setDynamicRange (float range)
 Set the MIDI velocity dynamic range in dB, default 72dB. More...
 
void setModulationDepthRange (float range)
 Set modulation depth range, from 0 to 1.0. More...
 
void setParameter (uint8_t parameter_id, float value)
 
void setPitchBendRange (float range)
 Set pitch bend range in semitones. More...
 
void setSustain (bool value)
 
void setTuning (float frequency)
 
void setVoice (size_t index, SynthVoice *obj)
 
void sustain (MidiMessage msg)
 
void sustainOff ()
 
virtual ~MidiPolyphonicExpressionProcessor ()
 

Protected Member Functions

void release (uint8_t ch)
 
void take (uint8_t ch, MidiMessage msg)
 

Static Protected Member Functions

static float frequencyToNote (float freq)
 
static float noteToFrequency (float note)
 

Protected Attributes

uint16_t allocated
 
uint16_t allocation [VOICES]
 
bool dosustain = false
 
uint8_t master_channel = 1
 
float mod_range = 0.5/127.0f
 
float modulation [VOICES]
 
float note_pitchbend_range = 48
 
uint8_t notes [VOICES]
 
float pb_range = 2/8192.0f
 
float pressure [VOICES]
 
uint16_t rpn_id = 0
 
uint8_t rpn_msb = 0
 
uint8_t tuning_semitones = 69
 
SynthVoice * voice [VOICES]
 
float zone_modulation = 0
 
float zone_pitchbend = 0
 
float zone_pressure = 0
 

Static Protected Attributes

static const uint16_t TAKEN = 0xffff
 

Detailed Description

template<class SynthVoice, int VOICES>
class MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >

Implementation of MPE (MIDI Polyphonic Expression) message processing.

We are controlling an AbstractSynth with: X: Pitch Bend: setFrequency() Y: CC74 or CC1 : setModulation() Z: Channel Pressure : setPressure()

Definition at line 16 of file MidiPolyphonicExpressionProcessor.h.

Constructor & Destructor Documentation

◆ MidiPolyphonicExpressionProcessor()

template<class SynthVoice , int VOICES>
MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::MidiPolyphonicExpressionProcessor ( )
inline

Definition at line 46 of file MidiPolyphonicExpressionProcessor.h.

◆ ~MidiPolyphonicExpressionProcessor()

template<class SynthVoice , int VOICES>
virtual MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::~MidiPolyphonicExpressionProcessor ( )
inlinevirtual

Definition at line 47 of file MidiPolyphonicExpressionProcessor.h.

Member Function Documentation

◆ allNotesOff()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::allNotesOff ( )
inlineinherited

◆ allNotesOn()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::allNotesOn ( )
inlineinherited

Definition at line 58 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ channelPressure()

◆ controlChange()

◆ findFreeVoice()

◆ frequencyToNote()

template<class SynthVoice , int VOICES>
static float VoiceAllocator< SynthVoice, VOICES >::frequencyToNote ( float  freq)
inlinestaticprotectedinherited

Definition at line 17 of file VoiceAllocator.h.

◆ getNoteChannel()

◆ getPitchBendRange()

template<class SynthVoice , int VOICES>
float VoiceAllocator< SynthVoice, VOICES >::getPitchBendRange ( )
inlineinherited

◆ getSustain()

template<class SynthVoice , int VOICES>
bool VoiceAllocator< SynthVoice, VOICES >::getSustain ( )
inlineinherited

Definition at line 78 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::dosustain.

◆ getTuning()

template<class SynthVoice , int VOICES>
float VoiceAllocator< SynthVoice, VOICES >::getTuning ( )
inlineinherited

Definition at line 46 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ getVoice()

template<class SynthVoice , int VOICES>
SynthVoice* VoiceAllocator< SynthVoice, VOICES >::getVoice ( size_t  index)
inlineinherited

Definition at line 66 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ isMasterChannel()

◆ modulate()

virtual void MidiProcessor::modulate ( MidiMessage  msg)
inlinevirtualinherited

◆ noteOff()

◆ noteOn()

◆ noteToFrequency()

template<class SynthVoice , int VOICES>
static float VoiceAllocator< SynthVoice, VOICES >::noteToFrequency ( float  note)
inlinestaticprotectedinherited

Definition at line 14 of file VoiceAllocator.h.

Referenced by VoiceAllocator< SynthVoice, VOICES >::rpn().

◆ pitchbend()

◆ polyKeyPressure()

template<class SynthVoice , int VOICES>
void MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::polyKeyPressure ( MidiMessage  msg)
inlinevirtual

◆ process()

◆ release()

◆ releaseVoicesForNote()

◆ rpn()

◆ setDynamicRange()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setDynamicRange ( float  range)
inlineinherited

Set the MIDI velocity dynamic range in dB, default 72dB.

Definition at line 42 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ setModulationDepthRange()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setModulationDepthRange ( float  range)
inlineinherited

Set modulation depth range, from 0 to 1.0.

Definition at line 35 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

Referenced by VoiceAllocator< SynthVoice, VOICES >::rpn().

◆ setParameter()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setParameter ( uint8_t  parameter_id,
float  value 
)
inlineinherited

Definition at line 71 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ setPitchBendRange()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setPitchBendRange ( float  range)
inlineinherited

Set pitch bend range in semitones.

Does not update the frequency; effective from next pitch bend change

Definition at line 28 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

Referenced by MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::rpn(), and VoiceAllocator< SynthVoice, VOICES >::rpn().

◆ setSustain()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setSustain ( bool  value)
inlineinherited

◆ setTuning()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setTuning ( float  frequency)
inlineinherited

◆ setVoice()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::setVoice ( size_t  index,
SynthVoice *  obj 
)
inlineinherited

Definition at line 62 of file VoiceAllocator.h.

References VoiceAllocator< SynthVoice, VOICES >::voice.

◆ sustain()

template<class SynthVoice , int VOICES>
void VoiceAllocator< SynthVoice, VOICES >::sustain ( MidiMessage  msg)
inlinevirtualinherited

◆ sustainOff()

◆ take()

Field Documentation

◆ allocated

template<class SynthVoice , int VOICES>
uint16_t MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::allocated
protected

◆ allocation

◆ dosustain

◆ master_channel

◆ mod_range

template<class SynthVoice , int VOICES>
float VoiceAllocator< SynthVoice, VOICES >::mod_range = 0.5/127.0f
protectedinherited

◆ modulation

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::modulation[VOICES]
protected

◆ note_pitchbend_range

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::note_pitchbend_range = 48
protected

◆ notes

◆ pb_range

template<class SynthVoice , int VOICES>
float VoiceAllocator< SynthVoice, VOICES >::pb_range = 2/8192.0f
protectedinherited

Definition at line 8 of file VoiceAllocator.h.

◆ pressure

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::pressure[VOICES]
protected

◆ rpn_id

template<class SynthVoice , int VOICES>
uint16_t VoiceAllocator< SynthVoice, VOICES >::rpn_id = 0
protectedinherited

◆ rpn_msb

template<class SynthVoice , int VOICES>
uint8_t VoiceAllocator< SynthVoice, VOICES >::rpn_msb = 0
protectedinherited

◆ TAKEN

template<class SynthVoice , int VOICES>
const uint16_t MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::TAKEN = 0xffff
staticprotected

◆ tuning_semitones

template<class SynthVoice , int VOICES>
uint8_t VoiceAllocator< SynthVoice, VOICES >::tuning_semitones = 69
protectedinherited

Definition at line 13 of file VoiceAllocator.h.

Referenced by VoiceAllocator< SynthVoice, VOICES >::rpn().

◆ voice

template<class SynthVoice , int VOICES>
SynthVoice* VoiceAllocator< SynthVoice, VOICES >::voice[VOICES]
protectedinherited

Definition at line 7 of file VoiceAllocator.h.

Referenced by VoiceAllocator< SynthVoice, VOICES >::allNotesOff(), VoiceAllocator< SynthVoice, VOICES >::allNotesOn(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::channelPressure(), PolyphonicProcessor< SynthVoice, VOICES >::channelPressure(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::controlChange(), VoiceAllocator< SynthVoice, VOICES >::getPitchBendRange(), VoiceAllocator< SynthVoice, VOICES >::getTuning(), VoiceAllocator< SynthVoice, VOICES >::getVoice(), PolyphonicProcessor< SynthVoice, VOICES >::modulate(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::pitchbend(), PolyphonicProcessor< SynthVoice, VOICES >::pitchbend(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::polyKeyPressure(), PolyphonicProcessor< SynthVoice, VOICES >::polyKeyPressure(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::release(), PolyphonicProcessor< SynthVoice, VOICES >::release(), VoiceAllocator< SynthVoice, VOICES >::setDynamicRange(), VoiceAllocator< SynthVoice, VOICES >::setModulationDepthRange(), VoiceAllocator< SynthVoice, VOICES >::setParameter(), VoiceAllocator< SynthVoice, VOICES >::setPitchBendRange(), VoiceAllocator< SynthVoice, VOICES >::setTuning(), VoiceAllocator< SynthVoice, VOICES >::setVoice(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::sustainOff(), PolyphonicProcessor< SynthVoice, VOICES >::sustainOff(), MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::take(), and PolyphonicProcessor< SynthVoice, VOICES >::take().

◆ zone_modulation

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::zone_modulation = 0
protected

◆ zone_pitchbend

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::zone_pitchbend = 0
protected

◆ zone_pressure

template<class SynthVoice , int VOICES>
float MidiPolyphonicExpressionProcessor< SynthVoice, VOICES >::zone_pressure = 0
protected

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