mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-09 03:37:49 +03:00
Added volume into imgui
This commit is contained in:
parent
a66816a986
commit
d107567276
@ -118,8 +118,11 @@ void func_80011890(Note* note, NoteAttributes* noteAttr) {
|
|||||||
if (velocity > 1.0f) {
|
if (velocity > 1.0f) {
|
||||||
velocity = 1.0f;
|
velocity = 1.0f;
|
||||||
}
|
}
|
||||||
noteSub->panVolLeft = (s32) (velocity * panVolumeLeft * 4095.999f);
|
|
||||||
noteSub->panVolRight = (s32) (velocity * pamVolumeRight * 4095.999f);
|
float master_vol = CVarGetFloat("gGameMasterVolume", 1.0f);
|
||||||
|
noteSub->panVolLeft = (s32) (velocity * panVolumeLeft * 4095.999f) * master_vol;
|
||||||
|
noteSub->panVolRight = (s32) (velocity * pamVolumeRight * 4095.999f) * master_vol;
|
||||||
|
|
||||||
noteSub->gain = noteAttr->gain;
|
noteSub->gain = noteAttr->gain;
|
||||||
if (noteSub->reverb != reverb) {
|
if (noteSub->reverb != reverb) {
|
||||||
noteSub->reverb = reverb;
|
noteSub->reverb = reverb;
|
||||||
|
@ -447,6 +447,9 @@ void Game_Update(void) {
|
|||||||
#ifdef MODS_BOOT_STATE
|
#ifdef MODS_BOOT_STATE
|
||||||
gNextGameState = MODS_BOOT_STATE;
|
gNextGameState = MODS_BOOT_STATE;
|
||||||
#endif
|
#endif
|
||||||
|
CVarSetFloat("gMainMusicVolume", gSaveFile.save.data.musicVolume / 100.0f);
|
||||||
|
CVarSetFloat("gVoiceVolume", gSaveFile.save.data.voiceVolume / 100.0f);
|
||||||
|
CVarSetFloat("gSFXMusicVolume", gSaveFile.save.data.sfxVolume / 100.0f);
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
gBoostButton[i] = L_CBUTTONS;
|
gBoostButton[i] = L_CBUTTONS;
|
||||||
gBrakeButton[i] = D_CBUTTONS;
|
gBrakeButton[i] = D_CBUTTONS;
|
||||||
|
@ -1437,14 +1437,17 @@ void Option_Sound_SetVolumeLevels(void) {
|
|||||||
switch (D_menu_801B9288 - 1) {
|
switch (D_menu_801B9288 - 1) {
|
||||||
case 0:
|
case 0:
|
||||||
gSaveFile.save.data.musicVolume = var_v1;
|
gSaveFile.save.data.musicVolume = var_v1;
|
||||||
|
CVarSetFloat("gMainMusicVolume", var_v1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
gSaveFile.save.data.voiceVolume = var_v1;
|
gSaveFile.save.data.voiceVolume = var_v1;
|
||||||
|
CVarSetFloat("gVoiceVolume", var_v1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
gSaveFile.save.data.sfxVolume = var_v1;
|
gSaveFile.save.data.sfxVolume = var_v1;
|
||||||
|
CVarSetFloat("gSFXMusicVolume", var_v1 / 100.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Audio_SetVolume(D_menu_801B924C, var_v1);
|
Audio_SetVolume(D_menu_801B924C, var_v1);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
#include <sf64audio_provisional.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GameUI {
|
namespace GameUI {
|
||||||
@ -88,56 +89,62 @@ static const char* filters[3] = {
|
|||||||
|
|
||||||
void DrawSettingsMenu(){
|
void DrawSettingsMenu(){
|
||||||
if(UIWidgets::BeginMenu("Settings")){
|
if(UIWidgets::BeginMenu("Settings")){
|
||||||
// if (UIWidgets::BeginMenu("Audio")) {
|
if (UIWidgets::BeginMenu("Audio")) {
|
||||||
// UIWidgets::CVarSliderFloat("Master Volume", "gGameMasterVolume", 0.0f, 1.0f, 1.0f, {
|
UIWidgets::CVarSliderFloat("Master Volume", "gGameMasterVolume", 0.0f, 1.0f, 1.0f, {
|
||||||
// .format = "%.0f%%",
|
.format = "%.0f%%",
|
||||||
// .isPercentage = true,
|
.isPercentage = true,
|
||||||
// });
|
});
|
||||||
// if (UIWidgets::CVarSliderFloat("Main Music Volume", "gMainMusicVolume", 0.0f, 1.0f, 1.0f, {
|
if (UIWidgets::CVarSliderFloat("Main Music Volume", "gMainMusicVolume", 0.0f, 1.0f, 1.0f, {
|
||||||
// .format = "%.0f%%",
|
.format = "%.0f%%",
|
||||||
// .isPercentage = true,
|
.isPercentage = true,
|
||||||
// })) {
|
})) {
|
||||||
// audio_set_player_volume(SEQ_PLAYER_LEVEL, CVarGetFloat("gMainMusicVolume", 1.0f));
|
float val = CVarGetFloat("gMainMusicVolume", 1.0f) * 100;
|
||||||
// }
|
gSaveFile.save.data.musicVolume = val;
|
||||||
// if (UIWidgets::CVarSliderFloat("Sound Effects Volume", "gSFXMusicVolume", 0.0f, 1.0f, 1.0f, {
|
Audio_SetVolume(AUDIO_TYPE_MUSIC, val);
|
||||||
// .format = "%.0f%%",
|
}
|
||||||
// .isPercentage = true,
|
if (UIWidgets::CVarSliderFloat("Voice Volume", "gVoiceVolume", 0.0f, 1.0f, 1.0f, {
|
||||||
// })) {
|
.format = "%.0f%%",
|
||||||
// audio_set_player_volume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f));
|
.isPercentage = true,
|
||||||
// }
|
})) {
|
||||||
// if (UIWidgets::CVarSliderFloat("Environment Volume", "gEnvironmentVolume", 0.0f, 1.0f, 1.0f, {
|
float val = CVarGetFloat("gVoiceVolume", 1.0f) * 100;
|
||||||
// .format = "%.0f%%",
|
gSaveFile.save.data.voiceVolume = val;
|
||||||
// .isPercentage = true,
|
Audio_SetVolume(AUDIO_TYPE_VOICE, val);
|
||||||
// })) {
|
}
|
||||||
// audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f));
|
if (UIWidgets::CVarSliderFloat("Sound Effects Volume", "gSFXMusicVolume", 0.0f, 1.0f, 1.0f, {
|
||||||
// }
|
.format = "%.0f%%",
|
||||||
|
.isPercentage = true,
|
||||||
|
})) {
|
||||||
|
float val = CVarGetFloat("gSFXMusicVolume", 1.0f) * 100;
|
||||||
|
gSaveFile.save.data.sfxVolume = val;
|
||||||
|
Audio_SetVolume(AUDIO_TYPE_SFX, val);
|
||||||
|
}
|
||||||
|
|
||||||
// static std::unordered_map<Ship::AudioBackend, const char*> audioBackendNames = {
|
static std::unordered_map<Ship::AudioBackend, const char*> audioBackendNames = {
|
||||||
// { Ship::AudioBackend::WASAPI, "Windows Audio Session API" },
|
{ Ship::AudioBackend::WASAPI, "Windows Audio Session API" },
|
||||||
// { Ship::AudioBackend::SDL, "SDL" },
|
{ Ship::AudioBackend::SDL, "SDL" },
|
||||||
// };
|
};
|
||||||
|
|
||||||
// ImGui::Text("Audio API (Needs reload)");
|
ImGui::Text("Audio API (Needs reload)");
|
||||||
// auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend();
|
auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetCurrentAudioBackend();
|
||||||
|
|
||||||
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||||
// UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
|
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
|
||||||
// }
|
}
|
||||||
// if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) {
|
if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) {
|
||||||
// for (uint8_t i = 0; i < Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) {
|
for (uint8_t i = 0; i < Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) {
|
||||||
// auto backend = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i];
|
auto backend = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i];
|
||||||
// if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) {
|
if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) {
|
||||||
// Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(backend);
|
Ship::Context::GetInstance()->GetAudio()->SetCurrentAudioBackend(backend);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
// }
|
}
|
||||||
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||||
// UIWidgets::ReEnableComponent("");
|
UIWidgets::ReEnableComponent("");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
// }
|
}
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user