[SNDVOL32] Add the ability to select the record mode by using the /r option and selec...
authorEric Kohl <eric.kohl@reactos.org>
Sun, 18 Mar 2018 13:15:12 +0000 (14:15 +0100)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 18 Mar 2018 13:15:12 +0000 (14:15 +0100)
base/applications/sndvol32/mixer.c
base/applications/sndvol32/sndvol32.c
base/applications/sndvol32/sndvol32.h

index 6de6ed4..1f1be94 100644 (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);
         }
     }
 
index 44c4b44..4e3523f 100644 (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;
index ad7311f..cd0192d 100644 (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);