Skip to content

Commit

Permalink
Channel0 controls, units
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Dempsey committed Feb 16, 2024
1 parent 33ca2f8 commit 16c3921
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 82 deletions.
8 changes: 4 additions & 4 deletions src/Compress/Compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
165 changes: 101 additions & 64 deletions src/HC-1/HC-1-midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/HC-1/HC-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"});
Expand Down
4 changes: 2 additions & 2 deletions src/Round/Round.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions src/Tilt/Tilt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ TiltModule::TiltModule()
std::vector<std::string> 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");
Expand Down
1 change: 0 additions & 1 deletion src/em_midi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 11 additions & 3 deletions src/widgets/cc_param.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -120,6 +121,13 @@ TCCPQ* configCCParam(uint8_t cc, bool hiRes, Module* module, int paramId, int in

return q;
}
template <class TCCPQ = CCParamQuantity>
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);

Expand Down

0 comments on commit 16c3921

Please sign in to comment.