mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-22 10:19:01 +00:00
redo music volume control and refactor some stuff
This commit is contained in:
parent
f90d25f92a
commit
59f2f6909d
6 changed files with 52 additions and 52 deletions
2
Externals/SlippiRustExtensions
vendored
2
Externals/SlippiRustExtensions
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 0af50920a7a6d84d65bb05202868e6a63ce172be
|
||||
Subproject commit 76b7c3a54020593dc5393cfdb35baf42c55bffab
|
|
@ -34,23 +34,24 @@ namespace Config
|
|||
// Main.Slippi
|
||||
|
||||
// Netplay Settings
|
||||
const Info<u8> SLIPPI_ONLINE_DELAY{{System::Main, "Slippi", "OnlineDelay"}, 2};
|
||||
const Info<int> SLIPPI_ONLINE_DELAY{{System::Main, "Slippi", "OnlineDelay"}, 2};
|
||||
const Info<bool> SLIPPI_ENABLE_SPECTATOR{{System::Main, "Slippi", "EnableSpectator"}, true};
|
||||
const Info<u32> SLIPPI_SPECTATOR_LOCAL_PORT{{System::Main, "Slippi", "SpectatorLocalPort"}, 51441};
|
||||
const Info<int> SLIPPI_SPECTATOR_LOCAL_PORT{{System::Main, "Slippi", "SpectatorLocalPort"}, 51441};
|
||||
const Info<bool> SLIPPI_SAVE_REPLAYS{{System::Main, "Slippi", "SaveReplays"}, true};
|
||||
const Info<Slippi::Chat> SLIPPI_ENABLE_QUICK_CHAT{{System::Main, "Slippi", "EnableQuickChat"},
|
||||
Slippi::Chat::ON};
|
||||
const Info<bool> SLIPPI_FORCE_NETPLAY_PORT{{System::Main, "Slippi", "ForceNetplayPort"}, false};
|
||||
const Info<u32> SLIPPI_NETPLAY_PORT{{System::Main, "Slippi", "NetplayPort"}, 2626};
|
||||
const Info<int> SLIPPI_NETPLAY_PORT{{System::Main, "Slippi", "NetplayPort"}, 2626};
|
||||
const Info<bool> SLIPPI_FORCE_LAN_IP{{System::Main, "Slippi", "ForceLanIP"}, false};
|
||||
const Info<std::string> SLIPPI_LAN_IP{{System::Main, "Slippi", "LanIP"}, ""};
|
||||
const Info<bool> SLIPPI_REPLAY_MONTHLY_FOLDERS{{System::Main, "Slippi", "ReplayMonthlyFolders"}, true};
|
||||
const Info<bool> SLIPPI_REPLAY_MONTHLY_FOLDERS{{System::Main, "Slippi", "ReplayMonthlyFolders"},
|
||||
true};
|
||||
const Info<std::string> SLIPPI_REPLAY_DIR{{System::Main, "Slippi", "ReplayDir"},
|
||||
File::GetHomeDirectory() + DIR_SEP + "Slippi"};
|
||||
const Info<bool> SLIPPI_ENABLE_FRAME_INDEX{{System::Main, "Slippi", "EnableFrameIndex"}, false};
|
||||
const Info<bool> SLIPPI_BLOCKING_PIPES{{System::Main, "Slippi", "BlockingPipes"}, false};
|
||||
const Info<bool> SLIPPI_ENABLE_JUKEBOX{{System::Main, "Slippi", "EnableJukebox"}, true};
|
||||
const Info<int> SLIPPI_SFX_MUSIC_BALANCE{{System::Main, "Slippi", "SFXMusicBalance"}, 21};
|
||||
const Info<int> SLIPPI_JUKEBOX_VOLUME{{System::Main, "Slippi", "JukeboxVolume"}, 100};
|
||||
|
||||
// Playback Settings
|
||||
const Info<bool> SLIPPI_ENABLE_SEEK{{System::Main, "Slippi", "EnableSeek"}, true};
|
||||
|
|
|
@ -54,13 +54,13 @@ namespace Config
|
|||
// Main.Slippi
|
||||
|
||||
// Netplay Settings
|
||||
extern const Info<u8> SLIPPI_ONLINE_DELAY;
|
||||
extern const Info<int> SLIPPI_ONLINE_DELAY;
|
||||
extern const Info<bool> SLIPPI_ENABLE_SPECTATOR;
|
||||
extern const Info<u32> SLIPPI_SPECTATOR_LOCAL_PORT;
|
||||
extern const Info<int> SLIPPI_SPECTATOR_LOCAL_PORT;
|
||||
extern const Info<bool> SLIPPI_SAVE_REPLAYS;
|
||||
extern const Info<Slippi::Chat> SLIPPI_ENABLE_QUICK_CHAT;
|
||||
extern const Info<bool> SLIPPI_FORCE_NETPLAY_PORT;
|
||||
extern const Info<u32> SLIPPI_NETPLAY_PORT;
|
||||
extern const Info<int> SLIPPI_NETPLAY_PORT;
|
||||
extern const Info<bool> SLIPPI_FORCE_LAN_IP;
|
||||
extern const Info<std::string> SLIPPI_LAN_IP;
|
||||
extern const Info<bool> SLIPPI_REPLAY_MONTHLY_FOLDERS;
|
||||
|
@ -68,7 +68,7 @@ extern const Info<std::string> SLIPPI_REPLAY_DIR;
|
|||
extern const Info<bool> SLIPPI_ENABLE_FRAME_INDEX;
|
||||
extern const Info<bool> SLIPPI_BLOCKING_PIPES;
|
||||
extern const Info<bool> SLIPPI_ENABLE_JUKEBOX;
|
||||
extern const Info<int> SLIPPI_SFX_MUSIC_BALANCE;
|
||||
extern const Info<int> SLIPPI_JUKEBOX_VOLUME;
|
||||
|
||||
// Playback Settings
|
||||
extern const Info<bool> SLIPPI_ENABLE_SEEK;
|
||||
|
|
|
@ -135,6 +135,12 @@ void OSDMessageHandler(const char* message, u32 color, u32 duration_ms)
|
|||
OSD::AddMessage(msg, duration_ms, color);
|
||||
}
|
||||
|
||||
// This function gets passed to Jukebox for handling music volume changes
|
||||
int GetJukeboxVolume()
|
||||
{
|
||||
return Config::Get(Config::SLIPPI_JUKEBOX_VOLUME);
|
||||
}
|
||||
|
||||
CEXISlippi::CEXISlippi(Core::System& system, const std::string current_file_name)
|
||||
: IEXIDevice(system)
|
||||
{
|
||||
|
@ -2390,7 +2396,7 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
appendWordToBuffer(&m_read_queue, rngOffset);
|
||||
|
||||
// Add delay frames to output
|
||||
m_read_queue.push_back(static_cast<u8>(Config::Get(Config::SLIPPI_ONLINE_DELAY)));
|
||||
m_read_queue.push_back(static_cast<int>(Config::Get(Config::SLIPPI_ONLINE_DELAY)));
|
||||
|
||||
// Add chat messages id
|
||||
m_read_queue.push_back(static_cast<u8>(sentChatMessageId));
|
||||
|
@ -3287,9 +3293,9 @@ void CEXISlippi::ConfigureJukebox()
|
|||
|
||||
auto& system = Core::System::GetInstance();
|
||||
|
||||
slprs_exi_device_configure_jukebox(slprs_exi_device_ptr,
|
||||
Config::Get(Config::SLIPPI_ENABLE_JUKEBOX),
|
||||
system.GetMemory().GetRAM(), AudioCommonGetCurrentVolume);
|
||||
slprs_exi_device_configure_jukebox(
|
||||
slprs_exi_device_ptr, Config::Get(Config::SLIPPI_ENABLE_JUKEBOX), system.GetMemory().GetRAM(),
|
||||
AudioCommonGetCurrentVolume, GetJukeboxVolume);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QSizePolicy>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
@ -83,7 +81,6 @@ void SlippiPane::CreateLayout()
|
|||
{
|
||||
m_netplay_quick_chat_combo->addItem(item);
|
||||
}
|
||||
m_netplay_quick_chat_combo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
online_settings_layout->addRow(tr("Quick Chat:"), m_netplay_quick_chat_combo);
|
||||
|
||||
m_netplay_port = new QSpinBox();
|
||||
|
@ -104,7 +101,8 @@ void SlippiPane::CreateLayout()
|
|||
|
||||
online_settings_layout->addRow(netplay_port_layout);
|
||||
|
||||
// // i'd like to note that I hate everything about how this is organized for the next two sections
|
||||
// // i'd like to note that I hate everything about how this is organized for the next two
|
||||
// sections
|
||||
// // and a lot of the Qstring bullshit drives me up the wall.
|
||||
// auto* netplay_ip_edit = new QLineEdit();
|
||||
// netplay_ip_edit->setFixedSize(100, 25);
|
||||
|
@ -143,12 +141,12 @@ void SlippiPane::CreateLayout()
|
|||
// online_settings_layout->addRow(netplay_ip_layout);
|
||||
|
||||
// Jukebox Settings
|
||||
auto* jukebox_settings = new QGroupBox(tr("Jukebox Settings"));
|
||||
auto* jukebox_settings = new QGroupBox(tr("Jukebox Settings (Beta)"));
|
||||
auto* jukebox_settings_layout = new QVBoxLayout();
|
||||
jukebox_settings->setLayout(jukebox_settings_layout);
|
||||
m_main_layout->addWidget(jukebox_settings);
|
||||
|
||||
m_enable_jukebox = new QCheckBox(tr("Enable Music (Beta)"));
|
||||
m_enable_jukebox = new QCheckBox(tr("Enable Music"));
|
||||
m_enable_jukebox->setToolTip(
|
||||
tr("Toggle in-game music for stages and menus. Changing this does not affect "
|
||||
"other audio like character hits or effects. Music will not play when "
|
||||
|
@ -156,16 +154,16 @@ void SlippiPane::CreateLayout()
|
|||
jukebox_settings_layout->addWidget(m_enable_jukebox);
|
||||
|
||||
auto* sfx_music_slider_layout = new QGridLayout;
|
||||
m_sfx_music_balance_slider = new QSlider(Qt::Horizontal);
|
||||
m_sfx_music_balance_slider->setRange(0, 41);
|
||||
m_sfx_music_balance_slider->setTickPosition(QSlider::TicksBelow);
|
||||
m_sfx_music_balance_slider->setTickInterval(21);
|
||||
auto* sfx_label = new QLabel(tr("Sound Effects"));
|
||||
auto* music_label = new QLabel(tr("Music"));
|
||||
m_music_volume_slider = new QSlider(Qt::Horizontal);
|
||||
m_music_volume_slider->setRange(0, 100);
|
||||
auto* music_volume_label = new QLabel(tr("Music Volume:"));
|
||||
m_music_volume_percent = new QLabel(tr(""));
|
||||
m_music_volume_percent->setFixedWidth(40);
|
||||
|
||||
sfx_music_slider_layout->addWidget(music_volume_label, 1, 0);
|
||||
sfx_music_slider_layout->addWidget(m_music_volume_slider, 1, 1);
|
||||
sfx_music_slider_layout->addWidget(m_music_volume_percent, 1, 2);
|
||||
|
||||
sfx_music_slider_layout->addWidget(sfx_label, 1, 0);
|
||||
sfx_music_slider_layout->addWidget(m_sfx_music_balance_slider, 1, 1);
|
||||
sfx_music_slider_layout->addWidget(music_label, 1, 2);
|
||||
jukebox_settings_layout->addLayout(sfx_music_slider_layout);
|
||||
|
||||
#else
|
||||
|
@ -206,7 +204,7 @@ void SlippiPane::LoadConfig()
|
|||
m_delay_spin->setValue(Config::Get(Config::SLIPPI_ONLINE_DELAY));
|
||||
m_netplay_quick_chat_combo->setCurrentIndex(
|
||||
static_cast<u8>(Config::Get(Config::SLIPPI_ENABLE_QUICK_CHAT)));
|
||||
|
||||
|
||||
auto force_netplay_port = Config::Get(Config::SLIPPI_FORCE_NETPLAY_PORT);
|
||||
m_force_netplay_port->setChecked(force_netplay_port);
|
||||
m_netplay_port->setValue(Config::Get(Config::SLIPPI_NETPLAY_PORT));
|
||||
|
@ -215,10 +213,12 @@ void SlippiPane::LoadConfig()
|
|||
|
||||
// Jukebox Settings
|
||||
auto enable_jukebox = Config::Get(Config::SLIPPI_ENABLE_JUKEBOX);
|
||||
auto jukebox_volume = Config::Get(Config::SLIPPI_JUKEBOX_VOLUME);
|
||||
m_enable_jukebox->setChecked(enable_jukebox);
|
||||
m_sfx_music_balance_slider->setValue(Config::Get(Config::SLIPPI_SFX_MUSIC_BALANCE));
|
||||
m_music_volume_slider->setValue(jukebox_volume);
|
||||
m_music_volume_percent->setText(tr(" %1%").arg(jukebox_volume));
|
||||
|
||||
m_sfx_music_balance_slider->setDisabled(!enable_jukebox);
|
||||
m_music_volume_slider->setDisabled(!enable_jukebox);
|
||||
}
|
||||
|
||||
void SlippiPane::ConnectLayout()
|
||||
|
@ -242,10 +242,8 @@ void SlippiPane::ConnectLayout()
|
|||
|
||||
// Jukebox Settings
|
||||
connect(m_enable_jukebox, &QCheckBox::toggled, this, &SlippiPane::ToggleJukebox);
|
||||
connect(m_sfx_music_balance_slider, qOverload<int>(&QSlider::valueChanged), this,
|
||||
[](int index) {
|
||||
|
||||
});
|
||||
connect(m_music_volume_slider, qOverload<int>(&QSlider::valueChanged), this,
|
||||
&SlippiPane::OnMusicVolumeUpdate);
|
||||
}
|
||||
|
||||
void SlippiPane::SetSaveReplays(bool checked)
|
||||
|
@ -277,20 +275,8 @@ void SlippiPane::SetForceNetplayPort(bool checked)
|
|||
void SlippiPane::ToggleJukebox(bool checked)
|
||||
{
|
||||
Config::SetBase(Config::SLIPPI_ENABLE_JUKEBOX, checked);
|
||||
m_sfx_music_balance_slider->setDisabled(!checked);
|
||||
m_music_volume_slider->setDisabled(!checked);
|
||||
|
||||
ConfigureJukebox();
|
||||
}
|
||||
|
||||
void SlippiPane::UpdateSFXMusicBalance(int index)
|
||||
{
|
||||
Config::SetBase(Config::SLIPPI_SFX_MUSIC_BALANCE, index);
|
||||
|
||||
ConfigureJukebox();
|
||||
}
|
||||
|
||||
void SlippiPane::ConfigureJukebox()
|
||||
{
|
||||
if (Core::GetState() == Core::State::Running)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
|
@ -303,6 +289,12 @@ void SlippiPane::ConfigureJukebox()
|
|||
}
|
||||
}
|
||||
|
||||
void SlippiPane::OnMusicVolumeUpdate(int volume)
|
||||
{
|
||||
Config::SetBase(Config::SLIPPI_JUKEBOX_VOLUME, volume);
|
||||
m_music_volume_percent->setText(tr(" %1%").arg(volume));
|
||||
}
|
||||
|
||||
void SlippiPane::OnSaveConfig()
|
||||
{
|
||||
Config::ConfigChangeCallbackGuard config_guard;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
|
@ -29,8 +30,7 @@ private:
|
|||
void BrowseReplayFolder();
|
||||
void ToggleJukebox(bool checked);
|
||||
void SetForceNetplayPort(bool checked);
|
||||
void UpdateSFXMusicBalance(int index);
|
||||
void ConfigureJukebox();
|
||||
void OnMusicVolumeUpdate(int volume);
|
||||
void CreateLayout();
|
||||
void LoadConfig();
|
||||
void ConnectLayout();
|
||||
|
@ -52,5 +52,6 @@ private:
|
|||
|
||||
// Jukebox Settings
|
||||
QCheckBox* m_enable_jukebox;
|
||||
QSlider* m_sfx_music_balance_slider;
|
||||
QSlider* m_music_volume_slider;
|
||||
QLabel* m_music_volume_percent;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue