Audio/MidiChoices to header file. Move AudioDeviceMenuChoice to core::Audio and rename to Audio2Display.tags/v2.0.0
| @@ -0,0 +1,74 @@ | |||
| #pragma once | |||
| #include <app/common.hpp> | |||
| #include <app/LedDisplay.hpp> | |||
| #include <ui/Menu.hpp> | |||
| #include <app/SvgButton.hpp> | |||
| #include <audio.hpp> | |||
| namespace rack { | |||
| namespace app { | |||
| struct AudioDriverChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct AudioDeviceChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct AudioSampleRateChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct AudioBlockSizeChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct AudioDeviceMenuChoice : AudioDeviceChoice { | |||
| void onAction(const ActionEvent& e) override; | |||
| }; | |||
| /** Designed for Audio-8 and Audio-16 module. */ | |||
| struct AudioDisplay : LedDisplay { | |||
| AudioDriverChoice* driverChoice; | |||
| LedDisplaySeparator* driverSeparator; | |||
| AudioDeviceChoice* deviceChoice; | |||
| LedDisplaySeparator* deviceSeparator; | |||
| AudioSampleRateChoice* sampleRateChoice; | |||
| LedDisplaySeparator* sampleRateSeparator; | |||
| AudioBlockSizeChoice* bufferSizeChoice; | |||
| void setAudioPort(audio::Port* port); | |||
| }; | |||
| /** A virtual audio port graphic that displays an audio menu when clicked. */ | |||
| struct AudioButton : SvgButton { | |||
| audio::Port* port; | |||
| void setAudioPort(audio::Port* port); | |||
| void onAction(const ActionEvent& e) override; | |||
| }; | |||
| /** Appends menu items to the given menu with driver, device, etc. | |||
| Useful alternative to putting an AudioDisplay on your module's panel. | |||
| */ | |||
| void appendAudioMenu(ui::Menu* menu, audio::Port* port); | |||
| } // namespace app | |||
| } // namespace rack | |||
| @@ -1,48 +0,0 @@ | |||
| #pragma once | |||
| #include <app/common.hpp> | |||
| #include <app/LedDisplay.hpp> | |||
| #include <ui/Menu.hpp> | |||
| #include <app/SvgButton.hpp> | |||
| #include <audio.hpp> | |||
| namespace rack { | |||
| namespace app { | |||
| /** Designed for Audio-8 and Audio-16 module. */ | |||
| struct AudioWidget : LedDisplay { | |||
| LedDisplayChoice* driverChoice; | |||
| LedDisplaySeparator* driverSeparator; | |||
| LedDisplayChoice* deviceChoice; | |||
| LedDisplaySeparator* deviceSeparator; | |||
| LedDisplayChoice* sampleRateChoice; | |||
| LedDisplaySeparator* sampleRateSeparator; | |||
| LedDisplayChoice* bufferSizeChoice; | |||
| void setAudioPort(audio::Port* port); | |||
| }; | |||
| /** Designed for Audio-2 module. */ | |||
| struct AudioDeviceWidget : LedDisplay { | |||
| LedDisplayChoice* deviceChoice; | |||
| void setAudioPort(audio::Port* port); | |||
| }; | |||
| /** A virtual audio port graphic that displays an audio menu when clicked. */ | |||
| struct AudioButton : SvgButton { | |||
| audio::Port* port; | |||
| void setAudioPort(audio::Port* port); | |||
| void onAction(const ActionEvent& e) override; | |||
| }; | |||
| /** Appends menu items to the given menu with driver, device, etc. | |||
| Useful alternative to putting an AudioWidget on your module's panel. | |||
| */ | |||
| void appendAudioMenu(ui::Menu* menu, audio::Port* port); | |||
| } // namespace app | |||
| } // namespace rack | |||
| @@ -10,12 +10,33 @@ namespace rack { | |||
| namespace app { | |||
| struct MidiWidget : LedDisplay { | |||
| LedDisplayChoice* driverChoice; | |||
| struct MidiDriverChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct MidiDeviceChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct MidiChannelChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override; | |||
| void step() override; | |||
| }; | |||
| struct MidiDisplay : LedDisplay { | |||
| MidiDriverChoice* driverChoice; | |||
| LedDisplaySeparator* driverSeparator; | |||
| LedDisplayChoice* deviceChoice; | |||
| MidiDeviceChoice* deviceChoice; | |||
| LedDisplaySeparator* deviceSeparator; | |||
| LedDisplayChoice* channelChoice; | |||
| MidiChannelChoice* channelChoice; | |||
| void setMidiPort(midi::Port* port); | |||
| }; | |||
| @@ -29,7 +50,7 @@ struct MidiButton : SvgButton { | |||
| /** Appends menu items to the given menu with driver, device, etc. | |||
| Useful alternative to putting a MidiWidget on your module's panel. | |||
| Useful alternative to putting a MidiDisplay on your module's panel. | |||
| */ | |||
| void appendMidiMenu(ui::Menu* menu, midi::Port* port); | |||
| @@ -7,8 +7,8 @@ | |||
| #include <app/ModuleLightWidget.hpp> | |||
| #include <app/SvgSwitch.hpp> | |||
| #include <app/SvgScrew.hpp> | |||
| #include <app/AudioWidget.hpp> | |||
| #include <app/MidiWidget.hpp> | |||
| #include <app/AudioDisplay.hpp> | |||
| #include <app/MidiDisplay.hpp> | |||
| #include <asset.hpp> | |||
| @@ -68,9 +68,9 @@ Directly including Rack headers other than rack.hpp in your plugin is unsupporte | |||
| #include <app/SliderKnob.hpp> | |||
| #include <app/MultiLightWidget.hpp> | |||
| #include <app/MidiWidget.hpp> | |||
| #include <app/MidiDisplay.hpp> | |||
| #include <app/CircularShadow.hpp> | |||
| #include <app/AudioWidget.hpp> | |||
| #include <app/AudioDisplay.hpp> | |||
| #include <app/LedDisplay.hpp> | |||
| #include <app/ModuleLightWidget.hpp> | |||
| #include <app/LightWidget.hpp> | |||
| @@ -1,4 +1,4 @@ | |||
| #include <app/AudioWidget.hpp> | |||
| #include <app/AudioDisplay.hpp> | |||
| #include <ui/MenuSeparator.hpp> | |||
| #include <helpers.hpp> | |||
| #include <set> | |||
| @@ -47,29 +47,27 @@ static void appendAudioDriverMenu(ui::Menu* menu, audio::Port* port) { | |||
| } | |||
| } | |||
| struct AudioDriverChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Audio driver")); | |||
| appendAudioDriverMenu(menu, port); | |||
| void AudioDriverChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Audio driver")); | |||
| appendAudioDriverMenu(menu, port); | |||
| } | |||
| void AudioDriverChoice::step() { | |||
| text = ""; | |||
| if (box.size.x >= 200.0) | |||
| text += "Driver: "; | |||
| audio::Driver* driver = port ? port->getDriver() : NULL; | |||
| std::string driverName = driver ? driver->getName() : ""; | |||
| if (driverName != "") { | |||
| text += driverName; | |||
| color.a = 1.0; | |||
| } | |||
| void step() override { | |||
| text = ""; | |||
| if (box.size.x >= 200.0) | |||
| text += "Driver: "; | |||
| audio::Driver* driver = port ? port->getDriver() : NULL; | |||
| std::string driverName = driver ? driver->getName() : ""; | |||
| if (driverName != "") { | |||
| text += driverName; | |||
| color.a = 1.0; | |||
| } | |||
| else { | |||
| text += "(No driver)"; | |||
| color.a = 0.5; | |||
| } | |||
| else { | |||
| text += "(No driver)"; | |||
| color.a = 0.5; | |||
| } | |||
| }; | |||
| } | |||
| struct AudioDriverItem : ui::MenuItem { | |||
| audio::Port* port; | |||
| @@ -132,35 +130,32 @@ static void appendAudioDeviceMenu(ui::Menu* menu, audio::Port* port) { | |||
| } | |||
| } | |||
| struct AudioDeviceChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void AudioDeviceChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Audio device")); | |||
| appendAudioDeviceMenu(menu, port); | |||
| } | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Audio device")); | |||
| appendAudioDeviceMenu(menu, port); | |||
| void AudioDeviceChoice::step() { | |||
| text = ""; | |||
| if (box.size.x >= 200.0) | |||
| text += "Device: "; | |||
| std::string detail = ""; | |||
| if (port && port->getDevice()) | |||
| detail = getDetailTemplate(port->getDevice()->getName(), port->getNumInputs(), port->inputOffset, port->getNumOutputs(), port->outputOffset); | |||
| if (detail != "") { | |||
| text += detail; | |||
| color.a = 1.0; | |||
| } | |||
| void step() override { | |||
| text = ""; | |||
| if (box.size.x >= 200.0) | |||
| text += "Device: "; | |||
| std::string detail = ""; | |||
| if (port && port->getDevice()) | |||
| detail = getDetailTemplate(port->getDevice()->getName(), port->getNumInputs(), port->inputOffset, port->getNumOutputs(), port->outputOffset); | |||
| if (detail != "") { | |||
| text += detail; | |||
| color.a = 1.0; | |||
| } | |||
| else { | |||
| if (box.size.x >= 80.0) | |||
| text += "(No device)"; | |||
| else | |||
| text += "No device"; | |||
| color.a = 0.5; | |||
| } | |||
| else { | |||
| if (box.size.x >= 80.0) | |||
| text += "(No device)"; | |||
| else | |||
| text += "No device"; | |||
| color.a = 0.5; | |||
| } | |||
| }; | |||
| } | |||
| struct AudioDeviceItem : ui::MenuItem { | |||
| audio::Port* port; | |||
| @@ -203,29 +198,27 @@ static void appendAudioSampleRateMenu(ui::Menu* menu, audio::Port* port) { | |||
| } | |||
| } | |||
| struct AudioSampleRateChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Sample rate")); | |||
| appendAudioSampleRateMenu(menu, port); | |||
| void AudioSampleRateChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Sample rate")); | |||
| appendAudioSampleRateMenu(menu, port); | |||
| } | |||
| void AudioSampleRateChoice::step() { | |||
| text = ""; | |||
| if (box.size.x >= 100.0) | |||
| text += "Rate: "; | |||
| float sampleRate = port ? port->getSampleRate() : 0; | |||
| if (sampleRate > 0) { | |||
| text += string::f("%g", sampleRate / 1000.f); | |||
| color.a = 1.0; | |||
| } | |||
| void step() override { | |||
| text = ""; | |||
| if (box.size.x >= 100.0) | |||
| text += "Rate: "; | |||
| float sampleRate = port ? port->getSampleRate() : 0; | |||
| if (sampleRate > 0) { | |||
| text += string::f("%g", sampleRate / 1000.f); | |||
| color.a = 1.0; | |||
| } | |||
| else { | |||
| text += "---"; | |||
| color.a = 0.5; | |||
| } | |||
| text += " kHz"; | |||
| else { | |||
| text += "---"; | |||
| color.a = 0.5; | |||
| } | |||
| }; | |||
| text += " kHz"; | |||
| } | |||
| struct AudioSampleRateItem : ui::MenuItem { | |||
| audio::Port* port; | |||
| @@ -269,28 +262,26 @@ static void appendAudioBlockSizeMenu(ui::Menu* menu, audio::Port* port) { | |||
| } | |||
| } | |||
| struct AudioBlockSizeChoice : LedDisplayChoice { | |||
| audio::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Block size")); | |||
| appendAudioBlockSizeMenu(menu, port); | |||
| void AudioBlockSizeChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("Block size")); | |||
| appendAudioBlockSizeMenu(menu, port); | |||
| } | |||
| void AudioBlockSizeChoice::step() { | |||
| text = ""; | |||
| if (box.size.x >= 100.0) | |||
| text += "Block size: "; | |||
| int blockSize = port ? port->getBlockSize() : 0; | |||
| if (blockSize > 0) { | |||
| text += string::f("%d", blockSize); | |||
| color.a = 1.0; | |||
| } | |||
| void step() override { | |||
| text = ""; | |||
| if (box.size.x >= 100.0) | |||
| text += "Block size: "; | |||
| int blockSize = port ? port->getBlockSize() : 0; | |||
| if (blockSize > 0) { | |||
| text += string::f("%d", blockSize); | |||
| color.a = 1.0; | |||
| } | |||
| else { | |||
| text += "---"; | |||
| color.a = 0.5; | |||
| } | |||
| else { | |||
| text += "---"; | |||
| color.a = 0.5; | |||
| } | |||
| }; | |||
| } | |||
| struct AudioBlockSizeItem : ui::MenuItem { | |||
| audio::Port* port; | |||
| @@ -302,7 +293,7 @@ struct AudioBlockSizeItem : ui::MenuItem { | |||
| }; | |||
| void AudioWidget::setAudioPort(audio::Port* port) { | |||
| void AudioDisplay::setAudioPort(audio::Port* port) { | |||
| clearChildren(); | |||
| math::Vec pos; | |||
| @@ -349,21 +340,9 @@ void AudioWidget::setAudioPort(audio::Port* port) { | |||
| } | |||
| struct AudioDeviceMenuChoice : AudioDeviceChoice { | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| appendAudioMenu(menu, port); | |||
| } | |||
| }; | |||
| void AudioDeviceWidget::setAudioPort(audio::Port* port) { | |||
| AudioDeviceMenuChoice* deviceChoice = createWidget<AudioDeviceMenuChoice>(math::Vec()); | |||
| deviceChoice->box.size.x = box.size.x; | |||
| deviceChoice->box.size.y = box.size.y; | |||
| deviceChoice->port = port; | |||
| addChild(deviceChoice); | |||
| this->deviceChoice = deviceChoice; | |||
| void AudioDeviceMenuChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| appendAudioMenu(menu, port); | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| #include <app/MidiWidget.hpp> | |||
| #include <app/MidiDisplay.hpp> | |||
| #include <ui/MenuSeparator.hpp> | |||
| #include <helpers.hpp> | |||
| @@ -29,24 +29,22 @@ static void appendMidiDriverMenu(ui::Menu* menu, midi::Port* port) { | |||
| } | |||
| } | |||
| struct MidiDriverChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI driver")); | |||
| appendMidiDriverMenu(menu, port); | |||
| void MidiDriverChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI driver")); | |||
| appendMidiDriverMenu(menu, port); | |||
| } | |||
| void MidiDriverChoice::step() { | |||
| text = (port && port->driver) ? port->getDriver()->getName() : ""; | |||
| if (text.empty()) { | |||
| text = "(No driver)"; | |||
| color.a = 0.5f; | |||
| } | |||
| void step() override { | |||
| text = (port && port->driver) ? port->getDriver()->getName() : ""; | |||
| if (text.empty()) { | |||
| text = "(No driver)"; | |||
| color.a = 0.5f; | |||
| } | |||
| else { | |||
| color.a = 1.f; | |||
| } | |||
| else { | |||
| color.a = 1.f; | |||
| } | |||
| }; | |||
| } | |||
| struct MidiDriverItem : ui::MenuItem { | |||
| midi::Port* port; | |||
| @@ -89,24 +87,22 @@ static void appendMidiDeviceMenu(ui::Menu* menu, midi::Port* port) { | |||
| } | |||
| } | |||
| struct MidiDeviceChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI device")); | |||
| appendMidiDeviceMenu(menu, port); | |||
| void MidiDeviceChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI device")); | |||
| appendMidiDeviceMenu(menu, port); | |||
| } | |||
| void MidiDeviceChoice::step() { | |||
| text = (port && port->device) ? port->getDevice()->getName() : ""; | |||
| if (text.empty()) { | |||
| text = "(No device)"; | |||
| color.a = 0.5f; | |||
| } | |||
| void step() override { | |||
| text = (port && port->device) ? port->getDevice()->getName() : ""; | |||
| if (text.empty()) { | |||
| text = "(No device)"; | |||
| color.a = 0.5f; | |||
| } | |||
| else { | |||
| color.a = 1.f; | |||
| } | |||
| else { | |||
| color.a = 1.f; | |||
| } | |||
| }; | |||
| } | |||
| struct MidiDeviceItem : ui::MenuItem { | |||
| midi::Port* port; | |||
| @@ -140,17 +136,15 @@ static void appendMidiChannelMenu(ui::Menu* menu, midi::Port* port) { | |||
| } | |||
| } | |||
| struct MidiChannelChoice : LedDisplayChoice { | |||
| midi::Port* port; | |||
| void onAction(const ActionEvent& e) override { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI channel")); | |||
| appendMidiChannelMenu(menu, port); | |||
| } | |||
| void step() override { | |||
| text = port ? port->getChannelName(port->getChannel()) : "Channel 1"; | |||
| } | |||
| }; | |||
| void MidiChannelChoice::onAction(const ActionEvent& e) { | |||
| ui::Menu* menu = createMenu(); | |||
| menu->addChild(createMenuLabel("MIDI channel")); | |||
| appendMidiChannelMenu(menu, port); | |||
| } | |||
| void MidiChannelChoice::step() { | |||
| text = port ? port->getChannelName(port->getChannel()) : "Channel 1"; | |||
| } | |||
| struct MidiChannelItem : ui::MenuItem { | |||
| midi::Port* port; | |||
| @@ -162,7 +156,7 @@ struct MidiChannelItem : ui::MenuItem { | |||
| }; | |||
| void MidiWidget::setMidiPort(midi::Port* port) { | |||
| void MidiDisplay::setMidiPort(midi::Port* port) { | |||
| clearChildren(); | |||
| math::Vec pos; | |||
| @@ -397,6 +397,28 @@ struct Audio : Module { | |||
| }; | |||
| /** For Audio-2 module. */ | |||
| struct Audio2Display : LedDisplay { | |||
| AudioDeviceMenuChoice* deviceChoice; | |||
| LedDisplaySeparator* deviceSeparator; | |||
| void setAudioPort(audio::Port* port) { | |||
| math::Vec pos; | |||
| deviceChoice = createWidget<AudioDeviceMenuChoice>(math::Vec()); | |||
| deviceChoice->box.size.x = box.size.x; | |||
| deviceChoice->box.size.y = mm2px(4.0); | |||
| deviceChoice->port = port; | |||
| addChild(deviceChoice); | |||
| pos = deviceChoice->box.getBottomLeft(); | |||
| deviceSeparator = createWidget<LedDisplaySeparator>(pos); | |||
| deviceSeparator->box.size.x = box.size.x; | |||
| addChild(deviceSeparator); | |||
| } | |||
| }; | |||
| template <int NUM_AUDIO_INPUTS, int NUM_AUDIO_OUTPUTS> | |||
| struct AudioWidget : ModuleWidget { | |||
| typedef Audio<NUM_AUDIO_INPUTS, NUM_AUDIO_OUTPUTS> TAudio; | |||
| @@ -440,10 +462,10 @@ struct AudioWidget : ModuleWidget { | |||
| addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(13.54, 107.097)), module, TAudio::OUTPUT_LIGHTS + 2 * 2)); | |||
| addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(36.638, 107.097)), module, TAudio::OUTPUT_LIGHTS + 2 * 3)); | |||
| app::AudioWidget* audioWidget = createWidget<app::AudioWidget>(mm2px(Vec(0.0, 13.039))); | |||
| audioWidget->box.size = mm2px(Vec(50.8, 29.021)); | |||
| audioWidget->setAudioPort(module ? &module->port : NULL); | |||
| addChild(audioWidget); | |||
| AudioDisplay* display = createWidget<AudioDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(50.8, 29.021)); | |||
| display->setAudioPort(module ? &module->port : NULL); | |||
| addChild(display); | |||
| } | |||
| else if (NUM_AUDIO_INPUTS == 16 && NUM_AUDIO_OUTPUTS == 16) { | |||
| setPanel(Svg::load(asset::system("res/Core/Audio16.svg"))); | |||
| @@ -505,10 +527,10 @@ struct AudioWidget : ModuleWidget { | |||
| addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(59.745, 107.097)), module, TAudio::OUTPUT_LIGHTS + 2 * 6)); | |||
| addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(82.844, 107.097)), module, TAudio::OUTPUT_LIGHTS + 2 * 7)); | |||
| app::AudioWidget* audioWidget = createWidget<app::AudioWidget>(mm2px(Vec(0.0, 13.039))); | |||
| audioWidget->box.size = mm2px(Vec(96.52, 29.021)); | |||
| audioWidget->setAudioPort(module ? &module->port : NULL); | |||
| addChild(audioWidget); | |||
| AudioDisplay* display = createWidget<AudioDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(96.52, 29.021)); | |||
| display->setAudioPort(module ? &module->port : NULL); | |||
| addChild(display); | |||
| } | |||
| else if (NUM_AUDIO_INPUTS == 2 && NUM_AUDIO_OUTPUTS == 2) { | |||
| setPanel(Svg::load(asset::system("res/Core/Audio2.svg"))); | |||
| @@ -539,12 +561,12 @@ struct AudioWidget : ModuleWidget { | |||
| addChild(createLightCentered<SmallSimpleLight<GreenLight>>(mm2px(Vec(6.691, 55.386)), module, TAudio::VU_LIGHTS + 6 * 0 + 5)); | |||
| addChild(createLightCentered<SmallSimpleLight<GreenLight>>(mm2px(Vec(18.709, 55.386)), module, TAudio::VU_LIGHTS + 6 * 1 + 5)); | |||
| app::AudioDeviceWidget* audioWidget = createWidget<app::AudioDeviceWidget>(mm2px(Vec(0.0, 13.039))); | |||
| audioWidget->box.size = mm2px(Vec(25.4, 47.726)); | |||
| audioWidget->setAudioPort(module ? &module->port : NULL); | |||
| Audio2Display* display = createWidget<Audio2Display>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(25.4, 47.726)); | |||
| display->setAudioPort(module ? &module->port : NULL); | |||
| // Adjust deviceChoice position | |||
| audioWidget->deviceChoice->textOffset = Vec(6, 14); | |||
| addChild(audioWidget); | |||
| display->deviceChoice->textOffset = Vec(6, 14); | |||
| addChild(display); | |||
| // AudioButton example | |||
| // AudioButton* audioButton_ADAT = createWidget<AudioButton_ADAT>(Vec(0, 0)); | |||
| @@ -169,10 +169,10 @@ struct CV_MIDIWidget : ModuleWidget { | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(32.591, 112.975)), module, CV_MIDI::CONTINUE_INPUT)); | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(20.249, 113.115)), module, CV_MIDI::STOP_INPUT)); | |||
| MidiWidget* midiWidget = createWidget<MidiWidget>(mm2px(Vec(0.0, 13.039))); | |||
| midiWidget->box.size = mm2px(Vec(40.64, 29.021)); | |||
| midiWidget->setMidiPort(module ? &module->midiOutput : NULL); | |||
| addChild(midiWidget); | |||
| MidiDisplay* display = createWidget<MidiDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(40.64, 29.021)); | |||
| display->setMidiPort(module ? &module->midiOutput : NULL); | |||
| addChild(display); | |||
| } | |||
| void appendContextMenu(Menu* menu) override { | |||
| @@ -149,12 +149,12 @@ struct CV_MIDICCWidget : ModuleWidget { | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(31.289, 112.984)), module, CV_MIDICC::CC_INPUTS + 14)); | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(42.838, 112.984)), module, CV_MIDICC::CC_INPUTS + 15)); | |||
| typedef Grid16MidiWidget<CcChoice<CV_MIDICC>> TMidiWidget; | |||
| TMidiWidget* midiWidget = createWidget<TMidiWidget>(mm2px(Vec(0.0, 13.039))); | |||
| midiWidget->box.size = mm2px(Vec(50.8, 55.88)); | |||
| midiWidget->setMidiPort(module ? &module->midiOutput : NULL); | |||
| midiWidget->setModule(module); | |||
| addChild(midiWidget); | |||
| typedef Grid16MidiDisplay<CcChoice<CV_MIDICC>> TMidiDisplay; | |||
| TMidiDisplay* display = createWidget<TMidiDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(50.8, 55.88)); | |||
| display->setMidiPort(module ? &module->midiOutput : NULL); | |||
| display->setModule(module); | |||
| addChild(display); | |||
| } | |||
| }; | |||
| @@ -189,12 +189,12 @@ struct Gate_MIDIWidget : ModuleWidget { | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(31.289, 112.984)), module, Gate_MIDI::GATE_INPUTS + 14)); | |||
| addInput(createInputCentered<PJ301MPort>(mm2px(Vec(42.838, 112.984)), module, Gate_MIDI::GATE_INPUTS + 15)); | |||
| typedef Grid16MidiWidget<NoteChoice<Gate_MIDI>> TMidiWidget; | |||
| TMidiWidget* midiWidget = createWidget<TMidiWidget>(mm2px(Vec(0.0, 13.039))); | |||
| midiWidget->box.size = mm2px(Vec(50.8, 55.88)); | |||
| midiWidget->setMidiPort(module ? &module->midiOutput : NULL); | |||
| midiWidget->setModule(module); | |||
| addChild(midiWidget); | |||
| typedef Grid16MidiDisplay<NoteChoice<Gate_MIDI>> TMidiDisplay; | |||
| TMidiDisplay* display = createWidget<TMidiDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(50.8, 55.88)); | |||
| display->setMidiPort(module ? &module->midiOutput : NULL); | |||
| display->setModule(module); | |||
| addChild(display); | |||
| } | |||
| void appendContextMenu(Menu* menu) override { | |||
| @@ -238,12 +238,12 @@ struct MIDICC_CVWidget : ModuleWidget { | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(31.289, 112.984)), module, MIDICC_CV::CC_OUTPUT + 14)); | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(42.839, 112.984)), module, MIDICC_CV::CC_OUTPUT + 15)); | |||
| typedef Grid16MidiWidget<CcChoice<MIDICC_CV>> TMidiWidget; | |||
| TMidiWidget* midiWidget = createWidget<TMidiWidget>(mm2px(Vec(0.0, 13.039))); | |||
| midiWidget->box.size = mm2px(Vec(50.8, 55.88)); | |||
| midiWidget->setMidiPort(module ? &module->midiInput : NULL); | |||
| midiWidget->setModule(module); | |||
| addChild(midiWidget); | |||
| typedef Grid16MidiDisplay<CcChoice<MIDICC_CV>> TMidiDisplay; | |||
| TMidiDisplay* display = createWidget<TMidiDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(50.8, 55.88)); | |||
| display->setMidiPort(module ? &module->midiInput : NULL); | |||
| display->setModule(module); | |||
| addChild(display); | |||
| } | |||
| void appendContextMenu(Menu* menu) override { | |||
| @@ -420,7 +420,7 @@ struct MIDIMapChoice : LedDisplayChoice { | |||
| }; | |||
| struct MIDIMapDisplay : MidiWidget { | |||
| struct MIDIMapDisplay : MidiDisplay { | |||
| MIDIMap* module; | |||
| ScrollWidget* scroll; | |||
| MIDIMapChoice* choices[MAX_CHANNELS]; | |||
| @@ -469,7 +469,7 @@ struct MIDIMapDisplay : MidiWidget { | |||
| } | |||
| } | |||
| MidiWidget::step(); | |||
| MidiDisplay::step(); | |||
| } | |||
| }; | |||
| @@ -484,11 +484,11 @@ struct MIDIMapWidget : ModuleWidget { | |||
| addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); | |||
| addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); | |||
| MIDIMapDisplay* midiWidget = createWidget<MIDIMapDisplay>(mm2px(Vec(0.0, 12.869))); | |||
| midiWidget->box.size = mm2px(Vec(50.8, 105.059)); | |||
| midiWidget->setMidiPort(module ? &module->midiInput : NULL); | |||
| midiWidget->setModule(module); | |||
| addChild(midiWidget); | |||
| MIDIMapDisplay* display = createWidget<MIDIMapDisplay>(mm2px(Vec(0.0, 12.869))); | |||
| display->box.size = mm2px(Vec(50.8, 105.059)); | |||
| display->setMidiPort(module ? &module->midiInput : NULL); | |||
| display->setModule(module); | |||
| addChild(display); | |||
| } | |||
| void appendContextMenu(Menu* menu) override { | |||
| @@ -490,10 +490,10 @@ struct MIDI_CVWidget : ModuleWidget { | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(32.591, 112.975)), module, MIDI_CV::STOP_OUTPUT)); | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(20.248, 113.115)), module, MIDI_CV::CONTINUE_OUTPUT)); | |||
| MidiWidget* midiWidget = createWidget<MidiWidget>(mm2px(Vec(0.0, 13.048))); | |||
| midiWidget->box.size = mm2px(Vec(40.64, 29.012)); | |||
| midiWidget->setMidiPort(module ? &module->midiInput : NULL); | |||
| addChild(midiWidget); | |||
| MidiDisplay* display = createWidget<MidiDisplay>(mm2px(Vec(0.0, 13.048))); | |||
| display->box.size = mm2px(Vec(40.64, 29.012)); | |||
| display->setMidiPort(module ? &module->midiInput : NULL); | |||
| addChild(display); | |||
| // MidiButton example | |||
| // MidiButton* midiButton = createWidget<MidiButton_MIDI_DIN>(Vec(0, 0)); | |||
| @@ -206,12 +206,12 @@ struct MIDI_GateWidget : ModuleWidget { | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(31.289, 112.984)), module, MIDI_Gate::GATE_OUTPUTS + 14)); | |||
| addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(42.838, 112.984)), module, MIDI_Gate::GATE_OUTPUTS + 15)); | |||
| typedef Grid16MidiWidget<NoteChoice<MIDI_Gate>> TMidiWidget; | |||
| TMidiWidget* midiWidget = createWidget<TMidiWidget>(mm2px(Vec(0.0, 13.039))); | |||
| midiWidget->box.size = mm2px(Vec(50.8, 55.88)); | |||
| midiWidget->setMidiPort(module ? &module->midiInput : NULL); | |||
| midiWidget->setModule(module); | |||
| addChild(midiWidget); | |||
| typedef Grid16MidiDisplay<NoteChoice<MIDI_Gate>> TMidiDisplay; | |||
| TMidiDisplay* display = createWidget<TMidiDisplay>(mm2px(Vec(0.0, 13.039))); | |||
| display->box.size = mm2px(Vec(50.8, 55.88)); | |||
| display->setMidiPort(module ? &module->midiInput : NULL); | |||
| display->setModule(module); | |||
| addChild(display); | |||
| } | |||
| void appendContextMenu(Menu* menu) override { | |||
| @@ -20,7 +20,7 @@ extern Model* modelNotes; | |||
| template <class TChoice> | |||
| struct Grid16MidiWidget : MidiWidget { | |||
| struct Grid16MidiDisplay : MidiDisplay { | |||
| LedDisplaySeparator* hSeparators[4]; | |||
| LedDisplaySeparator* vSeparators[4]; | |||
| TChoice* choices[4][4]; | |||