2010-01-30 23:24:23 +00: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 07:04:07 +00:00
|
|
|
#ifndef MPLAYER_MIXER_H
|
|
|
|
#define MPLAYER_MIXER_H
|
2001-04-15 18:37:07 +00:00
|
|
|
|
2012-01-21 07:28:07 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2004-06-26 09:14:20 +00:00
|
|
|
#include "libaf/af.h"
|
|
|
|
#include "libao2/audio_out.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 19:41:22 +00:00
|
|
|
enum {
|
|
|
|
SOFTVOL_NO = 0,
|
|
|
|
SOFTVOL_YES = 1,
|
|
|
|
SOFTVOL_AUTO = 2,
|
|
|
|
};
|
|
|
|
|
2011-12-26 00:41:35 +00:00
|
|
|
typedef struct mixer {
|
2011-04-09 00:03:22 +00:00
|
|
|
struct ao *ao;
|
2004-06-26 09:14:20 +00:00
|
|
|
af_stream_t *afilter;
|
|
|
|
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 19:41:22 +00:00
|
|
|
int softvol;
|
2012-01-21 07:28:07 +00:00
|
|
|
float softvol_max;
|
2012-04-09 14:39:01 +00:00
|
|
|
bool muted;
|
2012-04-10 01:45:53 +00:00
|
|
|
bool muted_by_us;
|
|
|
|
bool muted_using_volume;
|
2012-04-09 14:39:01 +00:00
|
|
|
float vol_l, vol_r;
|
2012-04-09 18:02:27 +00: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 18:06:10 +00:00
|
|
|
float balance;
|
2004-06-26 09:14:20 +00:00
|
|
|
} mixer_t;
|
|
|
|
|
2012-04-09 18:02:27 +00:00
|
|
|
void mixer_reinit(struct mixer *mixer, struct ao *ao);
|
2012-04-09 19:11:49 +00:00
|
|
|
void mixer_uninit(struct mixer *mixer);
|
2004-06-26 09:14:20 +00: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 14:39:01 +00:00
|
|
|
void mixer_setmute(mixer_t *mixer, bool mute);
|
|
|
|
bool mixer_getmute(mixer_t *mixer);
|
2007-06-20 02:26:20 +00:00
|
|
|
void mixer_getbalance(mixer_t *mixer, float *bal);
|
|
|
|
void mixer_setbalance(mixer_t *mixer, float bal);
|
2001-04-15 18:37:07 +00:00
|
|
|
|
2007-07-31 07:04:07 +00:00
|
|
|
#endif /* MPLAYER_MIXER_H */
|