speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] modules - Support graceful audio fallback


From: Aleksandar Kostadinov
Subject: [PATCH] modules - Support graceful audio fallback
Date: Thu, 2 Jul 2009 07:39:29 +0300

On Wed, Jul 1, 2009 at 6:31 PM, Halim Sahin<halim.sahin at t-online.de> wrote:
> Hi,
>
> What's the advantage of trying to use all audio outputs in sd?
>
> This doesn't fix the most important problem:
> If sd is started through init it will detect one soundsystem (not pulse), 
> because it isn't
> running at this time.
> In this case it will select alsa.
> When pulse ?tries to start it can't use the default olsa device utput because 
> sd is
> already uses ?it.
>
> If you start sd in a usersession you can make it running after pulse start.
> In this case there is no need for trying all audiosystems.
> Unfortunately using sd in an usersession breaks textmode accessibility.

In fact default alsa device does support simultaneous open from a long
ago. Because the default device is actually dmix (in the default
setup).

> so we will end at the same problem .
> No working a11y.
>
> Pulse should be started before sd through init to
> have a great working a11y infrastructure in textmode and in orca.
>
> Afaik mr. Hanke works allready hard to improove pulseaudio support in sd.
>
> BR.
> Halim
>
> On Mo, Jun 29, 2009 at 02:45:15 +1000, Luke Yelavich wrote:
>> From: Luke Yelavich <luke.yelavich at canonical.com>
>>
>> Add support for graceful audio fallback for use with speech modules. This
>> allows a comma-separated list of possible audio output methods to be set
>> in the speech-dispatcher configuration file. The audio initialization code 
>> will
>> try each specified method in turn until either an audio output method gets
>> initialized successfully, or the list of specified audio outputs is tried, 
>> and
>> all fail.
>> ---
>> ?src/modules/module_utils.c | ? 99 
>> ++++++++++++++++++++++++++++----------------
>> ?1 files changed, 63 insertions(+), 36 deletions(-)
>>
>> diff --git a/src/modules/module_utils.c b/src/modules/module_utils.c
>> index 8b5dd7f..67bc59b 100644
>> --- a/src/modules/module_utils.c
>> +++ b/src/modules/module_utils.c
>> @@ -1073,47 +1073,74 @@ module_audio_init_spd(char **status_info)
>> ? ?char * error;
>> ? ?GString *info;
>> ? ?char *module_audio_pars[10];
>> + ?char *outputs;
>> + ?int audio_output_set;
>>
>> ? ?info = g_string_new("");
>> + ?outputs = audio_settings.audio_output_method;
>>
>> ? ? ?DBG("Openning audio output system");
>> - ? ?if (!strcmp(audio_settings.audio_output_method, "oss")){
>> - ? ?DBG("Using OSS audio output method");
>> - ? ? module_audio_pars[0] = strdup(audio_settings.audio_oss_device);
>> - ? ? ? ?module_audio_pars[1] = NULL;
>> - ? ? ? ?module_audio_id = spd_audio_open(AUDIO_OSS, (void**) 
>> module_audio_pars, &error);
>> - ? ? ? ?module_audio_output_method = AUDIO_OSS;
>> + ? ?if (outputs[0]){
>> + ? ? const char *next = outputs;
>> + ? ? size_t len;
>> +
>> + ? ? do{
>> + ? ? ? ? outputs = next;
>> + ? ? ? ? next = strchr(outputs, ',');
>> +
>> + ? ? ? ? if (!outputs[0] || outputs[0] == ',')
>> + ? ? ? ? ? ? continue;
>> +
>> + ? ? ? ? len = (next ? ((size_t)(next-outputs)) : strlen(outputs));
>> +
>> + ? ? ? ? if (len == 3 && strncmp("oss", outputs, len) == 0){
>> + ? ? ? ? ? ? DBG("Using OSS audio output method");
>> + ? ? ? ? ? ? module_audio_pars[0] = strdup(audio_settings.audio_oss_device);
>> + ? ? ? ? ? ? module_audio_pars[1] = NULL;
>> + ? ? ? ? ? ? module_audio_id = spd_audio_open(AUDIO_OSS, (void**) 
>> module_audio_pars, &error);
>> + ? ? ? ? ? ? if (module_audio_id){
>> + ? ? ? ? ? ? ? ? module_audio_output_method = AUDIO_OSS;
>> + ? ? ? ? ? ? ? ? audio_output_set = 1;
>> + ? ? ? ? ? ? }
>> + ? ? ? ? } else if (len == 4 && strncmp("alsa", outputs, len) == 0){
>> + ? ? ? ? ? ? DBG("Using Alsa audio output method");
>> + ? ? ? ? ? ? module_audio_pars[0] = audio_settings.audio_alsa_device;
>> + ? ? ? ? ? ? module_audio_pars[1] = NULL;
>> + ? ? ? ? ? ? module_audio_id = spd_audio_open(AUDIO_ALSA, (void**) 
>> module_audio_pars, &error);
>> + ? ? ? ? ? ? if (module_audio_id){
>> + ? ? ? ? ? ? ? ? module_audio_output_method = AUDIO_ALSA;
>> + ? ? ? ? ? ? ? ? audio_output_set = 1;
>> + ? ? ? ? ? ? }
>> + ? ? ? ? } else if (len == 3 && strncmp("nas", outputs, len) == 0){
>> + ? ? ? ? ? ? DBG("Using NAS audio output method");
>> + ? ? ? ? ? ? module_audio_pars[0] = audio_settings.audio_nas_server;
>> + ? ? ? ? ? ? module_audio_pars[1] = NULL;
>> + ? ? ? ? ? ? module_audio_id = spd_audio_open(AUDIO_NAS, (void**) 
>> module_audio_pars, &error);
>> + ? ? ? ? ? ? if (module_audio_id){
>> + ? ? ? ? ? ? ? ? module_audio_output_method = AUDIO_NAS;
>> + ? ? ? ? ? ? ? ? audio_output_set = 1;
>> + ? ? ? ? ? ? }
>> + ? ? ? ? } else if (len == 5 && strncmp("pulse", outputs, len) == 0){
>> + ? ? ? ? ? ? DBG("Using PulseAudio output method");
>> + ? ? ? ? ? ? module_audio_pars[0] = (void *) 
>> audio_settings.audio_pulse_server;
>> + ? ? ? ? ? ? module_audio_pars[1] = (void *) 
>> audio_settings.audio_pulse_max_length;
>> + ? ? ? ? ? ? module_audio_pars[2] = (void *) 
>> audio_settings.audio_pulse_target_length;
>> + ? ? ? ? ? ? module_audio_pars[3] = (void *) 
>> audio_settings.audio_pulse_pre_buffering;
>> + ? ? ? ? ? ? module_audio_pars[4] = (void *) 
>> audio_settings.audio_pulse_min_request;
>> + ? ? ? ? ? ? module_audio_pars[5] = NULL;
>> + ? ? ? ? ? ? module_audio_id = spd_audio_open(AUDIO_PULSE, (void**) 
>> module_audio_pars, &error);
>> + ? ? ? ? ? ? if (module_audio_id){
>> + ? ? ? ? ? ? ? ? module_audio_output_method = AUDIO_PULSE;
>> + ? ? ? ? ? ? ? ? audio_output_set = 1;
>> + ? ? ? ? ? ? }
>> + ? ? ? ? } else{
>> + ? ? ? ? ? ? ABORT("Sound output method specified in configuration not 
>> supported. "
>> + ? ? ? ? ? ? ? ? "Please choose 'oss', 'alsa', 'nas' or 'pulse'.");
>> + ? ? ? ? }
>> + ? ? } while(next++);
>> ? ? ?}
>> - ? ?else if (!strcmp(audio_settings.audio_output_method, "alsa")){
>> - ? ? DBG("Using Alsa audio output method");
>> - ? ? module_audio_pars[0] = audio_settings.audio_alsa_device;
>> - ? ? module_audio_pars[1] = NULL;
>> - ? ? module_audio_id = spd_audio_open(AUDIO_ALSA, (void**) 
>> module_audio_pars, &error);
>> - ? ? module_audio_output_method = AUDIO_ALSA;
>> - ? ?}
>> - ? ?else if (!strcmp(audio_settings.audio_output_method, "nas")){
>> - ? ? DBG("Using NAS audio output method");
>> - ? ? module_audio_pars[0] = audio_settings.audio_nas_server;
>> - ? ? module_audio_pars[1] = NULL;
>> - ? ? module_audio_id = spd_audio_open(AUDIO_NAS, (void**) 
>> module_audio_pars, &error);
>> - ? ? module_audio_output_method = AUDIO_NAS;
>> - ? ?}
>> - ? ?else if (!strcmp(audio_settings.audio_output_method, "pulse")){
>> - ? ? DBG("Using PulseAudio output method");
>> - ? ? module_audio_pars[0] = (void *) audio_settings.audio_pulse_server;
>> - ? ? module_audio_pars[1] = (void *) audio_settings.audio_pulse_max_length;
>> - ? ? module_audio_pars[2] = (void *) 
>> audio_settings.audio_pulse_target_length;
>> - ? ? module_audio_pars[3] = (void *) 
>> audio_settings.audio_pulse_pre_buffering;
>> - ? ? module_audio_pars[4] = (void *) audio_settings.audio_pulse_min_request;
>> - ? ? module_audio_pars[5] = NULL;
>> - ? ? ? ?module_audio_id = spd_audio_open(AUDIO_PULSE, (void**) 
>> module_audio_pars, &error);
>> - ? ? module_audio_output_method = AUDIO_PULSE;
>> - ? ?}
>> - ? ?else{
>> - ? ? ABORT("Sound output method specified in configuration not supported. "
>> - ? ? ? ? ? "Please choose 'oss', 'alsa', 'nas' or 'pulse'.");
>> - ? ?}
>> - ? ?if (module_audio_id == NULL){
>> +
>> + ? ?if (!audio_output_set){
>> ? ? ? g_string_append_printf(info, "Opening sound device failed. Reason: %s. 
>> ", error);
>> ? ? ? ABORT("Can't open sound device.");
>> ? ? ?}
>> --
>> 1.6.3.1
>>
>>
>> _______________________________________________
>> Speechd mailing list
>> Speechd at lists.freebsoft.org
>> http://lists.freebsoft.org/mailman/listinfo/speechd
> Halim Sahin
> E-Mail:
> halim.sahin (at) t-online.de
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd
>



reply via email to

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