All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device
@ 2016-05-11 10:31 Peter Krempa
  2016-05-11 10:56 ` Marc-André Lureau
  2016-05-11 11:37 ` Gerd Hoffmann
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Krempa @ 2016-05-11 10:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Peter Krempa

Since pulseaudio 1.0 it's possible to set the individual stream volume
rather than setting the device volume. With this, setting hardware mixer
of a emulated sound card doesn't mess up the volume configuration of the
host.

A side effect is that this limits compatible pulseaudio version to 1.0
which was released on 2011-09-27.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
This patch is keeping the old coding style by keeping the space after function
name so that the styles are not mixed in this file.

 audio/paaudio.c | 11 +++++------
 configure       |  4 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/audio/paaudio.c b/audio/paaudio.c
index 57678e7..65beb6f 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -781,23 +781,22 @@ static int qpa_ctl_in (HWVoiceIn *hw, int cmd, ...)

             pa_threaded_mainloop_lock (g->mainloop);

-            /* FIXME: use the upcoming "set_source_output_{volume,mute}" */
-            op = pa_context_set_source_volume_by_index (g->context,
-                pa_stream_get_device_index (pa->stream),
+            op = pa_context_set_source_output_volume (g->context,
+                pa_stream_get_index (pa->stream),
                 &v, NULL, NULL);
             if (!op) {
                 qpa_logerr (pa_context_errno (g->context),
-                            "set_source_volume() failed\n");
+                            "set_source_output_volume() failed\n");
             } else {
                 pa_operation_unref(op);
             }

-            op = pa_context_set_source_mute_by_index (g->context,
+            op = pa_context_set_source_output_mute (g->context,
                 pa_stream_get_index (pa->stream),
                 sw->vol.mute, NULL, NULL);
             if (!op) {
                 qpa_logerr (pa_context_errno (g->context),
-                            "set_source_mute() failed\n");
+                            "set_source_output_mute() failed\n");
             } else {
                 pa_operation_unref (op);
             }
diff --git a/configure b/configure
index c37fc5f..d71f27c 100755
--- a/configure
+++ b/configure
@@ -2795,8 +2795,8 @@ for drv in $audio_drv_list; do
     ;;

     pa)
-    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
-        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
+    audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
+        "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
     libs_softmmu="-lpulse $libs_softmmu"
     audio_pt_int="yes"
     ;;
-- 
2.8.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device
  2016-05-11 10:31 [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device Peter Krempa
@ 2016-05-11 10:56 ` Marc-André Lureau
  2016-05-11 11:37 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2016-05-11 10:56 UTC (permalink / raw)
  To: Peter Krempa; +Cc: QEMU, Gerd Hoffmann

Hi

On Wed, May 11, 2016 at 12:31 PM, Peter Krempa <pkrempa@redhat.com> wrote:
> Since pulseaudio 1.0 it's possible to set the individual stream volume
> rather than setting the device volume. With this, setting hardware mixer
> of a emulated sound card doesn't mess up the volume configuration of the
> host.
>
> A side effect is that this limits compatible pulseaudio version to 1.0
> which was released on 2011-09-27.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
> This patch is keeping the old coding style by keeping the space after function
> name so that the styles are not mixed in this file.
>
>  audio/paaudio.c | 11 +++++------
>  configure       |  4 ++--
>  2 files changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/audio/paaudio.c b/audio/paaudio.c
> index 57678e7..65beb6f 100644
> --- a/audio/paaudio.c
> +++ b/audio/paaudio.c
> @@ -781,23 +781,22 @@ static int qpa_ctl_in (HWVoiceIn *hw, int cmd, ...)
>
>              pa_threaded_mainloop_lock (g->mainloop);
>
> -            /* FIXME: use the upcoming "set_source_output_{volume,mute}" */
> -            op = pa_context_set_source_volume_by_index (g->context,
> -                pa_stream_get_device_index (pa->stream),
> +            op = pa_context_set_source_output_volume (g->context,
> +                pa_stream_get_index (pa->stream),
>                  &v, NULL, NULL);
>              if (!op) {
>                  qpa_logerr (pa_context_errno (g->context),
> -                            "set_source_volume() failed\n");
> +                            "set_source_output_volume() failed\n");
>              } else {
>                  pa_operation_unref(op);
>              }
>
> -            op = pa_context_set_source_mute_by_index (g->context,
> +            op = pa_context_set_source_output_mute (g->context,
>                  pa_stream_get_index (pa->stream),
>                  sw->vol.mute, NULL, NULL);
>              if (!op) {
>                  qpa_logerr (pa_context_errno (g->context),
> -                            "set_source_mute() failed\n");
> +                            "set_source_output_mute() failed\n");
>              } else {
>                  pa_operation_unref (op);
>              }
> diff --git a/configure b/configure
> index c37fc5f..d71f27c 100755
> --- a/configure
> +++ b/configure
> @@ -2795,8 +2795,8 @@ for drv in $audio_drv_list; do
>      ;;
>
>      pa)
> -    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
> -        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
> +    audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
> +        "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); return 0;"
>      libs_softmmu="-lpulse $libs_softmmu"
>      audio_pt_int="yes"
>      ;;
> --
> 2.8.2
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device
  2016-05-11 10:31 [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device Peter Krempa
  2016-05-11 10:56 ` Marc-André Lureau
@ 2016-05-11 11:37 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2016-05-11 11:37 UTC (permalink / raw)
  To: Peter Krempa; +Cc: qemu-devel

On Mi, 2016-05-11 at 12:31 +0200, Peter Krempa wrote:
> Since pulseaudio 1.0 it's possible to set the individual stream volume
> rather than setting the device volume. With this, setting hardware
> mixer
> of a emulated sound card doesn't mess up the volume configuration of
> the
> host.
> 
> A side effect is that this limits compatible pulseaudio version to 1.0
> which was released on 2011-09-27.
> 

added to audio queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-11 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 10:31 [Qemu-devel] [PATCH] audio: pa: Set volume of recording stream instead of recording device Peter Krempa
2016-05-11 10:56 ` Marc-André Lureau
2016-05-11 11:37 ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.