[SNDVOL32] Add the ability to select the record mode by using the /r option and select the right mixer after changing the mixer preferences

This commit is contained in:
Eric Kohl 2018-03-18 14:15:12 +01:00
parent 2a0e996c9d
commit 5b2ff8a3f9
3 changed files with 16 additions and 15 deletions

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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);