Last active
August 9, 2025 10:53
-
-
Save sergioperez/07fc3d2174f8f5b6f46de761d8c8c12b to your computer and use it in GitHub Desktop.
ITGMania/StepMania Snippet to
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Note: I'm not proficient in C++/LUA or the StepMania engine - This might not be the ideal implementation -> Just a test - "_fallback/Scripts/03 DisplaySpecs.lua" has some kind of "cached" implementation | |
| # metrics.ini - ScreenGraphicsSoundOptions | |
| ## Add LineSoundDevice | |
| LineSoundDevice="lua,OperatorMenuOptionRows.SoundDevice() | |
| ## Add it to LineNames= | |
| ## Add function to SL-OperatorMenuOptions.lua | |
| OperatorMenuOptionRows.SoundDriver = function() | |
| local choices = { "" } | |
| local values = { "" } | |
| local soundDrivers = get_sound_driver_list() | |
| for i, driverName in ipairs(soundDrivers) do | |
| choices[i+1] = driverName | |
| values[i+1] = driverName | |
| end | |
| return { | |
| Name = "SoundDriver", | |
| Choices = choices, | |
| LayoutType = "ShowAllInRow", | |
| SelectType = "SelectOne", | |
| OneChoiceForAllPlayers = true, | |
| ExportOnChange = false, | |
| LoadSelections = function(self, list, pn) | |
| local pref = PREFSMAN:GetPreference("SoundDriver") | |
| -- Multiple comma-delimited sound drivers may be listed, but | |
| -- we only want the first because that's the one actually in use. | |
| -- Split the string on commas, get the first match found, and | |
| -- immediately break from the loop. | |
| for driver in pref:gmatch("([^,]+),?") do | |
| pref = driver | |
| break | |
| end | |
| if not pref then return end | |
| local i = FindInTable(pref, self.Choices) or 1 | |
| list[i] = true | |
| end, | |
| SaveSelections = function(self, list, pn) | |
| for i=1, #list do | |
| if list[i] then | |
| PREFSMAN:SetPreference("SoundDriver", values[i]) | |
| break | |
| end | |
| end | |
| end, | |
| } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment