diff options
Diffstat (limited to 'source/frontend')
-rw-r--r-- | source/frontend/StarMainMixer.cpp | 9 | ||||
-rw-r--r-- | source/frontend/StarOptionsMenu.cpp | 16 | ||||
-rw-r--r-- | source/frontend/StarOptionsMenu.hpp | 4 |
3 files changed, 22 insertions, 7 deletions
diff --git a/source/frontend/StarMainMixer.cpp b/source/frontend/StarMainMixer.cpp index 16fb736..a0f5e2b 100644 --- a/source/frontend/StarMainMixer.cpp +++ b/source/frontend/StarMainMixer.cpp @@ -54,14 +54,9 @@ void MainMixer::update(float dt, bool muteSfx, bool muteMusic) { currentWorld = m_universeClient->worldClient(); if (currentWorld) { - for (auto audioInstance : currentWorld->pullPendingAudio()) { - audioInstance->setMixerGroup(MixerGroup::Effects); + for (auto audioInstance : currentWorld->pullPendingAudio()) m_mixer->play(audioInstance); - } - for (auto audioInstance : currentWorld->pullPendingInstrumentAudio()) { - audioInstance->setMixerGroup(MixerGroup::Instruments); - m_mixer->play(audioInstance); - } + for (auto audioInstance : currentWorld->pullPendingMusic()) { audioInstance->setMixerGroup(MixerGroup::Music); m_mixer->play(audioInstance); diff --git a/source/frontend/StarOptionsMenu.cpp b/source/frontend/StarOptionsMenu.cpp index caa1b21..0ea1fa1 100644 --- a/source/frontend/StarOptionsMenu.cpp +++ b/source/frontend/StarOptionsMenu.cpp @@ -20,6 +20,9 @@ OptionsMenu::OptionsMenu(PaneManager* manager) GuiReader reader; + reader.registerCallback("instrumentSlider", [=](Widget*) { + updateInstrumentVol(); + }); reader.registerCallback("sfxSlider", [=](Widget*) { updateSFXVol(); }); @@ -67,6 +70,7 @@ OptionsMenu::OptionsMenu(PaneManager* manager) reader.construct(config.get("paneLayout"), this); + m_instrumentSlider = fetchChild<SliderBarWidget>("instrumentSlider"); m_sfxSlider = fetchChild<SliderBarWidget>("sfxSlider"); m_musicSlider = fetchChild<SliderBarWidget>("musicSlider"); m_tutorialMessagesButton = fetchChild<ButtonWidget>("tutorialMessagesCheckbox"); @@ -74,10 +78,12 @@ OptionsMenu::OptionsMenu(PaneManager* manager) m_clientP2PJoinableButton = fetchChild<ButtonWidget>("clientP2PJoinableCheckbox"); m_allowAssetsMismatchButton = fetchChild<ButtonWidget>("allowAssetsMismatchCheckbox"); + m_instrumentLabel = fetchChild<LabelWidget>("instrumentValueLabel"); m_sfxLabel = fetchChild<LabelWidget>("sfxValueLabel"); m_musicLabel = fetchChild<LabelWidget>("musicValueLabel"); m_p2pJoinableLabel = fetchChild<LabelWidget>("clientP2PJoinableLabel"); + m_instrumentSlider->setRange(m_sfxRange, assets->json("/interface/optionsmenu/optionsmenu.config:sfxDelta").toInt()); m_sfxSlider->setRange(m_sfxRange, assets->json("/interface/optionsmenu/optionsmenu.config:sfxDelta").toInt()); m_musicSlider->setRange(m_musicRange, assets->json("/interface/optionsmenu/optionsmenu.config:musicDelta").toInt()); @@ -103,6 +109,7 @@ void OptionsMenu::toggleFullscreen() { } StringList const OptionsMenu::ConfigKeys = { + "instrumentVol", "sfxVol", "musicVol", "tutorialMessages", @@ -120,6 +127,12 @@ void OptionsMenu::initConfig() { } } +void OptionsMenu::updateInstrumentVol() { + m_localChanges.set("instrumentVol", m_instrumentSlider->val()); + Root::singleton().configuration()->set("instrumentVol", m_instrumentSlider->val()); + m_instrumentLabel->setText(toString(m_instrumentSlider->val())); +} + void OptionsMenu::updateSFXVol() { m_localChanges.set("sfxVol", m_sfxSlider->val()); Root::singleton().configuration()->set("sfxVol", m_sfxSlider->val()); @@ -154,6 +167,9 @@ void OptionsMenu::updateAllowAssetsMismatch() { } void OptionsMenu::syncGuiToConf() { + m_instrumentSlider->setVal(m_localChanges.get("instrumentVol").toInt(), false); + m_instrumentLabel->setText(toString(m_instrumentSlider->val())); + m_sfxSlider->setVal(m_localChanges.get("sfxVol").toInt(), false); m_sfxLabel->setText(toString(m_sfxSlider->val())); diff --git a/source/frontend/StarOptionsMenu.hpp b/source/frontend/StarOptionsMenu.hpp index b984f02..d98fb20 100644 --- a/source/frontend/StarOptionsMenu.hpp +++ b/source/frontend/StarOptionsMenu.hpp @@ -29,6 +29,7 @@ private: void initConfig(); + void updateInstrumentVol(); void updateSFXVol(); void updateMusicVol(); void updateTutorialMessages(); @@ -43,6 +44,7 @@ private: void displayModBindings(); void displayGraphics(); + SliderBarWidgetPtr m_instrumentSlider; SliderBarWidgetPtr m_sfxSlider; SliderBarWidgetPtr m_musicSlider; ButtonWidgetPtr m_tutorialMessagesButton; @@ -51,10 +53,12 @@ private: ButtonWidgetPtr m_clientP2PJoinableButton; ButtonWidgetPtr m_allowAssetsMismatchButton; + LabelWidgetPtr m_instrumentLabel; LabelWidgetPtr m_sfxLabel; LabelWidgetPtr m_musicLabel; LabelWidgetPtr m_p2pJoinableLabel; + //TODO: add instrument range (or just use one range for all 3, it's kinda silly.) Vec2I m_sfxRange; Vec2I m_musicRange; |