Skip to content

Remove passthrough toggle from editor #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/OnixSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void OnixSource::initializeDevices(bool updateStreamInfo)

uint32_t val = 0;

if (getParameter("passthroughA")->getValue())
if (getParameter("passthroughA")->getValue() || getParameter("passthroughB")->getValue())
{
LOGD("Passthrough mode enabled");
val = 1;
Expand Down
40 changes: 29 additions & 11 deletions Source/OnixSourceEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* oni
headstageComboBoxA->setSelectedId(1, dontSendNotification);
addAndMakeVisible(headstageComboBoxA.get());

passthroughEditorA = std::make_unique<ToggleParameterEditor>(onixSource->getParameter("passthroughA"));
passthroughEditorA->setLayout(ParameterEditor::nameHidden);
passthroughEditorA->setBounds(headstageComboBoxA->getX(), headstageComboBoxA->getBottom() + 4, 60, headstageComboBoxA->getHeight());
addAndMakeVisible(passthroughEditorA.get());
portVoltageOverrideLabelA = std::make_unique<Label>("voltageOverrideLabelA", "Voltage");
portVoltageOverrideLabelA->setBounds(headstageComboBoxA->getX(), headstageComboBoxA->getBottom() + 4, 50, headstageComboBoxA->getHeight());
portVoltageOverrideLabelA->setFont(fontOptionSmall);
addAndMakeVisible(portVoltageOverrideLabelA.get());

portVoltageValueA = std::make_unique<Label>("voltageValueA", "");
portVoltageValueA->setBounds(passthroughEditorA->getRight() + 10, passthroughEditorA->getY(), 35, passthroughEditorA->getHeight());
portVoltageValueA->setBounds(portVoltageOverrideLabelA->getRight() + 3, portVoltageOverrideLabelA->getY(), 25, portVoltageOverrideLabelA->getHeight());
portVoltageValueA->setFont(fontOptionSmall);
portVoltageValueA->setEditable(true);
portVoltageValueA->setColour(Label::textColourId, Colours::black);
Expand All @@ -66,7 +66,7 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* oni
addAndMakeVisible(portVoltageValueA.get());

portLabelB = std::make_unique<Label>("portLabelB", "Port B:");
portLabelB->setBounds(portLabelA->getX(), passthroughEditorA->getBottom() + 5, portLabelA->getWidth(), portLabelA->getHeight());
portLabelB->setBounds(portLabelA->getX(), portVoltageOverrideLabelA->getBottom() + 5, portLabelA->getWidth(), portLabelA->getHeight());
portLabelB->setFont(fontOptionTitle);
addAndMakeVisible(portLabelB.get());

Expand All @@ -83,13 +83,13 @@ OnixSourceEditor::OnixSourceEditor(GenericProcessor* parentNode, OnixSource* oni
headstageComboBoxB->setSelectedId(1, dontSendNotification);
addAndMakeVisible(headstageComboBoxB.get());

passthroughEditorB = std::make_unique<ToggleParameterEditor>(onixSource->getParameter("passthroughB"));
passthroughEditorB->setLayout(ParameterEditor::nameHidden);
passthroughEditorB->setBounds(headstageComboBoxB->getX(), headstageComboBoxB->getBottom() + 4, passthroughEditorA->getWidth(), passthroughEditorA->getHeight());
addAndMakeVisible(passthroughEditorB.get());
portVoltageOverrideLabelB = std::make_unique<Label>("voltageOverrideLabelB", "Voltage");
portVoltageOverrideLabelB->setBounds(headstageComboBoxB->getX(), headstageComboBoxB->getBottom() + 4, portVoltageOverrideLabelA->getWidth(), portVoltageOverrideLabelA->getHeight());
portVoltageOverrideLabelB->setFont(fontOptionSmall);
addAndMakeVisible(portVoltageOverrideLabelB.get());

portVoltageValueB = std::make_unique<Label>("voltageValueB", "");
portVoltageValueB->setBounds(passthroughEditorB->getRight() + 10, passthroughEditorB->getY(), portVoltageValueA->getWidth(), passthroughEditorB->getHeight());
portVoltageValueB->setBounds(portVoltageValueA->getX(), portVoltageOverrideLabelB->getY(), portVoltageValueA->getWidth(), portVoltageValueA->getHeight());
portVoltageValueB->setFont(fontOptionSmall);
portVoltageValueB->setEditable(true);
portVoltageValueB->setColour(Label::textColourId, Colours::black);
Expand Down Expand Up @@ -183,13 +183,31 @@ void OnixSourceEditor::comboBoxChanged(ComboBox* cb)
String headstage = headstageComboBoxA->getText();

thread->updateDiscoveryParameters(PortName::PortA, PortController::getHeadstageDiscoveryParameters(headstage));

if (headstage == "Neuropixels 1.0f")
{
thread->getParameter("passthroughA")->setNextValue(false);
}
else
{
thread->getParameter("passthroughA")->setNextValue(true);
}
}
else if (cb == headstageComboBoxB.get())
{
// TODO: Call canvas to remove / add tabs as needed depending on what is chosen
String headstage = headstageComboBoxB->getText();

thread->updateDiscoveryParameters(PortName::PortB, PortController::getHeadstageDiscoveryParameters(headstage));

if (headstage == "Neuropixels 1.0f")
{
thread->getParameter("passthroughB")->setNextValue(false);
}
else
{
thread->getParameter("passthroughB")->setNextValue(true);
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/OnixSourceEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ class OnixSourceEditor : public VisualizerEditor,
std::unique_ptr<ComboBox> headstageComboBoxA;
std::unique_ptr<ComboBox> headstageComboBoxB;

std::unique_ptr<Label> portVoltageOverrideLabelA;
std::unique_ptr<Label> portVoltageOverrideLabelB;

std::unique_ptr<Label> portVoltageValueA;
std::unique_ptr<Label> portVoltageValueB;

std::unique_ptr<UtilityButton> connectButton;

std::unique_ptr<ToggleParameterEditor> passthroughEditorA;
std::unique_ptr<ToggleParameterEditor> passthroughEditorB;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OnixSourceEditor);
};

Expand Down