Browse Source

Update device name in AudioInterface choice widget only when deviceId

changes
tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
2734f9c7f8
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/core/AudioInterface.cpp

+ 6
- 2
src/core/AudioInterface.cpp View File

@@ -318,6 +318,7 @@ struct AudioItem : MenuItem {
};

struct AudioChoice : ChoiceButton {
int lastDeviceId = -1;
AudioInterface *audioInterface;
void onAction(EventAction &e) override {
Menu *menu = gScene->createMenu();
@@ -341,8 +342,11 @@ struct AudioChoice : ChoiceButton {
}
}
void step() override {
std::string name = audioInterface->getDeviceName(audioInterface->deviceId);
text = ellipsize(name, 24);
if (lastDeviceId != audioInterface->deviceId) {
std::string name = audioInterface->getDeviceName(audioInterface->deviceId);
text = ellipsize(name, 24);
lastDeviceId = audioInterface->deviceId;
}
}
};



Loading…
Cancel
Save