Deluge Firmware 1.3.0
Build date: 2026.07.15
Loading...
Searching...
No Matches
MidiFollow Class Referencefinal

Public Member Functions

void writeDefaultsToFile ()
void readDefaultsFromFile ()
 read defaults from XML
ModelStackWithAutoParamgetModelStackWithParam (ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId, bool displayError=true)
void noteMessageReceived (MIDICable &cable, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack)
OutputsendNoteToClip (MIDICable &cable, Clip *clip, MIDIMatchType match, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack, bool updateClipForLastNoteReceived=true)
void midiCCReceived (MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t ccValue, bool *doingMidiThru, ModelStack *modelStack)
void pitchBendReceived (MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, bool *doingMidiThru, ModelStack *modelStack)
void aftertouchReceived (MIDICable &cable, int32_t channel, int32_t value, int32_t noteCode, bool *doingMidiThru, ModelStack *modelStack)
void clearStoredClips ()
void removeClip (Clip *clip)
int32_t getCCFromParam (deluge::modulation::params::Kind paramKind, int32_t paramID)
bool isGlobalEffectableContext ()
MIDIFollowChannelType getChannelTypeForFeedback ()
void sendCCWithoutModelStackForMidiFollowFeedback (int32_t channel, bool isAutomation=false)
void sendCCForMidiFollowFeedback (int32_t channel, int32_t ccNumber, int32_t knobPos)
 called when updating parameter values using mod (gold) encoders or the select encoder in the soundEditor menu
void handleReceivedCC (MIDICable &cable, ModelStackWithTimelineCounter &modelStack, Clip *clip, int32_t ccNumber, int32_t ccValue)

Public Attributes

std::array< uint8_t, kMaxMIDIValue+1 > ccToSoundParam
std::array< uint8_t, kMaxMIDIValue+1 > ccToGlobalParam
std::array< uint8_t, params::UNPATCHED_START+params::UNPATCHED_SOUND_MAX_NUM > soundParamToCC
std::array< uint8_t, params::UNPATCHED_GLOBAL_MAX_NUM > globalParamToCC
int32_t previousKnobPos [kMaxMIDIValue+1]
uint32_t timeLastCCSent [kMaxMIDIValue+1]
uint32_t timeAutomationFeedbackLastSent

Private Member Functions

void init ()
void initState ()
void clearMappings ()
void initDefaultMappings ()
OutputnoteMessageReceivedForSelectedOrActiveClip (MIDICable &cable, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack)
void noteMessageReceivedForSpecificTrack (MIDICable &cable, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack, Output *specific_track, int32_t specific_track_index)
OutputmidiCCReceivedForSelectedOrActiveClip (MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t ccValue, bool *doingMidiThru, ModelStack *modelStack)
void midiCCReceivedForSpecificTrack (MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t ccValue, bool *doingMidiThru, ModelStack *modelStack, Output *specific_track, int32_t specific_track_index)
OutputpitchBendReceivedForSelectedOrActiveClip (MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, bool *doingMidiThru, ModelStack *modelStack)
void pitchBendReceivedForSpecificTrack (MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, bool *doingMidiThru, ModelStack *modelStack, Output *specific_track, int32_t specific_track_index)
OutputaftertouchReceivedForSelectedOrActiveClip (MIDICable &cable, int32_t channel, int32_t value, int32_t noteCode, bool *doingMidiThru, ModelStack *modelStack)
void aftertouchReceivedForSpecificTrack (MIDICable &cable, int32_t channel, int32_t value, int32_t noteCode, bool *doingMidiThru, ModelStack *modelStack, Output *specific_track, int32_t specific_track_index)
ClipgetSelectedOrActiveClip ()
ClipgetSelectedClip ()
ClipgetActiveClip (ModelStack *modelStack)
const size_t getTrackCount () const
 used to forward midi messages to specific tracks
OutputgetTrackFromIndex (uint32_t trackIndex, uint32_t maxTrack)
 used to forward midi messages to specific tracks
ModelStackWithAutoParamgetModelStackWithParamForSong (ModelStackWithThreeMainThings *modelStackWithThreeMainThings, int32_t soundParamId, int32_t globalParamId)
ModelStackWithAutoParamgetModelStackWithParamForClip (ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId)
ModelStackWithAutoParamgetModelStackWithParamForSynthClip (ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId)
ModelStackWithAutoParamgetModelStackWithParamForKitClip (ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId)
ModelStackWithAutoParamgetModelStackWithParamForAudioClip (ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId)
void displayParamControlError (int32_t soundParamId, int32_t globalParamId)
MIDIMatchType checkMidiFollowMatch (MIDICable &cable, uint8_t channel)
MIDIMatchType checkMidiFollowMatchForSpecificTrack (MIDICable &cable, uint8_t channel, int32_t specific_track_index)
bool isFeedbackEnabled ()
void writeDefaultMappingsToFile (Serializer &writer)
 convert paramID to a paramName to write to XML
void writeDefaultSettingsToFile (Serializer &writer)
 write default settings (channels, kit root note, feedback, display param) to XML
void writeChannelSettingsToFile (Serializer &writer)
 Write Channel settings to XML.
void writeSpecificChannelSettingsToFile (Serializer &writer, MIDIFollowChannelType type)
 Write Specific Channel settings to XML.
void writeKitRootNoteSettingToFile (Serializer &writer)
 Write Kit Root Note setting to XML.
void writeFeedbackSettingsToFile (Serializer &writer)
 Write Feedback settings to XML.
void writeDisplayParamSettingToFile (Serializer &writer)
 Write Display Param setting to XML.
void readDefaultMappingsFromFile (Deserializer &reader)
void readDefaultSettingsFromFile (Deserializer &reader)
 read default settings (channels, kit root note, feedback, display param) from XML
void readChannelSettingsFromFile (Deserializer &reader)
 Read Channel settings from XML.
void readSpecificChannelSettingsFromFile (Deserializer &reader, MIDIFollowChannelType type)
 Read Specific Channel settings from XML.
void readKitRootNoteSettingFromFile (Deserializer &reader)
 Read Kit Root Note setting from XML.
void readFeedbackSettingsFromFile (Deserializer &reader)
 Read Feedback settings from XML.
void readDisplayParamSettingFromFile (Deserializer &reader)
 Read Display Param setting from XML.
char const * getNameFromChannelType (MIDIFollowChannelType type)
 enum / string lookup functions
MIDIFollowChannelType getChannelTypeFromName (char const *name)
char const * getNameFromFeedbackAutomationMode (MIDIFollowFeedbackAutomationMode mode)
MIDIFollowFeedbackAutomationMode getFeedbackAutomationModeFromName (char const *name)
char const * getNameFromBool (bool value)
bool getBoolFromName (char const *name)

Private Attributes

bool successfullyReadDefaultsFromFile

Member Function Documentation

◆ aftertouchReceived()

void MidiFollow::aftertouchReceived ( MIDICable & cable,
int32_t channel,
int32_t value,
int32_t noteCode,
bool * doingMidiThru,
ModelStack * modelStack )

called from playback handler determines whether aftertouch received is midi follow relevant and should be routed to the active context or a specific track for further processing

◆ aftertouchReceivedForSelectedOrActiveClip()

Output * MidiFollow::aftertouchReceivedForSelectedOrActiveClip ( MIDICable & cable,
int32_t channel,
int32_t value,
int32_t noteCode,
bool * doingMidiThru,
ModelStack * modelStack )
private

determines whether aftertouch received is midi follow relevant and should be routed to the active context for further processing

◆ aftertouchReceivedForSpecificTrack()

void MidiFollow::aftertouchReceivedForSpecificTrack ( MIDICable & cable,
int32_t channel,
int32_t value,
int32_t noteCode,
bool * doingMidiThru,
ModelStack * modelStack,
Output * specific_track,
int32_t specific_track_index )
private

determines whether aftertouch received is midi follow relevant and should be routed to a specific track for further processing

◆ checkMidiFollowMatch()

MIDIMatchType MidiFollow::checkMidiFollowMatch ( MIDICable & cable,
uint8_t channel )
private

obtain match to check if device is compatible with the midi follow channel a valid match is passed through to the instruments for further evaluation used with regular midi follow channels A/B/C

◆ checkMidiFollowMatchForSpecificTrack()

MIDIMatchType MidiFollow::checkMidiFollowMatchForSpecificTrack ( MIDICable & cable,
uint8_t channel,
int32_t specific_track_index )
private

obtain match to check if device is compatible with the midi follow channel a valid match is passed through to the instruments for further evaluation used with midi follow channels for specific tracks 1-16

◆ clearStoredClips()

void MidiFollow::clearStoredClips ( )

initializes the clipForLastNoteReceived array called when swapping songs to make sure that you aren't using clips from the old song

◆ getActiveClip()

Clip * MidiFollow::getActiveClip ( ModelStack * modelStack)
private

returns activeClip for the selected output special case for note and performance data where you want to let notes, midi modulation sources (e.g. mod wheel), and MPE through to the active clip

◆ getCCFromParam()

int32_t MidiFollow::getCCFromParam ( deluge::modulation::params::Kind paramKind,
int32_t paramID )

a parameter can be learned to one cc at a time for a given parameter, find and return the cc that has been learned (if any) for the current midi follow controllable context if no cc is found, then MIDI_CC_NONE (255) is returned

◆ getModelStackWithParam()

ModelStackWithAutoParam * MidiFollow::getModelStackWithParam ( ModelStackWithTimelineCounter * modelStackWithTimelineCounter,
Clip * clip,
int32_t soundParamId,
int32_t globalParamId,
bool displayError = true )

based on the current context, as determined by clip returned from the getSelectedClip function obtain the modelStackWithParam for that context and return it so it can be used by midi follow

◆ getSelectedClip()

Clip * MidiFollow::getSelectedClip ( )
private

see if you are pressing and holding a clip in arranger view, song row view, song grid view see if you are pressing and holding audition pad in arranger view, arranger perf view, or arranger automation view if you're in a clip, this will return that clip

◆ getSelectedOrActiveClip()

Clip * MidiFollow::getSelectedOrActiveClip ( )
private

checks to see if there is an active clip for the current context cases where there is an active clip: 1) pressing and holding a clip pad in arranger view, song row view, song grid view 2) pressing and holding the audition pad of a row in arranger view and in arranger performance view, arranger automation view 3) entering a clip or previousy held a clip

◆ handleReceivedCC()

void MidiFollow::handleReceivedCC ( MIDICable & cable,
ModelStackWithTimelineCounter & modelStackWithTimelineCounter,
Clip * clip,
int32_t ccNumber,
int32_t ccValue )

checks if the ccNumber received has been learned to any parameters in midi learning view if the cc has been learned, it sets the new value for that parameter this function works by first checking the active context to see if there is an active clip to determine if the cc intends to control a song level or clip level parameter

◆ isGlobalEffectableContext()

bool MidiFollow::isGlobalEffectableContext ( )

Check if midi follow is controlling the global effectable context if so, we should only be controlling the global effectable parameters

◆ midiCCReceived()

void MidiFollow::midiCCReceived ( MIDICable & cable,
uint8_t channel,
uint8_t ccNumber,
uint8_t ccValue,
bool * doingMidiThru,
ModelStack * modelStack )

called from playback handler determines whether a midi cc received is midi follow relevant and should be routed to the active context or a specific track for further processing

◆ midiCCReceivedForSelectedOrActiveClip()

Output * MidiFollow::midiCCReceivedForSelectedOrActiveClip ( MIDICable & cable,
uint8_t channel,
uint8_t ccNumber,
uint8_t ccValue,
bool * doingMidiThru,
ModelStack * modelStack )
private

determines whether a midi cc received is midi follow relevant and should be routed to the active context for further processing

◆ midiCCReceivedForSpecificTrack()

void MidiFollow::midiCCReceivedForSpecificTrack ( MIDICable & cable,
uint8_t channel,
uint8_t ccNumber,
uint8_t ccValue,
bool * doingMidiThru,
ModelStack * modelStack,
Output * specific_track,
int32_t specific_track_index )
private

determines whether a midi cc received is midi follow relevant and should be routed to a specific track for further processing

◆ noteMessageReceived()

void MidiFollow::noteMessageReceived ( MIDICable & cable,
bool on,
int32_t channel,
int32_t note,
int32_t velocity,
bool * doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack * modelStack )

called from playback handler determines whether a note message received is midi follow relevant and should be routed to the active context or a specific track for further processing

◆ noteMessageReceivedForSelectedOrActiveClip()

Output * MidiFollow::noteMessageReceivedForSelectedOrActiveClip ( MIDICable & cable,
bool on,
int32_t channel,
int32_t note,
int32_t velocity,
bool * doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack * modelStack )
private

determines whether a midi note received is midi follow relevant and should be routed to the active context for further processing

◆ noteMessageReceivedForSpecificTrack()

void MidiFollow::noteMessageReceivedForSpecificTrack ( MIDICable & cable,
bool on,
int32_t channel,
int32_t note,
int32_t velocity,
bool * doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack * modelStack,
Output * specific_track,
int32_t specific_track_index )
private

determines whether a midi note received is midi follow relevant and should be routed to a specific track for further processing

◆ pitchBendReceived()

void MidiFollow::pitchBendReceived ( MIDICable & cable,
uint8_t channel,
uint8_t data1,
uint8_t data2,
bool * doingMidiThru,
ModelStack * modelStack )

called from playback handler determines whether a pitch bend received is midi follow relevant and should be routed to the active context or a specific track for further processing

◆ pitchBendReceivedForSelectedOrActiveClip()

Output * MidiFollow::pitchBendReceivedForSelectedOrActiveClip ( MIDICable & cable,
uint8_t channel,
uint8_t data1,
uint8_t data2,
bool * doingMidiThru,
ModelStack * modelStack )
private

determines whether a pitch bend received is midi follow relevant and should be routed to the active context for further processing

◆ pitchBendReceivedForSpecificTrack()

void MidiFollow::pitchBendReceivedForSpecificTrack ( MIDICable & cable,
uint8_t channel,
uint8_t data1,
uint8_t data2,
bool * doingMidiThru,
ModelStack * modelStack,
Output * specific_track,
int32_t specific_track_index )
private

determines whether a pitch bend received is midi follow relevant and should be routed to a specific track for further processing

◆ readDefaultMappingsFromFile()

void MidiFollow::readDefaultMappingsFromFile ( Deserializer & reader)
private

compares param name tag to the list of params available are midi controllable if param is found, it loads the CC mapping info for that param into the view

◆ removeClip()

void MidiFollow::removeClip ( Clip * clip)

removes a specific clip pointer from the clipForLastNoteReceived array if a clip is deleted, it should be removed from this array to ensure note off's don't get sent to delete clips

◆ sendCCWithoutModelStackForMidiFollowFeedback()

void MidiFollow::sendCCWithoutModelStackForMidiFollowFeedback ( int32_t channel,
bool isAutomation = false )

called when updating the context, e.g. switching from song to clip, changing instruments presets, peeking a clip in song view this function: 1) checks the active context 2) sets up the model stack for that context 3) checks what parameters have been learned and obtains the model stack for those params 4) sends midi feedback of the current parameter value to the cc numbers learned to those parameters

◆ writeDefaultsToFile()

void MidiFollow::writeDefaultsToFile ( )

create default XML file and write defaults I should check if file exists before creating one


The documentation for this class was generated from the following files:
  • src/deluge/io/midi/midi_follow.h
  • src/deluge/io/midi/midi_follow.cpp