Commit Graph

20 Commits

Author SHA1 Message Date
wm4 06b1de2687 mixer, libao: add proper mute control
The mixer frontend code can now make use of a proper system mixer mute
toggle, if the audio output driver supports it.

The consequence is that, if support is available, mplayer will no longer
temporarily set the system volume to 0 if mute is enabled.

Generally, the code now deals with the following combinations of available
AO features:
- software volume control forced by user (--softvol / soft_vol flag)
  => if enabled, never touch the "hardware" controls
- "hardware"/driver volume control available (whether
  AOCONTROL_GET/SET_VOLUME works)
  => if not available, enable volume controls by enabling softvol
- "hardware"/driver mute control (AOCONTROL_GET/SET_MUTE)
  => if not available, emulate by setting volume to 0
- whether the volume+mute controls are kept or not when the AO is closed
  (indicated by ao->no_persistent_volume)
  => if not persistent, restore the volume/mute next time the AO is opened
2012-01-18 04:21:46 +01:00
wm4 b338b16be7 audio: reset mplayer's mute state when the system mixer volume changes
Before this commit, the mute state was only reset when either mute was
explicitly cleared, or the volume was changed via mplayer controls. If
the volume controls are connected to the system mixer, and the system
mixer volume is changed otherwise (e.g. with alsamixer), the mute
setting was inconsistent.

Avoid this by checking the volume. If the returned volume is not 0, the
mute flag is considered invalid. This relies on system mixers always
returning a volume of 0 when mplayer has set the volume 0.

Possible caveat: if the audio output's volume control don't return a
volume of exactly 0 after 0 was written, enabling mute basically won't
work. It will set the volume to silence, forget the previous volume, and
report that mute is disabled.
2012-01-18 04:21:45 +01:00
wm4 aae97b7e25 audio: properly restore audio volume on exit when mute is used
When you mute audio, mplayer is supposed to restore the volume controls
on exit. This affects when --softvol isn't used and the audio output
driver volume controls directly affect the system wide volume controls.

This wasn't done in some cases.
2012-01-18 04:21:45 +01:00
wm4 29effe9593 mixer: restore volume with audio output drivers without persistent volume
Some audio outputs don't provide access to a system-wide mixer control, and
do per-application audio mixing. Further, some of these forget the volume
as soon as the audio device is closed. This can be annoying, because
mplayer will "forget" the volume when playing a new file or when crossing
ordered chapter boundaries. Support restoring the volume on audio
reinitialization if an audio output driver knowingly behaves this way.
(This doesn't change that mplayer never writes any settings into the config
file, including volume settings.)

This commit doesn't yet change any actual output driver to use this code.

Hopefully make some logic in the volume restore code a bit more robust.
2012-01-18 04:21:45 +01:00
wm4 7e3a4578bd mixer: keep balance setting
Similarly to the last commit, restore the balance setting when switching
to a new file. Unlike the volume setting, balance is always implemented
as filter, so this affects usage without --softvol too.
2012-01-07 16:43:35 +01:00
wm4 685fbf25fe mixer: keep user volume setting when --softvol is used
When --softvol is enabled, the volume set by the "volume" property is
reset when changing to a new file or crossing ordered chapter boundaries.

Fix this by explicitly restoring the volume on audio reinitialization.
Now the behavior with --softvol should be the same as if a system mixer
is used, and the volume should be persistent across file changes.

This also works around an inconsistency with the mute flag. The frontend
assumed the mute flag is persistent across file changes, which was not
true with --softvol.

If not resetting the volume on playing new files is undesired, it can
be avoided by putting volume=100 in the mplayer config file.
2012-01-07 16:42:30 +01:00
wm4 670e72506a mixer: reindent/cosmetic changes
There should be no real semantic changes.

Remove the mixer_setbothvolume macro, as it was unused.
2011-12-26 01:55:00 +01:00
Uoti Urpala 2a7c5a1365 audio: change external AO interface to "ao_[method](ao, ...)"
Make the outside interface of audio output handling similar to the
video output one. An AO object is first created, and then methods
called with ao_[methodname](ao, args...). However internally libao2/
still holds all data in globals, and trying to create multiple
simultaneous AO instances won't work.
2011-04-09 03:03:22 +03:00
diego 99c1bbca2a Add license header to all top-level files missing them.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-30 23:24:23 +00:00
diego 0864f92e7a Get rid of pointless 'extern' keywords.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28085 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-03 23:01:03 +00:00
reimar 6921ab9e24 ao_functions_t should be const, part 1
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25945 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-01 20:11:14 +00:00
diego a931e510b1 Identifiers starting with underscores are reserved.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23954 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-07-31 07:04:07 +00:00
zuxy be09bd1c04 The audio balance feature implemented with af_pan.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23588 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-06-20 02:26:20 +00:00
reimar e2f2ca1cbb allow forcing of software volume control and setting maximum amplification.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13934 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-11-14 11:27:58 +00:00
alex ba3c4568fb New 'Mixer API' with ability to change volume through libaf (this part was written by Reimar Doffinger) and lesser global variables
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12673 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-06-26 09:14:20 +00:00
attila a4ac1dc9a4 add option to select mixer channel
patch by Catalin Muresan <catalin.muresan@astral.ro>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11838 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-01-24 11:53:52 +00:00
pontscho 08b4af80fa add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6312 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-06-06 07:13:57 +00:00
anders ee2ed8567e Moved HW dependent mixer stuff to libao and removed master switch
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4789 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-02-21 16:02:26 +00:00
arpi_esp 5c50d3e7dd applied solaris8/netbsd/other fixes patch by Jürgen Keil <jk@tools.de>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1039 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-05 18:40:44 +00:00
gabucino 005b7e2844 ups, I missed'em..
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@442 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-15 18:37:07 +00:00