summaryrefslogtreecommitdiff
path: root/backends/pulse/pulse-sink-input.c
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2015-12-10 02:17:45 +0100
committerMichal Ratajsky <[email protected]>2015-12-10 02:17:45 +0100
commitd62f85c3dc4f8de5fe5a59908cef705b9d0a3440 (patch)
tree5649627b2cdab66fd2820f8918c7fd75ec82dd84 /backends/pulse/pulse-sink-input.c
parenta64722f0eff22f9ba8af3999bfb168d9b020ddd8 (diff)
downloadlibmatemixer-d62f85c3dc4f8de5fe5a59908cef705b9d0a3440.tar.bz2
libmatemixer-d62f85c3dc4f8de5fe5a59908cef705b9d0a3440.tar.xz
pulse: Fix volume limits as described on the PulseAudio wiki
Diffstat (limited to 'backends/pulse/pulse-sink-input.c')
-rw-r--r--backends/pulse/pulse-sink-input.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/backends/pulse/pulse-sink-input.c b/backends/pulse/pulse-sink-input.c
index af73060..eb812c6 100644
--- a/backends/pulse/pulse-sink-input.c
+++ b/backends/pulse/pulse-sink-input.c
@@ -35,16 +35,22 @@ static void pulse_sink_input_init (PulseSinkInput *input);
G_DEFINE_TYPE (PulseSinkInput, pulse_sink_input, PULSE_TYPE_STREAM_CONTROL);
-static gboolean pulse_sink_input_set_mute (PulseStreamControl *psc,
- gboolean mute);
-static gboolean pulse_sink_input_set_volume (PulseStreamControl *psc,
- pa_cvolume *cvolume);
-static PulseMonitor *pulse_sink_input_create_monitor (PulseStreamControl *psc);
+static guint pulse_sink_input_get_max_volume (MateMixerStreamControl *mmsc);
+
+static gboolean pulse_sink_input_set_mute (PulseStreamControl *psc,
+ gboolean mute);
+static gboolean pulse_sink_input_set_volume (PulseStreamControl *psc,
+ pa_cvolume *cvolume);
+static PulseMonitor *pulse_sink_input_create_monitor (PulseStreamControl *psc);
static void
pulse_sink_input_class_init (PulseSinkInputClass *klass)
{
- PulseStreamControlClass *control_class;
+ MateMixerStreamControlClass *mmsc_class;
+ PulseStreamControlClass *control_class;
+
+ mmsc_class = MATE_MIXER_STREAM_CONTROL_CLASS (klass);
+ mmsc_class->get_max_volume = pulse_sink_input_get_max_volume;
control_class = PULSE_STREAM_CONTROL_CLASS (klass);
control_class->set_mute = pulse_sink_input_set_mute;
@@ -173,6 +179,15 @@ pulse_sink_input_update (PulseSinkInput *input, const pa_sink_input_info *info)
g_object_thaw_notify (G_OBJECT (input));
}
+static guint
+pulse_sink_input_get_max_volume (MateMixerStreamControl *mmsc)
+{
+ g_return_val_if_fail (PULSE_IS_SINK_INPUT (mmsc), (guint) PA_VOLUME_MUTED);
+
+ /* Do not extend the volume to PA_VOLUME_UI_MAX as PulseStreamControl does */
+ return (guint) PA_VOLUME_NORM;
+}
+
static gboolean
pulse_sink_input_set_mute (PulseStreamControl *psc, gboolean mute)
{