From c16d49816252c0ef2c610d0d50bcb30fddb541f9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 25 Dec 2016 02:47:21 -0500 Subject: [PATCH] Added "No device" for AudioInterface and MidiInterface --- src/core/AudioInterface.cpp | 15 ++++++++------- src/core/MidiInterface.cpp | 12 +++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/core/AudioInterface.cpp b/src/core/AudioInterface.cpp index a015f7e3..e4e152f7 100644 --- a/src/core/AudioInterface.cpp +++ b/src/core/AudioInterface.cpp @@ -199,17 +199,18 @@ struct AudioChoice : ChoiceButton { menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); int deviceCount = audioInterface->getDeviceCount(); - if (deviceCount == 0) { - MenuLabel *label = new MenuLabel(); - label->text = "No audio devices"; - menu->pushChild(label); + { + AudioItem *audioItem = new AudioItem(); + audioItem->audioInterface = audioInterface; + audioItem->deviceId = -1; + audioItem->text = "No device"; + menu->pushChild(audioItem); } for (int deviceId = 0; deviceId < deviceCount; deviceId++) { AudioItem *audioItem = new AudioItem(); audioItem->audioInterface = audioInterface; audioItem->deviceId = deviceId; - std::string text = audioInterface->getDeviceName(deviceId); - audioItem->text = text; + audioItem->text = audioInterface->getDeviceName(deviceId); menu->pushChild(audioItem); } overlay->addChild(menu); @@ -235,7 +236,7 @@ AudioInterfaceWidget::AudioInterfaceWidget() : ModuleWidget(new AudioInterface() { AudioChoice *audioChoice = new AudioChoice(); audioChoice->audioInterface = dynamic_cast(module); - audioChoice->text = "Audio Interface"; + audioChoice->text = "Audio device"; audioChoice->box.pos = Vec(margin, yPos); audioChoice->box.size.x = box.size.x - 10; addChild(audioChoice); diff --git a/src/core/MidiInterface.cpp b/src/core/MidiInterface.cpp index d751efca..cfcc7818 100644 --- a/src/core/MidiInterface.cpp +++ b/src/core/MidiInterface.cpp @@ -203,10 +203,12 @@ struct MidiChoice : ChoiceButton { menu->box.pos = getAbsolutePos().plus(Vec(0, box.size.y)); int portCount = midiInterface->getPortCount(); - if (portCount == 0) { - MenuLabel *label = new MenuLabel(); - label->text = "No MIDI devices"; - menu->pushChild(label); + { + MidiItem *midiItem = new MidiItem(); + midiItem->midiInterface = midiInterface; + midiItem->portId = -1; + midiItem->text = "No device"; + menu->pushChild(midiItem); } for (int portId = 0; portId < portCount; portId++) { MidiItem *midiItem = new MidiItem(); @@ -238,7 +240,7 @@ MidiInterfaceWidget::MidiInterfaceWidget() : ModuleWidget(new MidiInterface()) { { MidiChoice *midiChoice = new MidiChoice(); midiChoice->midiInterface = dynamic_cast(module); - midiChoice->text = "MIDI Interface"; + midiChoice->text = "MIDI device"; midiChoice->box.pos = Vec(margin, yPos); midiChoice->box.size.x = box.size.x - 10; addChild(midiChoice);