Skip to content

Commit

Permalink
Strip HC-4 down to HC-One module scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Dempsey committed Oct 5, 2023
1 parent 8e169ce commit 80970a7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
20 changes: 5 additions & 15 deletions src/HC-4/HC-4-ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,13 @@ Hc4ModuleWidget::Hc4ModuleWidget(Hc4Module * module)
device_label = createStaticTextLabel<StaticTextLabel>(
Vec(7.f, 21.f), 180.f, "", TextAlignment::Left, 12.f, false, GetStockColor(StockColor::pachde_blue_medium));
addChild(device_label);

float x = COL_1;
float y = ROW_1;
auto port_color = GetStockColor(StockColor::pachde_default_port);
addChild(createStaticTextLabel<StaticTextLabel>(Vec(7.5f, y -LABEL_VOFFSET), LABEL_WIDTH, "Pedal 1", TextAlignment::Right));
addChild(createColorOutputCentered(x, y, Hc4O::O_PEDAL1, port_color, module));
y += ROW_SPREAD;
addChild(createStaticTextLabel<StaticTextLabel>(Vec(7.5f, y - LABEL_VOFFSET), LABEL_WIDTH, "Pedal 2", TextAlignment::Right));
addChild(createColorOutputCentered(x, y, Hc4O::O_PEDAL2, port_color, module));

}

// Hc1Module* Hc4ModuleWidget::getPartner()
// {
// if (!module) return nullptr;
// return my_module->getPartner();
// }
Hc1Module* Hc4ModuleWidget::getPartner()
{
if (!module) return nullptr;
return my_module->getPartner();
}

void Hc4ModuleWidget::onDisconnect(const DisconnectEvent& e)
{
Expand Down
12 changes: 3 additions & 9 deletions src/HC-4/HC-4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace pachde {
Hc4Module::Hc4Module()
{
config(Params::NUM_PARAMS, Inputs::NUM_INPUTS, Outputs::NUM_OUTPUTS, Lights::NUM_LIGHTS);
configOutput(Outputs::O_PEDAL1, "Pedal 1");
configOutput(Outputs::O_PEDAL2, "Pedal 2");
}

Hc4Module::~Hc4Module()
Expand All @@ -32,11 +30,7 @@ Hc1Module* Hc4Module::getPartner()

void Hc4Module::onPedalChanged(const PedalChangedEvent& e)
{
switch (e.pedal.jack) {
case 0 : getOutput(O_PEDAL1).setVoltage(e.pedal.value * 10.f / 127.f); break;
case 1 : getOutput(O_PEDAL2).setVoltage(e.pedal.value * 10.f / 127.f); break;
default: break;
}

}

void Hc4Module::onDeviceChanged(const DeviceChangedEvent& e)
Expand Down Expand Up @@ -69,8 +63,8 @@ void Hc4Module::process(const ProcessArgs& args)
check_cv = 0;
auto partner = getPartner();
if (partner) {
getOutput(Outputs::O_PEDAL1).setVoltage(10.f * partner->pedal1.value / 127);
getOutput(Outputs::O_PEDAL2).setVoltage(10.f * partner->pedal2.value / 127);
// getOutput(Outputs::O_PEDAL1).setVoltage(10.f * partner->pedal1.value / 127);
// getOutput(Outputs::O_PEDAL2).setVoltage(10.f * partner->pedal2.value / 127);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/HC-4/HC-4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ struct Hc4Module : Module, IHandleHcEvents
};
enum Outputs
{
O_PEDAL1,
O_PEDAL2,
NUM_OUTPUTS
};
enum Lights
Expand Down Expand Up @@ -70,7 +68,7 @@ struct Hc4ModuleWidget : ModuleWidget, IHandleHcEvents
}
}

// Hc1Module * getPartner();
Hc1Module * getPartner();

// IHandleHcEvents
// void onPresetChanged(const PresetChangedEvent& e) override;
Expand Down

0 comments on commit 80970a7

Please sign in to comment.