speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Set PulseAudio media role to a11y


From: Luke Yelavich
Subject: [PATCH] Set PulseAudio media role to a11y
Date: Thu, 12 Aug 2010 15:37:40 +1000

From: Luke Yelavich <address@hidden>
To: address@hidden

PulseAudio allows clients to set various properties relevant to themselves,
one of which is a media role. PulseAudio takes action in different audio
streams, depending on the media role. Speech Dispatcher should identify
itself as an accessibility application, to make sure that its audio
stream never gets interrupted by PulseAudio.
---
 src/audio/pulse.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/audio/pulse.c b/src/audio/pulse.c
index b45fc34..f32a8b4 100644
--- a/src/audio/pulse.c
+++ b/src/audio/pulse.c
@@ -34,6 +34,7 @@
 #include <pulse/simple.h>
 #include <pulse/error.h>
 #include <stdarg.h>
+#include <stdlib.h>
 
 /* Switch this on to debug, see output log location in MSG() */
 //#define DEBUG_PULSE
@@ -107,6 +108,8 @@ static int _pulse_open(AudioID * id, int sample_rate, int 
num_channels,
   buffAttr.prebuf = (uint32_t)-1;
   buffAttr.minreq = (uint32_t)-1;
   buffAttr.fragsize = (uint32_t)-1;
+  /* Set the media role to accessibility */
+  setenv("PULSE_PROP_media.role", "a11y", 1);
   /* Open new connection */
   if(!(id->pa_simple = pa_simple_new(id->pa_server, "speech-dispatcher", 
PA_STREAM_PLAYBACK,
                                     NULL, "playback", &ss, NULL, &buffAttr, 
&error))) {
@@ -212,6 +215,7 @@ int pulse_close (AudioID * id)
     if(id->pa_simple != NULL) {
         pa_simple_free(id->pa_simple);
         id->pa_simple = NULL;
+        unsetenv("PULSE_PROP_media.role");
     }
     return 0;
 }
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]