From 5bc88a0b8f5685d282d3110f7b0a23cffe6f5bb4 Mon Sep 17 00:00:00 2001 From: Paul Dempsey Date: Tue, 17 Oct 2023 13:20:00 -0700 Subject: [PATCH] Improve hc-1 pedal feedback, fix tip, cc29,30 stub --- src/HC-1/HC-1-draw.cpp | 20 ++++++++++++-------- src/Pedals/Pedals.cpp | 2 +- src/em_midi.hpp | 4 ++-- src/em_types/em_pedal.cpp | 9 ++++++++- src/em_types/em_pedal.hpp | 3 ++- src/widgets/pedal_param.hpp | 2 ++ 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/HC-1/HC-1-draw.cpp b/src/HC-1/HC-1-draw.cpp index 003d559..d65b3fe 100644 --- a/src/HC-1/HC-1-draw.cpp +++ b/src/HC-1/HC-1-draw.cpp @@ -210,20 +210,24 @@ void drawPedalKnobAssignment(NVGcontext * vg, uint8_t ped, const char * text) } } -void drawPedalAssignment(NVGcontext* vg, float x, float y, char ped_char, uint8_t ped, uint8_t ped_value) +void Hc1ModuleWidget::drawPedalAssignment( + NVGcontext* vg, float x, float y, + char ped_char, uint8_t ped, uint8_t ped_value) { - auto text = format_string("p%c %s", ped_char, ShortPedalAssignment(ped).c_str()); nvgTextAlign(vg, NVGalign::NVG_ALIGN_LEFT); - nvgText(vg, PRESET_RIGHT + 1.f, y, text.c_str(), nullptr); - Line(vg, x, y+1, x, y+1 - (ped_value * 10.f / 255.f), GetStockColor(StockColor::Sea_green_Dark), 1.5f); + auto text = format_string("p%c %s", ped_char, ShortPedalAssignment(ped).c_str()); + nvgText(vg, x, y, text.c_str(), nullptr); + y += 3.f; + Line(vg, x, y, x + ((ped_value * (box.size.x - x - 3.f)) / 127.f), y, + GetStockColor(StockColor::Sea_green_Dark), 2.25f); } void Hc1ModuleWidget::drawPedals(NVGcontext* vg, std::shared_ptr font, bool stockPedals) { SetTextStyle(vg, font, RampGray(G_85), 10.f); if (stockPedals) { - drawPedalAssignment(vg, box.size.x - 3.f, PRESET_BOTTOM - 18.f, '1', 64, 0); - drawPedalAssignment(vg, box.size.x - 3.f, PRESET_BOTTOM - 4.5f, '2', 66, 0); + drawPedalAssignment(vg, PRESET_RIGHT + 1.f, PRESET_BOTTOM - 19.f, '1', 64, 0); + drawPedalAssignment(vg, PRESET_RIGHT + 1.f, PRESET_BOTTOM - 4.5f, '2', 66, 0); } else { auto ped1 = my_module->pedal1.cc; auto ped2 = my_module->pedal2.cc; @@ -233,8 +237,8 @@ void Hc1ModuleWidget::drawPedals(NVGcontext* vg, std::shared_ptrpedal1.value); - drawPedalAssignment(vg, box.size.x - 3.f, PRESET_BOTTOM - 4.5f, '2', ped2, my_module->pedal2.value); + drawPedalAssignment(vg, PRESET_RIGHT + 1.f, PRESET_BOTTOM - 19.f, '1', ped1, my_module->pedal1.value); + drawPedalAssignment(vg, PRESET_RIGHT + 1.f, PRESET_BOTTOM - 4.5f, '2', ped2, my_module->pedal2.value); } } diff --git a/src/Pedals/Pedals.cpp b/src/Pedals/Pedals.cpp index 88023d9..47ac7fc 100644 --- a/src/Pedals/Pedals.cpp +++ b/src/Pedals/Pedals.cpp @@ -9,7 +9,7 @@ PedalCore::PedalCore(uint8_t pedal) configPedalParam(pedal_id, PedalAssign::Sustain, this, Params::P_PEDAL_ASSIGN); - auto p = configParam(P_PEDAL_VALUE, 0.f, 127.f, 0.f, format_string("Pedal %d value", pedal_id)); + auto p = configParam(P_PEDAL_VALUE, 0.f, 127.f, 0.f, format_string("Pedal %d value", 1 + pedal_id)); p->snapEnabled = true; configInput(Inputs::I_PEDAL_VALUE, "Pedal"); diff --git a/src/em_midi.hpp b/src/em_midi.hpp index 160d54f..0f314de 100644 --- a/src/em_midi.hpp +++ b/src/em_midi.hpp @@ -129,8 +129,8 @@ constexpr const uint8_t EMCC_RoundRate = 25; constexpr const uint8_t EMCC_PreLevel = 26; constexpr const uint8_t EMCC_Attenuation = 27; constexpr const uint8_t EMCC_RoundInitial = 28; -constexpr const uint8_t EMCC_Pedal1 = 29; -constexpr const uint8_t EMCC_Pedal2 = 30; +constexpr const uint8_t EMCC_Jack1 = 29; +constexpr const uint8_t EMCC_Jack2 = 30; constexpr const uint8_t EMCC_Advance = 31; //127 next, 64=next layer constexpr const uint8_t EMCC_Category = 32; diff --git a/src/em_types/em_pedal.cpp b/src/em_types/em_pedal.cpp index 575e4ca..bfb3670 100644 --- a/src/em_types/em_pedal.cpp +++ b/src/em_types/em_pedal.cpp @@ -28,7 +28,8 @@ std::string ShortPedalAssignment(uint8_t pedalcc) case 26: return "Pre"; case 27: return "Att"; // not in HE menu case 28: return "RIn"; - + case 29: return "PJ1"; // not in HE menu + case 30: return "PJ2"; // not in HE menu case 31: return "Adv"; case 64: return "Sus"; @@ -64,6 +65,8 @@ std::string LongPedalAssignment(uint8_t pedalcc) case 26: return "Pre level"; case 27: return "Attenuation"; // not in HE menu case 28: return "Round Initial"; + case 29: return "Pedal Jack 1"; // not in HE menu + case 30: return "Pedal Jack 2"; // not in HE menu case 31: return "Preset advance"; case 64: return "Sustain"; case 65: return "Round Equal"; @@ -85,6 +88,8 @@ PedalAssign PedalAssignFromCC(uint8_t cc) case EMCC_PreLevel: return PedalAssign::PreLevel; case EMCC_PostLevel: return PedalAssign::PostLevel; case EMCC_AudioInLevel: return PedalAssign::AudioInputLevel; + //case EMCC_Jack1: return PedalAssign::Jack1; + //case EMCC_Jack2: return PedalAssign::Jack2; //case EMCC_Attenuation: return PedalAssign::Attenuation; case EMCC_Sustain: return PedalAssign::Sustain; case EMCC_Sostenuto: return PedalAssign::Sostenuto; @@ -119,6 +124,8 @@ uint8_t PedalCC(PedalAssign assign) case PedalAssign::PreLevel: return EMCC_PreLevel; case PedalAssign::PostLevel: return EMCC_PostLevel; case PedalAssign::AudioInputLevel: return EMCC_AudioInLevel; + //case PedalAssign::Jack1: return EMCC_Jack1; + //case PedalAssign::Jack2: return EMCC_Jack2; //case PedalAssign::Attenuation: return EMCC_Attenuation; case PedalAssign::Sustain: return EMCC_Sustain; case PedalAssign::Sostenuto: return EMCC_Sostenuto; diff --git a/src/em_types/em_pedal.hpp b/src/em_types/em_pedal.hpp index 0c0acc1..0dfa179 100644 --- a/src/em_types/em_pedal.hpp +++ b/src/em_types/em_pedal.hpp @@ -23,7 +23,8 @@ enum class PedalAssign : uint8_t PostLevel, AudioInputLevel, //Attenuation, // can be set/sent, but does not behave - + // Jack1, + // Jack2, // found in BeautifulPursuit, but not sent when configured Sustain, Sostenuto, Sostenuto2, diff --git a/src/widgets/pedal_param.hpp b/src/widgets/pedal_param.hpp index e246482..d55674c 100644 --- a/src/widgets/pedal_param.hpp +++ b/src/widgets/pedal_param.hpp @@ -175,6 +175,8 @@ struct PedalKnob : SmallBlackKnob menu->addChild(createPedalMenuItem(PedalAssign::RoundEqual)); })); menu->addChild(createPedalMenuItem(PedalAssign::FineTune)); + //menu->addChild(createPedalMenuItem(PedalAssign::Jack1)); + //menu->addChild(createPedalMenuItem(PedalAssign::Jack2)); menu->addChild(createSubmenuItem("Extensions", "", [=](Menu * menu) { menu->addChild(createPedalMenuItem(PedalAssign::Expression));