fix: don't output music if null backend is selected

This commit is contained in:
Nikhil Narayana 2024-06-01 11:36:45 -07:00
commit b01b40ece0
No known key found for this signature in database
GPG key ID: 2D6E647B8732451F

View file

@ -116,7 +116,8 @@ std::string ConvertConnectCodeForGame(const std::string& input)
signed char full_width_shift_jis_hashtag[] = {-127, -108, 0}; // 0x81, 0x94, 0x00
std::string connect_code(input);
// SLIPPITODONot the best use of ReplaceAll. potential bug if more than one '#' found.
connect_code = ReplaceAll(connect_code, "#", std::string(reinterpret_cast<const char*>(full_width_shift_jis_hashtag)));
connect_code = ReplaceAll(
connect_code, "#", std::string(reinterpret_cast<const char*>(full_width_shift_jis_hashtag)));
// fixed length + full width (two byte) hashtag +1, null terminator +1
connect_code.resize(CONNECT_CODE_LENGTH + 2);
return connect_code;
@ -3310,8 +3311,8 @@ void CEXISlippi::ConfigureJukebox()
// Exclusive WASAPI will prevent Jukebox from running on the main device, relegating it to another
// device at random, so we will simply prevent Jukebox from running if the user is using WASAPI on
// the default device (assuming they don't select the default device directly).
#ifdef _WIN32
std::string backend = Config::Get(Config::MAIN_AUDIO_BACKEND);
#ifdef _WIN32
std::string audio_device = Config::Get(Config::MAIN_WASAPI_DEVICE);
if (backend.find(BACKEND_WASAPI) != std::string::npos && audio_device == "default")
{
@ -3321,8 +3322,10 @@ void CEXISlippi::ConfigureJukebox()
}
#endif
int dolphin_system_volume =
Config::Get(Config::MAIN_AUDIO_MUTED) ? 0 : Config::Get(Config::MAIN_AUDIO_VOLUME);
bool no_audio_output = backend.find(BACKEND_NULLSOUND) != std::string::npos;
int dolphin_system_volume = Config::Get(Config::MAIN_AUDIO_MUTED) || no_audio_output ?
0 :
Config::Get(Config::MAIN_AUDIO_VOLUME);
int dolphin_music_volume = Config::Get(Config::SLIPPI_JUKEBOX_VOLUME);