summaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/pulse/pulse-ext-stream.c2
-rw-r--r--backends/pulse/pulse-sink-input.c27
-rw-r--r--backends/pulse/pulse-source-output.c27
-rw-r--r--backends/pulse/pulse-stream-control.c19
4 files changed, 60 insertions, 15 deletions
diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c
index 5922ef5..2ebf8e7 100644
--- a/backends/pulse/pulse-ext-stream.c
+++ b/backends/pulse/pulse-ext-stream.c
@@ -599,7 +599,7 @@ pulse_ext_stream_get_max_volume (MateMixerStreamControl *mmsc)
{
g_return_val_if_fail (PULSE_IS_EXT_STREAM (mmsc), (guint) PA_VOLUME_MUTED);
- return (guint) PA_VOLUME_UI_MAX;
+ return (guint) PA_VOLUME_NORM;
}
static guint
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)
{
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)
{
diff --git a/backends/pulse/pulse-stream-control.c b/backends/pulse/pulse-stream-control.c
index 3da3221..bc59c97 100644
--- a/backends/pulse/pulse-stream-control.c
+++ b/backends/pulse/pulse-stream-control.c
@@ -665,9 +665,24 @@ pulse_stream_control_get_min_volume (MateMixerStreamControl *mmsc)
static guint
pulse_stream_control_get_max_volume (MateMixerStreamControl *mmsc)
{
+ MateMixerStreamControlFlags flags;
+
g_return_val_if_fail (PULSE_IS_STREAM_CONTROL (mmsc), (guint) PA_VOLUME_MUTED);
- return (guint) PA_VOLUME_UI_MAX;
+ flags = mate_mixer_stream_control_get_flags (mmsc);
+
+ /*
+ * From PulseAudio wiki:
+ * For all volumes that are > PA_VOLUME_NORM (i.e. beyond the maximum volume
+ * setting of the hw) PA will do digital amplification. This works only for
+ * devices that have PA_SINK_DECIBEL_VOLUME/PA_SOURCE_DECIBEL_VOLUME set. For
+ * devices that lack this flag do not extend the volume slider like this, it
+ * will not have any effect.
+ */
+ if (flags & MATE_MIXER_STREAM_CONTROL_HAS_DECIBEL)
+ return (guint) PA_VOLUME_UI_MAX;
+ else
+ return (guint) PA_VOLUME_NORM;
}
static guint
@@ -688,7 +703,7 @@ pulse_stream_control_get_base_volume (MateMixerStreamControl *mmsc)
control = PULSE_STREAM_CONTROL (mmsc);
if (control->priv->base_volume > 0)
- return control->priv->base_volume;
+ return (guint) control->priv->base_volume;
else
return (guint) PA_VOLUME_NORM;
}