2010-01-31 00:24:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2007-07-31 09:04:07 +02:00
|
|
|
#ifndef MPLAYER_MIXER_H
|
|
|
|
#define MPLAYER_MIXER_H
|
2001-04-15 20:37:07 +02:00
|
|
|
|
2012-01-21 08:28:07 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
softvol, ao_pulse: prefer ao_pulse volume control by default
--softvol is enabled by default. For most audio outputs, this is a good
thing, as they have either their own (bad) soft volume implementation,
or control the system mixer. With ao_pulse, the situation is a bit
different: it supports per-application volume (i.e. volume control is
not really global). More importantly, ao_pulse uses a rather large audio
buffer, and changing the volume with mplayer's volume filter has a large
delay. With the native ao_pulse volume control, it's instant, because
PulseAudio's audio filtering happens at a later stage in its processing
pipeline (inaccessible for mplayer).
This means native volume control should really be allowed for ao_pulse,
while it's the reverse for other audio outputs. Make --softvol a choice
option, and add a new "auto" choice. This is default and will use PA's
volume control with ao_pulse, and mplayer's volume filter otherwise
(i.e. the old softvol behavior).
2012-09-18 21:41:22 +02:00
|
|
|
enum {
|
|
|
|
SOFTVOL_NO = 0,
|
|
|
|
SOFTVOL_YES = 1,
|
|
|
|
SOFTVOL_AUTO = 2,
|
|
|
|
};
|
|
|
|
|
2011-12-26 01:41:35 +01:00
|
|
|
typedef struct mixer {
|
2011-04-09 02:03:22 +02:00
|
|
|
struct ao *ao;
|
2012-11-01 13:33:38 +01:00
|
|
|
struct af_stream *afilter;
|
2004-06-26 11:14:20 +02:00
|
|
|
int volstep;
|
softvol, ao_pulse: prefer ao_pulse volume control by default
--softvol is enabled by default. For most audio outputs, this is a good
thing, as they have either their own (bad) soft volume implementation,
or control the system mixer. With ao_pulse, the situation is a bit
different: it supports per-application volume (i.e. volume control is
not really global). More importantly, ao_pulse uses a rather large audio
buffer, and changing the volume with mplayer's volume filter has a large
delay. With the native ao_pulse volume control, it's instant, because
PulseAudio's audio filtering happens at a later stage in its processing
pipeline (inaccessible for mplayer).
This means native volume control should really be allowed for ao_pulse,
while it's the reverse for other audio outputs. Make --softvol a choice
option, and add a new "auto" choice. This is default and will use PA's
volume control with ao_pulse, and mplayer's volume filter otherwise
(i.e. the old softvol behavior).
2012-09-18 21:41:22 +02:00
|
|
|
int softvol;
|
2012-01-21 08:28:07 +01:00
|
|
|
float softvol_max;
|
2012-04-09 16:39:01 +02:00
|
|
|
bool muted;
|
2012-04-10 03:45:53 +02:00
|
|
|
bool muted_by_us;
|
|
|
|
bool muted_using_volume;
|
2012-04-09 16:39:01 +02:00
|
|
|
float vol_l, vol_r;
|
2012-04-09 20:02:27 +02:00
|
|
|
/* Contains ao driver name or "softvol" if volume is not persistent
|
|
|
|
* and needs to be restored after the driver is reinitialized. */
|
|
|
|
const char *restore_volume;
|
2012-04-09 20:06:10 +02:00
|
|
|
float balance;
|
2013-04-10 19:07:26 +02:00
|
|
|
bool user_set_mute;
|
|
|
|
bool user_set_volume;
|
2004-06-26 11:14:20 +02:00
|
|
|
} mixer_t;
|
|
|
|
|
2012-04-09 20:02:27 +02:00
|
|
|
void mixer_reinit(struct mixer *mixer, struct ao *ao);
|
2012-04-09 21:11:49 +02:00
|
|
|
void mixer_uninit(struct mixer *mixer);
|
2004-06-26 11:14:20 +02:00
|
|
|
void mixer_getvolume(mixer_t *mixer, float *l, float *r);
|
|
|
|
void mixer_setvolume(mixer_t *mixer, float l, float r);
|
|
|
|
void mixer_incvolume(mixer_t *mixer);
|
|
|
|
void mixer_decvolume(mixer_t *mixer);
|
|
|
|
void mixer_getbothvolume(mixer_t *mixer, float *b);
|
2012-04-09 16:39:01 +02:00
|
|
|
void mixer_setmute(mixer_t *mixer, bool mute);
|
|
|
|
bool mixer_getmute(mixer_t *mixer);
|
2007-06-20 04:26:20 +02:00
|
|
|
void mixer_getbalance(mixer_t *mixer, float *bal);
|
|
|
|
void mixer_setbalance(mixer_t *mixer, float bal);
|
2001-04-15 20:37:07 +02:00
|
|
|
|
2007-07-31 09:04:07 +02:00
|
|
|
#endif /* MPLAYER_MIXER_H */
|