diff options
author | Wohlstand <admin@wohlnet.ru> | 2024-08-29 16:21:02 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2024-08-29 16:21:02 +0300 |
commit | f97b1719771fda4670d903527cb14ec2979df03b (patch) | |
tree | 6b435735bf9144b415d4a5f4978bcb3262d08d37 /utils/winmm_drv/cpl/config_dialog.c | |
parent | 68d04c38fe74e419283c9784eb0fdaf5cf18e086 (diff) | |
parent | 572da4a9335a5a7f98baaedf1c982f7ac6c385d5 (diff) | |
download | libADLMIDI-f97b1719771fda4670d903527cb14ec2979df03b.tar.gz libADLMIDI-f97b1719771fda4670d903527cb14ec2979df03b.tar.bz2 libADLMIDI-f97b1719771fda4670d903527cb14ec2979df03b.zip |
Merge branch 'master' of git@github.com:Wohlstand/libADLMIDI.git into wip-hw-serial
Diffstat (limited to 'utils/winmm_drv/cpl/config_dialog.c')
-rw-r--r-- | utils/winmm_drv/cpl/config_dialog.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/utils/winmm_drv/cpl/config_dialog.c b/utils/winmm_drv/cpl/config_dialog.c index 195524d..1742ab1 100644 --- a/utils/winmm_drv/cpl/config_dialog.c +++ b/utils/winmm_drv/cpl/config_dialog.c @@ -1,5 +1,6 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +#include <mmsystem.h> #include <commctrl.h> #include <commdlg.h> #include <string.h> @@ -38,6 +39,15 @@ static const char *const volume_models_descriptions[] = NULL }; +static const char *const channel_allocation_descriptions[] = +{ + "Auto (defined by bank)", + "Sounding off delay based", + "Same instrument", + "Any first released", + NULL +}; + static const char * const emulator_type_descriptions[] = { "Nuked OPL3 1.8", @@ -50,6 +60,7 @@ static const char * const emulator_type_descriptions[] = static DriverSettings g_setup; static HINSTANCE s_hModule; +static UINT s_audioOutPrev = WAVE_MAPPER; static void syncBankType(HWND hwnd, int type); static void sync4ops(HWND hwnd); @@ -88,6 +99,11 @@ static void syncWidget(HWND hwnd) else SendDlgItemMessage(hwnd, IDC_BANK_INTERNAL, BM_SETCHECK, 1, 0); + SendDlgItemMessage(hwnd, IDC_GAIN, TBM_SETRANGE, TRUE, MAKELPARAM(0, 1000)); + SendDlgItemMessage(hwnd, IDC_GAIN, TBM_SETPAGESIZE, 0, 10); + SendDlgItemMessage(hwnd, IDC_GAIN, TBM_SETTICFREQ, 100, 0); + SendDlgItemMessage(hwnd, IDC_GAIN, TBM_SETPOS, TRUE, g_setup.gain100); + syncBankType(hwnd, g_setup.useExternalBank); SendDlgItemMessage(hwnd, IDC_FLAG_TREMOLO, BM_SETCHECK, g_setup.flagDeepTremolo, 0); @@ -109,6 +125,12 @@ static void syncWidget(HWND hwnd) updateBankName(hwnd, g_setup.bankPath); SendDlgItemMessageA(hwnd, IDC_EMULATOR, CB_SETCURSEL, (WPARAM)g_setup.emulatorId, (LPARAM)0); SendDlgItemMessageA(hwnd, IDC_VOLUMEMODEL, CB_SETCURSEL, (WPARAM)g_setup.volumeModel, (LPARAM)0); + SendDlgItemMessageA(hwnd, IDC_CHANALLOC, CB_SETCURSEL, (WPARAM)g_setup.chanAlloc + 1, (LPARAM)0); + + if(g_setup.outputDevice == WAVE_MAPPER) + SendDlgItemMessageA(hwnd, IDC_AUDIOOUT, CB_SETCURSEL, (WPARAM)0, (LPARAM)0); + else + SendDlgItemMessageA(hwnd, IDC_AUDIOOUT, CB_SETCURSEL, (WPARAM)g_setup.outputDevice + 1, (LPARAM)0); sync4ops(hwnd); } @@ -116,6 +138,8 @@ static void syncWidget(HWND hwnd) static void buildLists(HWND hwnd) { int i, bMax; + UINT ai, aMax; + WAVEOUTCAPSW wavDev; HMODULE lib; const char *const* list; BankNamesCount adl_getBanksCount; @@ -152,11 +176,27 @@ static void buildLists(HWND hwnd) SendDlgItemMessageA(hwnd, IDC_VOLUMEMODEL, CB_ADDSTRING, (LPARAM)0, (LPARAM)volume_models_descriptions[i]); } + // Channel allocation mode + for(i = 0; channel_allocation_descriptions[i] != NULL; ++i) + { + SendDlgItemMessageA(hwnd, IDC_CHANALLOC, CB_ADDSTRING, (LPARAM)0, (LPARAM)channel_allocation_descriptions[i]); + } + // Emulators list for(i = 0; emulator_type_descriptions[i] != NULL; ++i) { SendDlgItemMessageA(hwnd, IDC_EMULATOR, CB_ADDSTRING, (LPARAM)0, (LPARAM)emulator_type_descriptions[i]); } + + // Audio devices + aMax = waveOutGetNumDevs(); + SendDlgItemMessageW(hwnd, IDC_AUDIOOUT, CB_ADDSTRING, (LPARAM)0, (WPARAM)L"[Default device]"); + for(ai = 0; ai < aMax; ++ai) + { + memset(&wavDev, 0, sizeof(wavDev)); + waveOutGetDevCapsW(ai, &wavDev, sizeof(wavDev)); + SendDlgItemMessageW(hwnd, IDC_AUDIOOUT, CB_ADDSTRING, (LPARAM)0, (WPARAM)wavDev.szPname); + } } static void syncBankType(HWND hwnd, int type) @@ -209,6 +249,18 @@ static void openCustomBank(HWND hwnd) } } +static void warnIfOutChanged(HWND hwnd) +{ + if(s_audioOutPrev != g_setup.outputDevice) + { + s_audioOutPrev = g_setup.outputDevice; + MessageBoxW(hwnd, + L"To apply the change of the audio output device, you should reload your applications.", + L"Audio output device changed", + MB_OK|MB_ICONINFORMATION); + } +} + INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) @@ -218,6 +270,16 @@ INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPar syncWidget(hwnd); return TRUE; + case WM_HSCROLL: + if(lParam == (LPARAM)GetDlgItem(hwnd, IDC_GAIN)) + { + g_setup.gain100 = SendMessageW((HWND)lParam, (UINT)TBM_GETPOS, (WPARAM)0, (LPARAM)0); + saveGain(&g_setup); + sendSignal(DRV_SIGNAL_UPDATE_GAIN); + break; + } + break; + case WM_COMMAND: switch(LOWORD(wParam)) { @@ -230,6 +292,17 @@ INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPar MB_OK); break; + case IDC_AUDIOOUT: + if(HIWORD(wParam) == CBN_SELCHANGE) + { + g_setup.outputDevice = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + if(g_setup.outputDevice == 0) + g_setup.outputDevice = WAVE_MAPPER; + else + g_setup.outputDevice--; + } + break; + case IDC_NUM_CHIPS: if(HIWORD(wParam) == CBN_SELCHANGE) { @@ -260,6 +333,13 @@ INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPar } break; + case IDC_CHANALLOC: + if(HIWORD(wParam) == CBN_SELCHANGE) + { + g_setup.chanAlloc = SendMessageW((HWND)lParam, (UINT)CB_GETCURSEL, (WPARAM)0, (LPARAM)0) - 1; + } + break; + case IDC_BANK_INTERNAL: g_setup.useExternalBank = 0; syncBankType(hwnd, FALSE); @@ -329,11 +409,13 @@ INT_PTR CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPar case IDC_APPLYBUTTON: saveSetup(&g_setup); sendSignal(DRV_SIGNAL_RELOAD_SETUP); + warnIfOutChanged(hwnd); break; case IDOK: saveSetup(&g_setup); sendSignal(DRV_SIGNAL_RELOAD_SETUP); + warnIfOutChanged(hwnd); EndDialog(hwnd, IDOK); break; @@ -358,6 +440,8 @@ BOOL runAdlSetupBox(HINSTANCE hModule, HWND hwnd) s_hModule = hModule; loadSetup(&g_setup); + // Keep the last audio output setup for the future + s_audioOutPrev = g_setup.outputDevice; DialogBoxW(hModule, MAKEINTRESOURCEW(IDD_CONFIG_BOX), hwnd, ToolDlgProc); |