https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5b2ff8a3f98f0f2eb6232…
commit 5b2ff8a3f98f0f2eb62321d35ff61b8bfcb938f0
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Mar 18 14:15:12 2018 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Mar 18 14:15:12 2018 +0100
[SNDVOL32] Add the ability to select the record mode by using the /r option and select
the right mixer after changing the mixer preferences
---
base/applications/sndvol32/mixer.c | 4 ++--
base/applications/sndvol32/sndvol32.c | 24 ++++++++++++------------
base/applications/sndvol32/sndvol32.h | 3 ++-
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/base/applications/sndvol32/mixer.c b/base/applications/sndvol32/mixer.c
index 6de6ed4b53..1f1be9451e 100644
--- a/base/applications/sndvol32/mixer.c
+++ b/base/applications/sndvol32/mixer.c
@@ -66,7 +66,7 @@ ClearMixerCache(PSND_MIXER Mixer)
}
PSND_MIXER
-SndMixerCreate(HWND hWndNotification)
+SndMixerCreate(HWND hWndNotification, UINT MixerId)
{
PSND_MIXER Mixer = (PSND_MIXER) HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
@@ -80,7 +80,7 @@ SndMixerCreate(HWND hWndNotification)
if (Mixer->MixersCount > 0)
{
/* select the first mixer by default */
- SndMixerSelect(Mixer, 0);
+ SndMixerSelect(Mixer, MixerId);
}
}
diff --git a/base/applications/sndvol32/sndvol32.c
b/base/applications/sndvol32/sndvol32.c
index 44c4b44956..4e3523ff7f 100644
--- a/base/applications/sndvol32/sndvol32.c
+++ b/base/applications/sndvol32/sndvol32.c
@@ -537,7 +537,7 @@ DlgPreferencesProc(HWND hwndDlg,
(LONG_PTR)lParam);
Context = (PPREFERENCES_CONTEXT)((LONG_PTR)lParam);
Context->hwndDlg = hwndDlg;
- Context->Mixer = SndMixerCreate(hwndDlg);
+ Context->Mixer = SndMixerCreate(hwndDlg,
Context->MixerWindow->MixerId);
Context->Selected = (UINT)-1;
FillDevContext.PrefContext = Context;
@@ -805,7 +805,7 @@ MainWindowProc(HWND hwnd,
TCHAR szProduct[MAXPNAMELEN];
/* get mixer product name */
- if (SndMixerGetProductName(MixerWindow->Mixer,
+ if (SndMixerGetProductName(Pref.Mixer,
szProduct,
sizeof(szProduct) /
sizeof(szProduct[0])) == -1)
{
@@ -962,7 +962,7 @@ MainWindowProc(HWND hwnd,
GWL_USERDATA,
(LONG_PTR)MixerWindow);
MixerWindow->hWnd = hwnd;
- MixerWindow->Mixer = SndMixerCreate(MixerWindow->hWnd);
+ MixerWindow->Mixer = SndMixerCreate(MixerWindow->hWnd,
MixerWindow->MixerId);
if (MixerWindow->Mixer != NULL)
{
TCHAR szProduct[MAXPNAMELEN];
@@ -1089,7 +1089,7 @@ UnregisterApplicationClasses(VOID)
static HWND
CreateApplicationWindow(
WINDOW_MODE WindowMode,
- BOOL bRecord)
+ UINT MixerId)
{
HWND hWnd;
@@ -1102,7 +1102,7 @@ CreateApplicationWindow(
}
MixerWindow->Mode = WindowMode;
-
+ MixerWindow->MixerId = MixerId;
if (mixerGetNumDevs() > 0)
{
@@ -1152,11 +1152,11 @@ static
BOOL
HandleCommandLine(LPTSTR cmdline,
PWINDOW_MODE pMode,
- PBOOL pRecord)
+ PUINT pMixerId)
{
TCHAR option;
- *pRecord = FALSE;
+ *pMixerId = 0;
*pMode = SMALL_MODE;
while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline ==
_T('/'))
@@ -1193,12 +1193,12 @@ HandleCommandLine(LPTSTR cmdline,
case 'p': /* Play mode */
case 'P':
- *pRecord = FALSE;
+ *pMixerId = 0;
break;
case 'r': /* Record mode */
case 'R':
- *pRecord = TRUE;
+ *pMixerId = 1;
break;
default:
@@ -1219,7 +1219,7 @@ _tWinMain(HINSTANCE hInstance,
int Ret = 1;
INITCOMMONCONTROLSEX Controls;
WINDOW_MODE WindowMode = SMALL_MODE;
- BOOL bRecord = FALSE;
+ UINT MixerId = 0;
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(nCmdShow);
@@ -1227,7 +1227,7 @@ _tWinMain(HINSTANCE hInstance,
hAppInstance = hInstance;
hAppHeap = GetProcessHeap();
- HandleCommandLine(lpszCmdLine, &WindowMode, &bRecord);
+ HandleCommandLine(lpszCmdLine, &WindowMode, &MixerId);
if (InitAppConfig())
{
@@ -1256,7 +1256,7 @@ _tWinMain(HINSTANCE hInstance,
{
if (RegisterApplicationClasses())
{
- hMainWnd = CreateApplicationWindow(WindowMode, bRecord);
+ hMainWnd = CreateApplicationWindow(WindowMode, MixerId);
if (hMainWnd != NULL)
{
BOOL bRet;
diff --git a/base/applications/sndvol32/sndvol32.h
b/base/applications/sndvol32/sndvol32.h
index ad7311fa86..cd0192de78 100644
--- a/base/applications/sndvol32/sndvol32.h
+++ b/base/applications/sndvol32/sndvol32.h
@@ -38,6 +38,7 @@ typedef struct _MIXER_WINDOW
HWND *Window;
WINDOW_MODE Mode;
+ UINT MixerId;
RECT rect;
HFONT hFont;
} MIXER_WINDOW, *PMIXER_WINDOW;
@@ -123,7 +124,7 @@ typedef BOOL (CALLBACK *PFNSNDMIXENUMLINES)(PSND_MIXER Mixer,
LPMIXERLINE Line,
typedef BOOL (CALLBACK *PFNSNDMIXENUMCONNECTIONS)(PSND_MIXER Mixer, DWORD LineID,
LPMIXERLINE Line, PVOID Context);
typedef BOOL (CALLBACK *PFNSNDMIXENUMPRODUCTS)(PSND_MIXER Mixer, UINT Id, LPCTSTR
ProductName, PVOID Context);
-PSND_MIXER SndMixerCreate(HWND hWndNotification);
+PSND_MIXER SndMixerCreate(HWND hWndNotification, UINT MixerId);
VOID SndMixerDestroy(PSND_MIXER Mixer);
VOID SndMixerClose(PSND_MIXER Mixer);
BOOL SndMixerSelect(PSND_MIXER Mixer, UINT MixerId);