20#include "definitions_cxx.hpp"
21#include "model/global_effectable/global_effectable.h"
22#include "modulation/params/param.h"
23#include "storage/storage_manager.h"
24#include "util/containers.h"
36enum class MIDIMatchType;
40class MidiFollow final {
43 void factoryReset(
bool showPopup =
true);
49 Clip* clip, int32_t soundParamId, int32_t globalParamId,
50 bool displayError =
true);
52 bool* doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack* modelStack);
53 Output* sendNoteToClip(
MIDICable& cable,
Clip* clip, MIDIMatchType match,
bool on, int32_t channel, int32_t note,
54 int32_t velocity,
bool* doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack* modelStack,
55 bool updateClipForLastNoteReceived =
true);
70 std::array<uint8_t, kMaxMIDIValue + 1> ccToSoundParam;
71 std::array<uint8_t, kMaxMIDIValue + 1> ccToGlobalParam;
72 std::array<uint8_t, params::UNPATCHED_START + params::UNPATCHED_SOUND_MAX_NUM> soundParamToCC;
73 std::array<uint8_t, params::UNPATCHED_GLOBAL_MAX_NUM> globalParamToCC;
75 int32_t previousKnobPos[kMaxMIDIValue + 1];
76 uint32_t timeLastCCSent[kMaxMIDIValue + 1];
77 uint32_t timeAutomationFeedbackLastSent;
80 bool isFeedbackEnabled();
93 void initDefaultMappings();
97 int32_t velocity,
bool* doingMidiThru,
98 bool shouldRecordNotesNowNow,
ModelStack* modelStack);
100 bool* doingMidiThru,
bool shouldRecordNotesNowNow,
ModelStack* modelStack,
101 Output* specific_track, int32_t specific_track_index);
107 int32_t specific_track_index);
114 int32_t specific_track_index);
118 int32_t noteCode,
bool* doingMidiThru,
ModelStack* modelStack);
121 int32_t specific_track_index);
131 int32_t soundParamId, int32_t globalParamId);
133 Clip* clip, int32_t soundParamId, int32_t globalParamId);
136 int32_t soundParamId, int32_t globalParamId);
139 int32_t soundParamId, int32_t globalParamId);
142 int32_t soundParamId, int32_t globalParamId);
143 void displayParamControlError(int32_t soundParamId, int32_t globalParamId);
148 static constexpr size_t kMaxMIDIFollowFeedbackTargets = 2;
149 using FeedbackChannelTypes = std::array<MIDIFollowChannelType, kMaxMIDIFollowFeedbackTargets>;
151 MIDIFollowChannelType getChannelTypeForTrackFeedback();
153 MIDIFollowChannelType feedbackChannelType);
156 int32_t ccNumber, int32_t knobPos);
174 bool successfullyReadDefaultsFromFile;
191 MIDIFollowChannelType getChannelTypeFromName(
char const* name);
193 char const* getNameFromFeedbackChannelType(MIDIFollowFeedbackChannelType type);
194 MIDIFollowFeedbackChannelType getFeedbackChannelTypeFromName(
char const* name);
196 char const* getNameFromFeedbackAutomationMode(MIDIFollowFeedbackAutomationMode mode);
197 MIDIFollowFeedbackAutomationMode getFeedbackAutomationModeFromName(
char const* name);
199 char const* getNameFromBool(
bool value);
200 bool getBoolFromName(
char const* name);
Definition audio_clip.h:35
Definition storage_manager.h:190
Definition instrument_clip.h:52
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:96
Definition midi_follow.h:40
void writeFeedbackSettingsToFile(Serializer &writer)
Write Feedback settings to XML.
Definition midi_follow.cpp:1816
Clip * getSelectedClip()
Definition midi_follow.cpp:419
void completeLegacyFlashMigration(bool defaultsWereWritten)
Definition midi_follow.cpp:1836
size_t getChannelTypesForFeedback(FeedbackChannelTypes &feedbackChannelTypes)
Definition midi_follow.cpp:1245
bool addChannelTypeForFeedback(FeedbackChannelTypes &feedbackChannelTypes, size_t &numChannelTypes, MIDIFollowChannelType feedbackChannelType)
Definition midi_follow.cpp:1206
int32_t getCCFromParam(deluge::modulation::params::Kind paramKind, int32_t paramID)
Definition midi_follow.cpp:675
void writeKitRootNoteSettingToFile(Serializer &writer)
Write Kit Root Note setting to XML.
Definition midi_follow.cpp:1809
const size_t getTrackCount() const
used to forward midi messages to specific tracks
Definition midi_follow.cpp:479
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)
Definition midi_follow.cpp:808
void writeSpecificChannelSettingsToFile(Serializer &writer, MIDIFollowChannelType type)
Write Specific Channel settings to XML.
Definition midi_follow.cpp:1789
MIDIMatchType checkMidiFollowMatch(MIDICable &cable, uint8_t channel)
Definition midi_follow.cpp:1627
Clip * getSelectedOrActiveClip()
Definition midi_follow.cpp:395
Clip * getActiveClip(ModelStack *modelStack)
Definition midi_follow.cpp:459
void writeChannelSettingsToFile(Serializer &writer)
Write Channel settings to XML.
Definition midi_follow.cpp:1766
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)
Definition midi_follow.cpp:1598
void writeDefaultMappingsToFile(Serializer &writer)
convert paramID to a paramName to write to XML
Definition midi_follow.cpp:1691
void readDefaultSettingsFromFile(Deserializer &reader)
read default settings (channels, kit root note, feedback, display param) from XML
Definition midi_follow.cpp:1949
void removeClip(Clip *clip)
Definition midi_follow.cpp:730
void readDefaultsFromFile()
read defaults from XML
Definition midi_follow.cpp:1845
Output * pitchBendReceivedForSelectedOrActiveClip(MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:1460
ModelStackWithAutoParam * getModelStackWithParam(ModelStackWithTimelineCounter *modelStackWithTimelineCounter, Clip *clip, int32_t soundParamId, int32_t globalParamId, bool displayError=true)
Definition midi_follow.cpp:513
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)
Definition midi_follow.cpp:981
void pitchBendReceived(MIDICable &cable, uint8_t channel, uint8_t data1, uint8_t data2, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:1429
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)
Definition midi_follow.cpp:1499
bool writeDefaultsToFile()
Definition midi_follow.cpp:1661
Output * midiCCReceivedForSelectedOrActiveClip(MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t ccValue, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:910
Output * noteMessageReceivedForSelectedOrActiveClip(MIDICable &cable, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack)
Definition midi_follow.cpp:772
void handleReceivedCC(MIDICable &cable, ModelStackWithTimelineCounter &modelStack, Clip *clip, int32_t ccNumber, int32_t ccValue)
Definition midi_follow.cpp:1059
void midiCCReceived(MIDICable &cable, uint8_t channel, uint8_t ccNumber, uint8_t ccValue, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:880
char const * getNameFromChannelType(MIDIFollowChannelType type)
enum / string lookup functions
Definition midi_follow.cpp:2069
void noteMessageReceived(MIDICable &cable, bool on, int32_t channel, int32_t note, int32_t velocity, bool *doingMidiThru, bool shouldRecordNotesNowNow, ModelStack *modelStack)
Definition midi_follow.cpp:741
void readDefaultMappingsFromFile(Deserializer &reader)
Definition midi_follow.cpp:1907
void readChannelSettingsFromFile(Deserializer &reader)
Read Channel settings from XML.
Definition midi_follow.cpp:1973
void clearStoredClips()
Definition midi_follow.cpp:721
void readKitRootNoteSettingFromFile(Deserializer &reader)
Read Kit Root Note setting from XML.
Definition midi_follow.cpp:2008
void aftertouchReceived(MIDICable &cable, int32_t channel, int32_t value, int32_t noteCode, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:1528
bool isGlobalEffectableContext()
Definition midi_follow.cpp:696
MIDIMatchType checkMidiFollowMatchForSpecificTrack(MIDICable &cable, uint8_t channel, int32_t specific_track_index)
Definition midi_follow.cpp:1641
Output * getTrackFromIndex(uint32_t trackIndex, uint32_t maxTrack)
used to forward midi messages to specific tracks
Definition midi_follow.cpp:493
void readDisplayParamSettingFromFile(Deserializer &reader)
Read Display Param setting from XML.
Definition midi_follow.cpp:2054
void readSpecificChannelSettingsFromFile(Deserializer &reader, MIDIFollowChannelType type)
Read Specific Channel settings from XML.
Definition midi_follow.cpp:1987
void readFeedbackSettingsFromFile(Deserializer &reader)
Read Feedback settings from XML.
Definition midi_follow.cpp:2024
void writeDisplayParamSettingToFile(Serializer &writer)
Write Display Param setting to XML.
Definition midi_follow.cpp:1825
void sendCCWithoutModelStackForMidiFollowFeedback(bool isAutomation=false)
Definition midi_follow.cpp:1306
void writeDefaultSettingsToFile(Serializer &writer)
write default settings (channels, kit root note, feedback, display param) to XML
Definition midi_follow.cpp:1731
void sendCCForMidiFollowFeedback(int32_t ccNumber, int32_t knobPos)
Resolve the configured MIDI Follow feedback targets and send a learned CC value to each one.
Definition midi_follow.cpp:1393
Output * aftertouchReceivedForSelectedOrActiveClip(MIDICable &cable, int32_t channel, int32_t value, int32_t noteCode, bool *doingMidiThru, ModelStack *modelStack)
Definition midi_follow.cpp:1559
Definition model_stack.h:264
Definition model_stack.h:227
Definition model_stack.h:129
Definition model_stack.h:123
Definition storage_manager.h:124
Kind
Definition param.h:42