Browse Source

Added "No device" for AudioInterface and MidiInterface

tags/v0.3.0
Andrew Belt 7 years ago
parent
commit
c16d498162
2 changed files with 15 additions and 12 deletions
  1. +8
    -7
      src/core/AudioInterface.cpp
  2. +7
    -5
      src/core/MidiInterface.cpp

+ 8
- 7
src/core/AudioInterface.cpp View File

@@ -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<AudioInterface*>(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);


+ 7
- 5
src/core/MidiInterface.cpp View File

@@ -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<MidiInterface*>(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);


Loading…
Cancel
Save