mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-07 12:03:24 -04:00
Fixes audio volume at boot if changed (#270)
* Fixes audio volume at boot if changed * Update Settings refactor for settings we want to update in the future * remove unused include --------- Co-authored-by: MelonSpeedruns <melonspeedruns@stratobox.net>
This commit is contained in:
@@ -8,6 +8,8 @@ namespace dusk::audio {
|
||||
*/
|
||||
void Initialize();
|
||||
|
||||
void SetEnableReverb(bool value);
|
||||
|
||||
void SetMasterVolume(f32 value);
|
||||
|
||||
u32 GetResetCount(int channelIdx);
|
||||
|
||||
@@ -76,6 +76,12 @@ void dusk::audio::SetMasterVolume(const f32 value) {
|
||||
MasterVolume = value;
|
||||
}
|
||||
|
||||
void dusk::audio::SetEnableReverb(const bool value) {
|
||||
JASCriticalSection section;
|
||||
|
||||
EnableReverb = value;
|
||||
}
|
||||
|
||||
void SDLCALL GetNewAudio(
|
||||
void*,
|
||||
SDL_AudioStream*,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
#include "dusk/config.hpp"
|
||||
#include "dusk/settings.h"
|
||||
#include "dusk/audio/DuskAudioSystem.h"
|
||||
|
||||
#if _WIN32
|
||||
#define NOMINMAX
|
||||
@@ -178,13 +179,19 @@ namespace dusk {
|
||||
|
||||
ImGuiConsole::ImGuiConsole() {}
|
||||
|
||||
void ImGuiConsole::UpdateSettings() {
|
||||
dusk::audio::SetMasterVolume(dusk::getSettings().audio.masterVolume / 100.0f);
|
||||
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);
|
||||
getTransientSettings().skipFrameRateLimit = getSettings().game.enableTurboKeybind && ImGui::IsKeyDown(ImGuiKey_Tab);
|
||||
}
|
||||
|
||||
void ImGuiConsole::PreDraw() {
|
||||
if (!m_isLaunchInitialized) {
|
||||
m_toasts.emplace_back("Press F1 to toggle menu"s, 5.f);
|
||||
m_isLaunchInitialized = true;
|
||||
}
|
||||
|
||||
getTransientSettings().skipFrameRateLimit = getSettings().game.enableTurboKeybind && ImGui::IsKeyDown(ImGuiKey_Tab);
|
||||
UpdateSettings();
|
||||
|
||||
if ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) &&
|
||||
ImGui::IsKeyPressed(ImGuiKey_R))
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace dusk {
|
||||
class ImGuiConsole {
|
||||
public:
|
||||
ImGuiConsole();
|
||||
void UpdateSettings();
|
||||
void PreDraw();
|
||||
void PostDraw();
|
||||
|
||||
|
||||
@@ -78,9 +78,6 @@ namespace dusk {
|
||||
}
|
||||
*/
|
||||
|
||||
audio::SetMasterVolume(getSettings().audio.masterVolume / 100.0f);
|
||||
audio::EnableReverb = getSettings().audio.enableReverb;
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user