https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0185ee46d5065cfd41a47…
commit 0185ee46d5065cfd41a478c7210e423485c00430
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Tue Feb 5 20:33:43 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Tue Feb 5 20:33:43 2019 +0100
[SNDVOL32] Take the balance between channels into account for the volume trackbar of
the tray window.
---
base/applications/sndvol32/tray.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/base/applications/sndvol32/tray.c b/base/applications/sndvol32/tray.c
index 5970adcd21..59d5874aeb 100644
--- a/base/applications/sndvol32/tray.c
+++ b/base/applications/sndvol32/tray.c
@@ -125,15 +125,13 @@ OnTrayInitMixer(
if (mixerGetControlDetails((HMIXEROBJ)pDialogData->hMixer, &mxcd,
MIXER_OBJECTF_HMIXER | MIXER_GETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR)
return;
- pDialogData->maxVolume = pDialogData->volumeInitValues[0].dwValue;
- pDialogData->maxChannel = 0;
- for (i = 1; i < pDialogData->volumeChannels; i++)
+ pDialogData->maxVolume = 0;
+ for (i = 0; i < pDialogData->volumeChannels; i++)
{
+ pDialogData->volumeCurrentValues[i].dwValue =
pDialogData->volumeInitValues[i].dwValue;
+
if (pDialogData->volumeInitValues[i].dwValue > pDialogData->maxVolume)
- {
pDialogData->maxVolume = pDialogData->volumeInitValues[i].dwValue;
- pDialogData->maxChannel = i;
- }
}
/* Initialize the volume trackbar */
@@ -209,18 +207,30 @@ OnVScroll(
LPARAM lParam)
{
MIXERCONTROLDETAILS mxcd;
- DWORD dwPos, dwVolume, i;
+ DWORD dwPosition, dwVolume, i;
switch (LOWORD(wParam))
{
- case TB_THUMBTRACK:
+ case TB_THUMBPOSITION:
+ break;
+
+ case TB_ENDTRACK:
+ PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ASYNC | SND_ALIAS_ID);
+ break;
+
+ default:
+ dwPosition = VOLUME_MAX - (DWORD)SendDlgItemMessage(hwndDlg,
IDC_LINE_SLIDER_VERT, TBM_GETPOS, 0, 0);
- dwPos = VOLUME_MAX - (DWORD)SendDlgItemMessage(hwndDlg, IDC_LINE_SLIDER_VERT,
TBM_GETPOS, 0, 0);
- dwVolume = (dwPos * pDialogData->volumeStep) +
pDialogData->volumeMinimum;
+ if (dwPosition == VOLUME_MIN)
+ dwVolume = pDialogData->volumeMinimum;
+ else if (dwPosition == VOLUME_MAX)
+ dwVolume = pDialogData->volumeMaximum;
+ else
+ dwVolume = (dwPosition * pDialogData->volumeStep) +
pDialogData->volumeMinimum;
for (i = 0; i < pDialogData->volumeChannels; i++)
{
- if (i == pDialogData->maxChannel)
+ if (pDialogData->volumeInitValues[i].dwValue ==
pDialogData->maxVolume)
{
pDialogData->volumeCurrentValues[i].dwValue = dwVolume;
}
@@ -242,13 +252,6 @@ OnVScroll(
&mxcd,
MIXER_OBJECTF_HMIXER |
MIXER_SETCONTROLDETAILSF_VALUE);
break;
-
- case TB_ENDTRACK:
- PlaySound((LPCTSTR)SND_ALIAS_SYSTEMDEFAULT, NULL, SND_ASYNC | SND_ALIAS_ID);
- break;
-
- default:
- break;
}
}