From dda77704ddfc6632b30dea8aad72a6b20498aa73 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 28 Jan 2019 22:04:18 +0100 Subject: [PATCH] [SNDVOL32] Play the default sound when the volume or balance trackbar of the master line has been changed by the user. --- base/applications/sndvol32/sndvol32.c | 82 ++++++++++++++++++++------- 1 file changed, 62 insertions(+), 20 deletions(-) diff --git a/base/applications/sndvol32/sndvol32.c b/base/applications/sndvol32/sndvol32.c index 5484a8357f1..3cc5ba0bcf7 100644 --- a/base/applications/sndvol32/sndvol32.c +++ b/base/applications/sndvol32/sndvol32.c @@ -924,33 +924,75 @@ MainWindowProc(HWND hwnd, } case WM_VSCROLL: - { - if (LOWORD(wParam) == TB_THUMBTRACK) + switch (LOWORD(wParam)) { - /* get dialog item ctrl */ - CtrlID = GetDlgCtrlID((HWND)lParam); + case TB_THUMBTRACK: + /* get dialog item ctrl */ + CtrlID = GetDlgCtrlID((HWND)lParam); - /* get line index */ - LineOffset = CtrlID / IDC_LINE_SLIDER_VERT; + /* get line index */ + LineOffset = CtrlID / IDC_LINE_SLIDER_VERT; - /* compute window id of line name static control */ - CtrlID = LineOffset * IDC_LINE_NAME; + /* compute window id of line name static control */ + CtrlID = LineOffset * IDC_LINE_NAME; - /* get line name */ - if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0) - { - /* setup context */ - Context.SliderPos = HIWORD(wParam); - Context.bVertical = TRUE; - Context.bSwitch = FALSE; + /* get line name */ + if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0) + { + /* setup context */ + Context.SliderPos = HIWORD(wParam); + Context.bVertical = TRUE; + Context.bSwitch = FALSE; - /* set volume */ - SndMixerEnumConnections(Preferences.MixerWindow->Mixer, Preferences.SelectedLine, SetVolumeCallback, (LPVOID)&Context); - } + /* set volume */ + SndMixerEnumConnections(Preferences.MixerWindow->Mixer, Preferences.SelectedLine, SetVolumeCallback, (LPVOID)&Context); + } + break; + + case TB_ENDTRACK: + MixerWindow = GetWindowData(hwnd, + MIXER_WINDOW); + + /* get dialog item ctrl */ + CtrlID = GetDlgCtrlID((HWND)lParam); + + /* get line index */ + LineOffset = CtrlID / IDC_LINE_SLIDER_VERT; + + if (LineOffset == 1 && MixerWindow->Mixer->MixerId == 0) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ASYNC | SND_ALIAS_ID); + break; + + default: + break; + } + break; + + case WM_HSCROLL: + switch (LOWORD(wParam)) + { + case TB_THUMBTRACK: + /* FIXME */ + break; + + case TB_ENDTRACK: + MixerWindow = GetWindowData(hwnd, + MIXER_WINDOW); + + /* get dialog item ctrl */ + CtrlID = GetDlgCtrlID((HWND)lParam); + + /* get line index */ + LineOffset = CtrlID / IDC_LINE_SLIDER_HORZ; + + if (LineOffset == 1 && MixerWindow->Mixer->MixerId == 0) + PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ASYNC | SND_ALIAS_ID); + break; + + default: + break; } - break; - } case WM_CREATE: