summaryrefslogtreecommitdiff
path: root/backends/pulse/pulse-source-output.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-source-output.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-source-output.c')
-rw-r--r--backends/pulse/pulse-source-output.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/backends/pulse/pulse-source-output.c b/backends/pulse/pulse-source-output.c
index 6efecc8..a48f9f6 100644
--- a/backends/pulse/pulse-source-output.c
+++ b/backends/pulse/pulse-source-output.c
@@ -35,16 +35,22 @@ static void pulse_source_output_init (PulseSourceOutput *output);
G_DEFINE_TYPE (PulseSourceOutput, pulse_source_output, PULSE_TYPE_STREAM_CONTROL);
-static gboolean pulse_source_output_set_mute (PulseStreamControl *psc,
- gboolean mute);
-static gboolean pulse_source_output_set_volume (PulseStreamControl *psc,
- pa_cvolume *cvolume);
-static PulseMonitor *pulse_source_output_create_monitor (PulseStreamControl *psc);
+static guint pulse_source_output_get_max_volume (MateMixerStreamControl *mmsc);
+
+static gboolean pulse_source_output_set_mute (PulseStreamControl *psc,
+ gboolean mute);
+static gboolean pulse_source_output_set_volume (PulseStreamControl *psc,
+ pa_cvolume *cvolume);
+static PulseMonitor *pulse_source_output_create_monitor (PulseStreamControl *psc);
static void
pulse_source_output_class_init (PulseSourceOutputClass *klass)
{
- PulseStreamControlClass *control_class;
+ MateMixerStreamControlClass *mmsc_class;
+ PulseStreamControlClass *control_class;
+
+ mmsc_class = MATE_MIXER_STREAM_CONTROL_CLASS (klass);
+ mmsc_class->get_max_volume = pulse_source_output_get_max_volume;
control_class = PULSE_STREAM_CONTROL_CLASS (klass);
control_class->set_mute = pulse_source_output_set_mute;
@@ -162,6 +168,15 @@ pulse_source_output_update (PulseSourceOutput *output,
g_object_thaw_notify (G_OBJECT (output));
}
+static guint
+pulse_source_output_get_max_volume (MateMixerStreamControl *mmsc)
+{
+ g_return_val_if_fail (PULSE_IS_SOURCE_OUTPUT (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_source_output_set_mute (PulseStreamControl *psc, gboolean mute)
{