From 333bc6231de9e7ae9e0e7d1e7ad50dfb5f4ba547 Mon Sep 17 00:00:00 2001 From: Matthew Kilgore Date: Fri, 26 Aug 2022 23:37:32 -0400 Subject: [PATCH] Allow selecting audio backend in IDE This change allows selecting the audio backend to use in your compiler programs. The selection can be made via the 'Compiler Settings' dialog in the IDE (renamed from the 'C++ Compiler Settings' dialog). The new miniaudio backend is the default, a checkbox for "Use old audio backend" exists in the IDE for switching back to the old backend (in the event someone runs into compatibility issues or etc.). Eventually we'll drop the old one. --- source/global/IDEsettings.bas | 3 +++ source/ide/ide_methods.bas | 24 ++++++++++++++++++++---- source/qb64pe.bas | 14 ++++++++++---- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index 7069b9108..d703d5613 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -25,6 +25,7 @@ DIM SHARED MaxParallelProcesses AS _UNSIGNED LONG DIM SHARED ExtraCppFlags AS STRING, ExtraLinkerFlags AS STRING DIM SHARED StripDebugSymbols AS _UNSIGNED LONG DIM SHARED OptimizeCppProgram AS _UNSIGNED LONG +DIM SHARED UseMiniaudioBackend AS _UNSIGNED LONG ConfigFile$ = "internal/config.ini" iniFolderIndex$ = STR$(tempfolderindex) @@ -535,5 +536,7 @@ MaxParallelProcesses = ReadWriteLongSettingValue&(compilerSettingsSection$, "Max ExtraCppFlags = ReadWriteStringSettingValue$(compilerSettingsSection$, "ExtraCppFlags", "") ExtraLinkerFlags = ReadWriteStringSettingValue$(compilerSettingsSection$, "ExtraLinkerFlags", "") +UseMiniaudioBackend = ReadWriteBooleanSettingValue%(compilerSettingsSection$, "UseMiniaudioBackend", -1) + 'End of initial settings ------------------------------------------------------ diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 036740177..173f88c74 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -399,8 +399,8 @@ FUNCTION ide2 (ignore) menuDesc$(m, i - 1) = "Changes or customizes IDE color scheme" menu$(m, i) = "#Code Layout...": i = i + 1 menuDesc$(m, i - 1) = "Changes auto-format features" - menu$(m, i) = "C++ Co#mpiler Settings...": i = i + 1 - menuDesc$(m, i - 1) = "Change settings for compiling the C++ code" + menu$(m, i) = "Co#mpiler Settings...": i = i + 1 + menuDesc$(m, i - 1) = "Change settings for compiling your code" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Language...": i = i + 1 menuDesc$(m, i - 1) = "Changes code page to use with TTF fonts" @@ -5103,7 +5103,7 @@ FUNCTION ide2 (ignore) GOTO ideloop END IF - IF menu$(m, s) = "C++ Co#mpiler Settings..." THEN + IF menu$(m, s) = "Co#mpiler Settings..." THEN PCOPY 2, 0 retval = ideCompilerSettingsBox IF retval THEN idechangemade = 1: idelayoutallow = 2: startPausedPending = 0 'recompile if options changed @@ -15123,6 +15123,7 @@ FUNCTION ideCompilerSettingsBox DIM maxParallelTextBox AS LONG DIM extraCppFlagsTextBox AS LONG DIM extraLinkerFlagsTextBox AS LONG + DIM useOldAudioBackend AS LONG sep = CHR$(0) '-------- end of generic dialog box header -------- @@ -15185,6 +15186,15 @@ FUNCTION ideCompilerSettingsBox y = y + 1 ' Blank line + i = i + 1 + useOldAudioBackend = i + o(i).typ = 4 'check box + y = y + 1: o(i).y = y + o(i).nam = idenewtxt("#Use old audio backend (LGPL)") + o(i).sel = NOT UseMiniaudioBackend + + y = y + 1 ' Blank line + i = i + 1 buttonsid = i o(i).typ = 3 @@ -15192,7 +15202,7 @@ FUNCTION ideCompilerSettingsBox o(i).txt = idenewtxt("#OK" + sep + "#Cancel") o(i).dft = 1 - idepar p, 60, y, "C++ Compiler Settings" + idepar p, 60, y, "Compiler Settings" '-------- end of init -------- '-------- generic init -------- @@ -15289,6 +15299,12 @@ FUNCTION ideCompilerSettingsBox WriteConfigSetting generalSettingsSection$, "DebugInfo", BoolToTFString$(Include_GDB_Debugging_Info) END IF + v% = o(useOldAudioBackend).sel: IF v% <> 0 THEN v% = -1 + IF UseMiniaudioBackend <> NOT v% THEN + UseMiniaudioBackend = NOT v% + WriteConfigSetting compilerSettingsSection$, "UseMiniaudioBackend", BoolToTFString$(UseMiniaudioBackend) + END IF + v% = VAL(idetxt(o(maxParallelTextBox).txt)) IF v% > 0 AND v% <> MaxParallelProcesses THEN MaxParallelProcesses = v% diff --git a/source/qb64pe.bas b/source/qb64pe.bas index 1eb8019e8..68b76ea0b 100644 --- a/source/qb64pe.bas +++ b/source/qb64pe.bas @@ -12366,15 +12366,21 @@ IF DEPENDENCY(DEPENDENCY_ICON) THEN makedeps$ = makedeps$ + " DEP_ICON=y" IF DEPENDENCY(DEPENDENCY_SCREENIMAGE) THEN makedeps$ = makedeps$ + " DEP_SCREENIMAGE=y" IF DEPENDENCY(DEPENDENCY_LOADFONT) THEN makedeps$ = makedeps$ + " DEP_FONT=y" IF DEPENDENCY(DEPENDENCY_DEVICEINPUT) THEN makedeps$ = makedeps$ + " DEP_DEVICEINPUT=y" -IF DEPENDENCY(DEPENDENCY_AUDIO_DECODE) THEN makedeps$ = makedeps$ + " DEP_AUDIO_DECODE=y" -IF DEPENDENCY(DEPENDENCY_AUDIO_CONVERSION) THEN makedeps$ = makedeps$ + " DEP_AUDIO_CONVERSION=y" -IF DEPENDENCY(DEPENDENCY_AUDIO_DECODE) THEN makedeps$ = makedeps$ + " DEP_AUDIO_DECODE=y" -IF DEPENDENCY(DEPENDENCY_AUDIO_OUT) THEN makedeps$ = makedeps$ + " DEP_AUDIO_OUT=y" IF DEPENDENCY(DEPENDENCY_ZLIB) THEN makedeps$ = makedeps$ + " DEP_ZLIB=y" IF inline_DATA = 0 AND DataOffset THEN makedeps$ = makedeps$ + " DEP_DATA=y" IF Console THEN makedeps$ = makedeps$ + " DEP_CONSOLE=y" IF ExeIconSet OR VersionInfoSet THEN makedeps$ = makedeps$ + " DEP_ICON_RC=y" +IF UseMiniaudioBackend = 0 THEN + IF DEPENDENCY(DEPENDENCY_AUDIO_DECODE) THEN makedeps$ = makedeps$ + " DEP_AUDIO_DECODE=y" + IF DEPENDENCY(DEPENDENCY_AUDIO_CONVERSION) THEN makedeps$ = makedeps$ + " DEP_AUDIO_CONVERSION=y" + IF DEPENDENCY(DEPENDENCY_AUDIO_OUT) THEN makedeps$ = makedeps$ + " DEP_AUDIO_OUT=y" +ELSE + IF DEPENDENCY(DEPENDENCY_AUDIO_DECODE) OR DEPENDENCY(DEPENDENCY_AUDIO_CONVERSION) OR DEPENDENCY(DEPENDENCY_AUDIO_OUT) THEN + makedeps$ = makedeps$ + " DEP_AUDIO_MINIAUDIO=y" + END IF +END IF + IF tempfolderindex > 1 THEN makedeps$ = makedeps$ + " TEMP_ID=" + str2$(tempfolderindex) CxxFlagsExtra$ = ExtraCppFlags