diff --git a/src/Compress/Compress.cpp b/src/Compress/Compress.cpp index 178dd46..7251649 100644 --- a/src/Compress/Compress.cpp +++ b/src/Compress/Compress.cpp @@ -14,10 +14,10 @@ CompressModule::CompressModule() config(Params::NUM_PARAMS, Inputs::NUM_INPUTS, Outputs::NUM_OUTPUTS, Lights::NUM_LIGHTS); - configCCParam(EMCC_CompressorThreshold, false, this, P_COMP_THRESHOLD, IN_COMP_THRESHOLD, P_COMP_THRESHOLD_REL, L_COMP_THRESHOLD_REL, 0.f, 127.f, 127.f, "Threshold", "%", 0.f, 100.f/127.f)->snapEnabled = true; - configCCParam(EMCC_CompressorAttack, false, this, P_COMP_ATTACK, IN_COMP_ATTACK, P_COMP_ATTACK_REL, L_COMP_ATTACK_REL, 0.f, 127.f, 64.f, "Attack", "%", 0.f, 100.f/127.f)->snapEnabled = true; - configCCParam(EMCC_CompressorRatio, false, this, P_COMP_RATIO, IN_COMP_RATIO, P_COMP_RATIO_REL, L_COMP_RATIO_REL, 0.f, 127.f, 64.f, "Ratio", "%", 0.f, 100.f/127.f)->snapEnabled = true; - configCCParam(EMCC_CompressorMix, false, this, P_COMP_MIX, IN_COMP_MIX, P_COMP_MIX_REL, L_COMP_MIX_REL, 0.f, 127.f, 0.f, "Mix", "%", 0.f, 100.f/127.f)->snapEnabled = true; + configCCParam0(EMCC_CompressorThreshold, false, this, P_COMP_THRESHOLD, IN_COMP_THRESHOLD, P_COMP_THRESHOLD_REL, L_COMP_THRESHOLD_REL, 0.f, 127.f, 127.f, "Threshold", "", 0.f, 1.f)->snapEnabled = true; + configCCParam0(EMCC_CompressorAttack, false, this, P_COMP_ATTACK, IN_COMP_ATTACK, P_COMP_ATTACK_REL, L_COMP_ATTACK_REL, 0.f, 127.f, 64.f, "Attack", "", 0.f, 1.f)->snapEnabled = true; + configCCParam0(EMCC_CompressorRatio, false, this, P_COMP_RATIO, IN_COMP_RATIO, P_COMP_RATIO_REL, L_COMP_RATIO_REL, 0.f, 127.f, 64.f, "Ratio", "", 0.f, 1.f)->snapEnabled = true; + configCCParam0(EMCC_CompressorMix, false, this, P_COMP_MIX, IN_COMP_MIX, P_COMP_MIX_REL, L_COMP_MIX_REL, 0.f, 127.f, 0.f, "Mix", "%", 0.f, 100.f/127.f); configInput(IN_COMP_THRESHOLD, "Compression threshold"); configInput(IN_COMP_ATTACK, "Compression attack"); diff --git a/src/HC-1/HC-1-midi.cpp b/src/HC-1/HC-1-midi.cpp index b98f1a8..6878511 100644 --- a/src/HC-1/HC-1-midi.cpp +++ b/src/HC-1/HC-1-midi.cpp @@ -154,6 +154,42 @@ void Hc1Module::onChannel16CC(uint8_t cc, uint8_t value) } } break; + + case EMCC_CompressorThreshold: + if (value != em.compressor.threshold) { + em.compressor.threshold = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorAttack: + if (value != em.compressor.attack) { + em.compressor.attack = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorRatio: + if (value != em.compressor.ratio) { + em.compressor.ratio = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorMix: + if (value != em.compressor.mix) { + em.compressor.mix = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; case EMCC_DataStream: { switch (value) { @@ -255,69 +291,6 @@ void Hc1Module::onChannel16CC(uint8_t cc, uint8_t value) } break; - case EMCC_CompressorThreshold: - if (value != em.compressor.threshold) { - em.compressor.threshold = value; - if (!in_preset) { - notifyCompressorChanged(); - } - } - break; - - case EMCC_CompressorAttack: - if (value != em.compressor.attack) { - em.compressor.attack = value; - if (!in_preset) { - notifyCompressorChanged(); - } - } - break; - - case EMCC_CompressorRatio: - if (value != em.compressor.ratio) { - em.compressor.ratio = value; - if (!in_preset) { - notifyCompressorChanged(); - } - } - break; - - case EMCC_CompressorMix: - if (value != em.compressor.mix) { - em.compressor.mix = value; - if (!in_preset) { - notifyCompressorChanged(); - } - } - break; - - case EMCC_TiltEq: - if (value != em.tilt_eq.tilt) { - em.tilt_eq.tilt = value; - if (!in_preset) { - notifyTiltEqChanged(); - } - } - break; - - case EMCC_TiltEqFrequency: - if (value != em.tilt_eq.frequency) { - em.tilt_eq.frequency = value; - if (!in_preset) { - notifyTiltEqChanged(); - } - } - break; - - case EMCC_TiltEqMix: - if (value != em.tilt_eq.mix) { - em.tilt_eq.mix = value; - if (!in_preset) { - notifyTiltEqChanged(); - } - } - break; - case EMCC_VersionHigh: em.firmware_version = value; break; @@ -609,6 +582,70 @@ void Hc1Module::onChannelOneCC(uint8_t cc, uint8_t value) notifyRoundingChanged(); } } break; + + case EMCC_TiltEq: + if (value != em.tilt_eq.tilt) { + em.tilt_eq.tilt = value; + if (!in_preset) { + notifyTiltEqChanged(); + } + } + break; + + case EMCC_TiltEqFrequency: + if (value != em.tilt_eq.frequency) { + em.tilt_eq.frequency = value; + if (!in_preset) { + notifyTiltEqChanged(); + } + } + break; + + case EMCC_TiltEqMix: + if (value != em.tilt_eq.mix) { + em.tilt_eq.mix = value; + if (!in_preset) { + notifyTiltEqChanged(); + } + } + break; + + + case EMCC_CompressorThreshold: + if (value != em.compressor.threshold) { + em.compressor.threshold = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorAttack: + if (value != em.compressor.attack) { + em.compressor.attack = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorRatio: + if (value != em.compressor.ratio) { + em.compressor.ratio = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; + + case EMCC_CompressorMix: + if (value != em.compressor.mix) { + em.compressor.mix = value; + if (!in_preset) { + notifyCompressorChanged(); + } + } + break; case MidiCC_AllSoundOff: onSoundOff(); break; } @@ -658,7 +695,7 @@ void Hc1Module::onMidiMessage(uMidiMessage umsg) onChannelOneMessage(msg); break; - case EM_KentonChannel: // 13 (channel 14) + case 13: // 13 (channel 14) break; case EM_MatrixChannel: // 14 (channel 15) diff --git a/src/HC-1/HC-1.cpp b/src/HC-1/HC-1.cpp index b44ee93..74003c2 100644 --- a/src/HC-1/HC-1.cpp +++ b/src/HC-1/HC-1.cpp @@ -23,11 +23,11 @@ Hc1Module::Hc1Module() configCCParam(em_midi::EMCC_iv, true, this, M4_PARAM, M4_INPUT, M4_REL_PARAM, M4_REL_LIGHT, 0.f, EM_Max14f, EM_Max14f/2.f, "iv"); configCCParam(em_midi::EMCC_v, true, this, M5_PARAM, M5_INPUT, M5_REL_PARAM, M5_REL_LIGHT, 0.f, EM_Max14f, EM_Max14f/2.f, "v"); configCCParam(em_midi::EMCC_vi, true, this, M6_PARAM, M6_INPUT, M6_REL_PARAM, M6_REL_LIGHT, 0.f, EM_Max14f, EM_Max14f/2.f, "vi"); - configCCParam(em_midi::EMCC_R1, false, this, R1_PARAM, R1_INPUT, R1_REL_PARAM, R1_REL_LIGHT, 0.f, 127.f, 64.f, "R1", "", 0.f, 1.f); - configCCParam(em_midi::EMCC_R2, false, this, R2_PARAM, R2_INPUT, R2_REL_PARAM, R2_REL_LIGHT, 0.f, 127.f, 64.f, "R2", "", 0.f, 1.f); - configCCParam(em_midi::EMCC_R3, false, this, R3_PARAM, R3_INPUT, R3_REL_PARAM, R3_REL_LIGHT, 0.f, 127.f, 64.f, "R3", "", 0.f, 1.f); - configCCParam(em_midi::EMCC_R4, false, this, R4_PARAM, R4_INPUT, R4_REL_PARAM, R4_REL_LIGHT, 0.f, 127.f, 64.f, "R4", "", 0.f, 1.f); - configCCParam(em_midi::EMCC_RMIX, false, this, RMIX_PARAM, RMIX_INPUT, RMIX_REL_PARAM, RMIX_REL_LIGHT, 0.f, 127.f, 64.f, "Recirculator Mix", "", 0.f, 1.f); + configCCParam(em_midi::EMCC_R1, false, this, R1_PARAM, R1_INPUT, R1_REL_PARAM, R1_REL_LIGHT, 0.f, 127.f, 64.f, "R1", "", 0.f, 1.f)->snapEnabled = true; + configCCParam(em_midi::EMCC_R2, false, this, R2_PARAM, R2_INPUT, R2_REL_PARAM, R2_REL_LIGHT, 0.f, 127.f, 64.f, "R2", "", 0.f, 1.f)->snapEnabled = true; + configCCParam(em_midi::EMCC_R3, false, this, R3_PARAM, R3_INPUT, R3_REL_PARAM, R3_REL_LIGHT, 0.f, 127.f, 64.f, "R3", "", 0.f, 1.f)->snapEnabled = true; + configCCParam(em_midi::EMCC_R4, false, this, R4_PARAM, R4_INPUT, R4_REL_PARAM, R4_REL_LIGHT, 0.f, 127.f, 64.f, "R4", "", 0.f, 1.f)->snapEnabled = true; + configCCParam(em_midi::EMCC_RMIX, false, this, RMIX_PARAM, RMIX_INPUT, RMIX_REL_PARAM, RMIX_REL_LIGHT, 0.f, 127.f, 64.f, "Recirculator Mix", "", 0.f, 1.f)->snapEnabled = true; configCCParam(em_midi::EMCC_PostLevel, true, this, VOLUME_PARAM, VOLUME_INPUT, VOLUME_REL_PARAM, VOLUME_REL_LIGHT, 0.f, EM_Max14f, EM_Max14f/2.f, "Post level"); configSwitch(M1_REL_PARAM, 0.f, 1.f, 0.f, "Macro i relative-CV", {"off", "on"}); diff --git a/src/Round/Round.cpp b/src/Round/Round.cpp index 987e1af..baeb6fa 100644 --- a/src/Round/Round.cpp +++ b/src/Round/Round.cpp @@ -11,8 +11,8 @@ RoundModule::RoundModule() configInput(Inputs::IN_ROUND_RATE, "Round rate"); - auto p = configCCParam(EMCC_RoundRate, false, this, Params::P_ROUND_RATE, Inputs::IN_ROUND_RATE, Params::P_ROUND_RATE_REL, Lights::L_ROUND_RATE_REL, 0.f, 127.f, 0.f, "Round rate"); - p->snapEnabled = true; + configCCParam0(EMCC_RoundRate, false, this, Params::P_ROUND_RATE, Inputs::IN_ROUND_RATE, Params::P_ROUND_RATE_REL, Lights::L_ROUND_RATE_REL, 0.f, 127.f, 0.f, "Round rate", "", 0.f, 1.f) + ->snapEnabled = true; configSwitch(P_ROUND_RATE_REL, 0.f, 1.f, 0.f, "Round rate CV-relative", offon); configSwitch(P_ROUND_INITIAL, 0.f, 1.f, 0.f, "Round initial", offon); configInput(Inputs::IN_ROUND_INITIAL, "Round initial trigger"); diff --git a/src/Tilt/Tilt.cpp b/src/Tilt/Tilt.cpp index 0e59a63..dcf2bac 100644 --- a/src/Tilt/Tilt.cpp +++ b/src/Tilt/Tilt.cpp @@ -14,9 +14,9 @@ TiltModule::TiltModule() std::vector offon = {"off", "on"}; config(Params::NUM_PARAMS, Inputs::NUM_INPUTS, Outputs::NUM_OUTPUTS, Lights::NUM_LIGHTS); - configCCParam(EMCC_TiltEq, false, this, P_TEQ_TILT, IN_TEQ_TILT, P_TEQ_TILT_REL, L_TEQ_TILT_REL, 0.f, 127.f, 64.f, "Tilt", "", 0.f, 1.f)->snapEnabled = true; - configCCParam(EMCC_TiltEqFrequency, false, this, P_TEQ_FREQ, IN_TEQ_FREQ, P_TEQ_FREQ_REL, L_TEQ_FREQ_REL, 0.f, 127.f, 64.f, "Frequency", "%", 0.f, 100.f/127.f)->snapEnabled = true; - configCCParam(EMCC_TiltEqMix, false, this, P_TEQ_MIX, IN_TEQ_MIX, P_TEQ_MIX_REL, L_TEQ_MIX_REL, 0.f, 127.f, 0.f, "Mix", "%", 0.f, 100.f/127.f)->snapEnabled = true; + configCCParam0(EMCC_TiltEq, false, this, P_TEQ_TILT, IN_TEQ_TILT, P_TEQ_TILT_REL, L_TEQ_TILT_REL, 0.f, 127.f, 64.f, "Tilt", "", 0.f, 1.f)->snapEnabled = true; + configCCParam0(EMCC_TiltEqFrequency, false, this, P_TEQ_FREQ, IN_TEQ_FREQ, P_TEQ_FREQ_REL, L_TEQ_FREQ_REL, 0.f, 127.f, 64.f, "Frequency", "", 0.f, 1.f)->snapEnabled = true; + configCCParam0(EMCC_TiltEqMix, false, this, P_TEQ_MIX, IN_TEQ_MIX, P_TEQ_MIX_REL, L_TEQ_MIX_REL, 0.f, 127.f, 0.f, "Mix", "%", 0.f, 100.f/127.f)->snapEnabled = true; configInput(IN_TEQ_TILT, "Tilt EQ Tilt"); configInput(IN_TEQ_FREQ, "Tilt EQ Frequency"); diff --git a/src/em_midi.hpp b/src/em_midi.hpp index 8aa230c..eeb36da 100644 --- a/src/em_midi.hpp +++ b/src/em_midi.hpp @@ -220,7 +220,6 @@ constexpr const uint8_t EMCC_MPE = 127; // value = polyphony constexpr const uint8_t EM_MasterChannel = 0; constexpr const uint8_t EM_MPE1Channel = 1; -constexpr const uint8_t EM_KentonChannel = 13; constexpr const uint8_t EM_MatrixChannel = 14; constexpr const uint8_t EM_SettingsChannel = 15; diff --git a/src/widgets/cc_param.hpp b/src/widgets/cc_param.hpp index 309e4e4..b17148b 100644 --- a/src/widgets/cc_param.hpp +++ b/src/widgets/cc_param.hpp @@ -11,6 +11,7 @@ using namespace em_midi; struct CCParamQuantity : rack::engine::ParamQuantity { uint8_t cc = 0; // never a valid cc for param + uint8_t send_channel = EM_SettingsChannel; uint16_t last_value = 0; bool high_resolution = true; bool enabled = true; @@ -57,12 +58,12 @@ struct CCParamQuantity : rack::engine::ParamQuantity if (high_resolution) { uint8_t lo = to_send & 0x7f; if (lo) { - iSend->sendControlChange(EM_SettingsChannel, EMCC_PedalFraction, lo); + iSend->sendControlChange(send_channel, EMCC_PedalFraction, lo); } uint8_t hi = to_send >> 7; - iSend->sendControlChange(EM_SettingsChannel, cc, hi); + iSend->sendControlChange(send_channel, cc, hi); } else { - iSend->sendControlChange(EM_SettingsChannel, cc, to_send & 0x7f); + iSend->sendControlChange(send_channel, cc, to_send & 0x7f); } } } @@ -120,6 +121,13 @@ TCCPQ* configCCParam(uint8_t cc, bool hiRes, Module* module, int paramId, int in return q; } +template +TCCPQ* configCCParam0(uint8_t cc, bool hiRes, Module* module, int paramId, int inputId, int relativeParamId, int lightId, float minValue, float maxValue, float defaultValue, std::string name = "", std::string unit = "%", float displayBase = 0.f, float displayMultiplier = 100.f/EM_Max14f, float displayOffset = 0.f) +{ + auto p = configCCParam(cc, hiRes, module, paramId, inputId, relativeParamId, lightId, minValue, maxValue, defaultValue, name, unit, displayBase, displayMultiplier, displayOffset); + p->send_channel = 0; + return p; +} const NVGcolor connected_track_color = nvgRGB(0x73, 0x5d, 0x26);