aboutsummaryrefslogtreecommitdiff
path: root/utils/winmm_drv/config/regconfig.c
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2024-08-22 10:19:38 +0300
committerWohlstand <admin@wohlnet.ru>2024-08-22 10:19:38 +0300
commit23dc374917acd0d7100c6e9db7ae5333338cee28 (patch)
treecdfcc2e859abd52b1618da1959db1fb88864d1ee /utils/winmm_drv/config/regconfig.c
parent5cce67a4b4d59ff1c75697a64e25ac8f5625d87d (diff)
downloadlibADLMIDI-23dc374917acd0d7100c6e9db7ae5333338cee28.tar.gz
libADLMIDI-23dc374917acd0d7100c6e9db7ae5333338cee28.tar.bz2
libADLMIDI-23dc374917acd0d7100c6e9db7ae5333338cee28.zip
WinMM: Added chan-alloc and audio output options
Diffstat (limited to 'utils/winmm_drv/config/regconfig.c')
-rw-r--r--utils/winmm_drv/config/regconfig.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/utils/winmm_drv/config/regconfig.c b/utils/winmm_drv/config/regconfig.c
index 353cea2..6e35df0 100644
--- a/utils/winmm_drv/config/regconfig.c
+++ b/utils/winmm_drv/config/regconfig.c
@@ -93,13 +93,15 @@ static BOOL readIntFromRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCH
{
WCHAR *buf = NULL;
BOOL ret;
+
ret = readStringFromRegistry(hKeyParent, subkey, valueName, &buf);
+
if(ret && readData)
- {
*readData = _wtoi(buf);
- }
+
if(buf)
free(buf);
+
return ret;
}
@@ -115,6 +117,34 @@ static BOOL writeIntToRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHA
return ret;
}
+static BOOL readUIntFromRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHAR valueName, UINT *readData)
+{
+ WCHAR *buf = NULL;
+ BOOL ret;
+
+ ret = readStringFromRegistry(hKeyParent, subkey, valueName, &buf);
+
+ if(ret && readData)
+ *readData = wcstoul(buf, NULL, 10);
+
+ if(buf)
+ free(buf);
+
+ return ret;
+}
+
+static BOOL writeUIntToRegistry(HKEY hKeyParent, const PWCHAR subkey, const PWCHAR valueName, UINT intData)
+{
+ WCHAR buf[20];
+ BOOL ret;
+
+ ZeroMemory(buf, 20);
+ _snwprintf(buf, 20, L"%u", intData);
+
+ ret = writeStringToRegistry(hKeyParent, subkey, valueName, buf);
+ return ret;
+}
+
@@ -133,8 +163,11 @@ void setupDefault(DriverSettings *setup)
setup->flagFullBrightness = BST_UNCHECKED;
setup->volumeModel = 0;
+ setup->chanAlloc = 0;
setup->numChips = 4;
setup->num4ops = -1;
+
+ setup->outputDevice = (UINT)-1;
}
@@ -144,6 +177,7 @@ static const PWCHAR s_regPath = L"SOFTWARE\\Wohlstand\\libADLMIDI";
void loadSetup(DriverSettings *setup)
{
int iVal;
+ UINT uVal;
WCHAR *sVal = NULL;
if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"useExternalBank", &iVal))
@@ -179,11 +213,17 @@ void loadSetup(DriverSettings *setup)
if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"volumeModel", &iVal))
setup->volumeModel = iVal;
+ if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"chanAlloc", &iVal))
+ setup->chanAlloc = iVal;
+
if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"numChips", &iVal))
setup->numChips = iVal;
if(readIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"num4ops", &iVal))
setup->num4ops = iVal;
+
+ if(readUIntFromRegistry(HKEY_CURRENT_USER, s_regPath, L"outputDevice", &uVal))
+ setup->outputDevice = uVal;
}
void saveSetup(DriverSettings *setup)
@@ -202,8 +242,10 @@ void saveSetup(DriverSettings *setup)
writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"flagFullBrightness", setup->flagFullBrightness);
writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"volumeModel", setup->volumeModel);
+ writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"chanAlloc", setup->chanAlloc);
writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"numChips", setup->numChips);
writeIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"num4ops", setup->num4ops);
+ writeUIntToRegistry(HKEY_CURRENT_USER, s_regPath, L"outputDevice", setup->outputDevice);
}