Make static vectors of default driver lists

Currently we are storing the default driver lists as a macro, and splitting them into RString vectors every time they are needed. This commit changes the macros in `arch_default.h` into vectors of RStrings, so that they do not need to be split each time.

I have updated all references where the default driver lists are being called so that the vector is used directly.

A new function is added to RageUtil to make a compatible vector of RStrings from user input which may be separated with a comma.

RageSoundDriver was refactored to check user input in Preferences.ini against the default driver list, and in case of incorrect spelling or failure, provides a detailed error message (including a list of valid options) in logs so the user can resolve the problem.

`fix_bogus_sound_driver_pref` is no longer needed, since we are now telling the user what their valid options are if the user provides an incorrect entry for the `SoundDrivers` preference, instead of silently attempting to guess what the user wanted. Since I think it's rare that someone wants to specify a driver to begin with, we should let them know their exact options if they put something wrong here, instead of silently failing or using an unwanted driver.

I tested this on Windows by specifying `DirectSound-sw` in Preferences.ini, and it worked as expected. I also tried putting an unusable value in, and got the error in logs letting me know what my valid driver options were. Of course, input and movies all work as expected too.
This commit is contained in:
sukibaby
2024-09-22 04:19:06 -07:00
committed by teejusb
parent 804b15959d
commit 0aa41b305d
10 changed files with 118 additions and 55 deletions
-5
View File
@@ -63,11 +63,6 @@ void RageSoundManager::low_sample_count_workaround()
m_pDriver->low_sample_count_workaround();
}
void RageSoundManager::fix_bogus_sound_driver_pref(RString const& valid_setting)
{
g_sSoundDrivers.Set(valid_setting);
}
/*
* Previously, we went to some lengths to shut down sounds before exiting threads.
* The only other thread that actually starts sounds is SOUND. Doing this was ugly;