Details
Description
To reproduce the bug:
0. Ensure you have an audio controller connected and manufacturer's audio driver installed in ReactOS, so the sound support is enabled and working.
- Start ReactOS Multimedia Player (mplay32.exe) from Start Menu -> Programs -> Accessories -> Entertainment -> ReactOS Multimedia Player.
- Open any WAVE audio file (with *.wav extension) by clicking File -> Open and then browsing it via Browse dialog and then Open (could be ReactOS_Startup.wav in media directory, but in this case, loop the playback by clicking View -> Repeat in mplay32, because that audio file has too short duration). MP3 can also be played, but it needs an additional codec installastion (copy and register l3codecx.ax from Windows XP/2K3).
- It will start to play slected file.
- Then, when it plays the audio file, run Volume Control from system tray, by clicking left mouse button on the speaker icon one time.
- The Volume Control dialog will open.
- Try to change the volume level by pressing left mouse button and scrolling the slider up/down.
You will see that volume level changing does not work as expected. After changing the slider position, the volume level will be set to mimimum (so the sound will be nearly not hearable) and then it will not be changed at all, even if you will scroll it up to the maximum again.
Exactly the same problem is actual for the horisontal slider for left/right speakers balance in the volume mixer.
Nothing related to this problem is visible in debug.log.
This occurs because of two following reasons:
- We get and set the volume level only for the first output channel (with 0 index), but we don't do that at all for the 2nd (1) and all the following channels, if any. So hence, it isn't set correctly for all other channels.
- We always expect MIXERCONTROLDETAILS_UNSIGNED structure in some places as a member of MIXERCONTROLDETAILS->paDetails member, which contains ULONG (DWORD) value that can have only positive Decibel (DB) values. To have more silent volume levels (those are nearer to the total silence (Mute)), we need to allow applying negative Decibel values, which can only be stored in and provided by MIXERCONTROLDETAILS_SIGNED structure. It has a LONG member inside it, so it can contain a negative Decibel values inside it as well.
I managed to fix both of these problems locally and will send a new PR soon.
In particaular, I changed the code in MMixer to set the volume level for all available output channels properly (stored in MIXERCONTROLDETAILS.cChannels member) and forced some sanity checks and other code parts to use MIXERCONTROLDETAILS_SIGNED structure instead of unsigned version of it.
This fixes improperly working volume control (as it was already described above) and allows to set the volume and left/right balance levels correctly, so now it works as it should.
The only remaining problem is, user-defined volume setting are not saved after reboot. To save them, we need to write the volume values in registry and then load them from it at next startup, from the HKLM/System/CurrentControlSet/Control/DeviceClasses/KSCATEGORY_AUDIO/.../DeviceParameters/Mixer/.../* key. It should be done by (and implemented inside) wdmaud.sys, same as it's done in Windows XP/2003. We already manage some user mode settings in HKCU/SOFTWARE/Microsoft/Windows/Applets/Volume Control by our sndvol32.exe, but that seems to be not enough because the actual volume values should be managed by wdmaud.sys on the kernel mode side (loading (reading)/saving (writing) the settings). This seems to be a topic for another ticket.
Attachments
Issue Links
- duplicates
-
CORE-17976 AudioMixer, The systray left click mutes the sound if you decrease the volume.
-
- Open
-