speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] rework default audio output method


From: William Hubbs
Subject: [PATCH] rework default audio output method
Date: Wed, 8 Dec 2010 00:38:32 -0600

Change the command line argument to --with-default-audio-method, which
is a more clear name for it than --with-audio-output-method. since this
argument configures the default method.

Rework the default selection method so that the cut command doesn't have
to be used by creating a variable which will be set to the name of the
first audio method that is found then overridden if there is a
--with-default-audio-method argument on the command line.
---
 configure.ac           |   42 +++++++++++++++++++++++++++---------------
 src/server/Makefile.am |    2 +-
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index d8bfb3f..5bd1056 100644
--- a/configure.ac
+++ b/configure.ac
@@ -199,10 +199,13 @@ AS_IF([test $with_pico != "no"],
                        [AC_MSG_FAILURE([SVOX pico is not available])])])])
 AM_CONDITIONAL([pico_support], [test $with_pico = "yes"])
 
-# checks for audio subsystems
 # clear static audio plugins list
 STATIC_AUDIO_PLUGINS_LIST=""
 
+# clear default audio method
+default_audio_method=""
+
+# checks for audio subsystems
 # check for pulseaudio support
 AC_ARG_WITH([pulse],
        [AS_HELP_STRING([--with-pulse], [include pulseaudio support])],
@@ -210,7 +213,9 @@ AC_ARG_WITH([pulse],
        [with_pulse=check])
 AS_IF([test $with_pulse != "no"],
        [PKG_CHECK_MODULES([PULSE], [libpulse-simple],
-               [with_pulse=yes;
+               [with_pulse=yes
+               AS_IF([test -z "$default_audio_method"],
+                       [default_audio_method=pulse])
                STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST pulse"],
                [AS_IF([test $with_pulse = "yes"],
                        [AC_MSG_FAILURE([pulseaudio is not available])])])])
@@ -225,7 +230,9 @@ AC_ARG_WITH([alsa],
        [with_alsa=check])
 AS_IF([test $with_alsa != "no"],
        [PKG_CHECK_MODULES([ALSA], [alsa],
-               [with_alsa=yes;
+               [with_alsa=yes
+               AS_IF([test -z "$default_audio_method"],
+                       [default_audio_method=alsa])
                STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST alsa"],
                [AS_IF([test $with_alsa = "yes"],
                        [AC_MSG_FAILURE([ALSA is not available])])])])
@@ -240,7 +247,9 @@ AC_ARG_WITH([libao],
        [with_libao=check])
 AS_IF([test $with_libao != "no"],
        [PKG_CHECK_MODULES([LIBAO], [ao],
-               [with_libao=yes;
+               [with_libao=yes
+               AS_IF([test -z "$default_audio_method"],
+                       [default_audio_method=libao])
                STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST libao"],
                [AS_IF([test $with_libao = yes],
                        [AC_MSG_FAILURE([libao is not available])])])])
@@ -255,7 +264,9 @@ AC_ARG_WITH([oss],
        [with_oss=check])
 AS_IF([test $with_oss != "no"],
        [AC_CHECK_HEADER([sys/soundcard.h],
-               [with_oss=yes;
+               [with_oss=yes
+               AS_IF([test -z "$default_audio_method"],
+                       [default_audio_method=oss])
                STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST oss"],
                [AS_IF([test $with_oss = "yes"],
                        [AC_MSG_FAILURE([oss is not available])])])])
@@ -268,7 +279,9 @@ AC_ARG_WITH([nas],
        [with_nas=check])
 AS_IF([test $with_nas != "no"],
        [AC_CHECK_LIB([audio], [AuOpenServer],
-               [with_nas=yes;
+               [with_nas=yes
+               AS_IF([test -z "$default_audio_method"],
+                       [default_audio_method=nas])
                STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST nas";
                NAS_LIBS="-L/usr/X11R6/lib -lXau -laudio"],
                [AS_IF([test $with_nas = "yes"],
@@ -277,6 +290,14 @@ AS_IF([test $with_nas != "no"],
 AM_CONDITIONAL([nas_support], [test $with_nas = "yes"])
 AC_SUBST([NAS_LIBS])
 
+AC_ARG_WITH([default-audio-method],
+       [AS_HELP_STRING([--with-default-audio-method=<name>],
+               [defines default audio method (default - first discovered)])],
+       [default_audio_method="$withval"],
+       [])
+AC_MSG_NOTICE([Default audio method is $default_audio_method])
+AC_SUBST([default_audio_method])
+
 for name in $STATIC_AUDIO_PLUGINS_LIST; do
        STATIC_AUDIO_PLUGINS_GET="$STATIC_AUDIO_PLUGINS_GET${name}_plugin_get,";
        STATIC_AUDIO_PLUGINS_EXTERN="${STATIC_AUDIO_PLUGINS_EXTERN} extern 
spd_audio_plugin_t const * ${name}_plugin_get (void); "
@@ -286,15 +307,6 @@ done
 AC_SUBST([STATIC_AUDIO_PLUGINS_EXTERN])
 AC_SUBST([STATIC_AUDIO_PLUGINS_GET])
 
-AC_MSG_CHECKING(for default audio output method)
-AC_ARG_WITH([audio-output-method],
-       [AS_HELP_STRING([--with-audio-output-method=<name>], [defines audio 
output method (default - first discovered)])],
-       [],
-       [with_audio_output_method=`echo $STATIC_AUDIO_PLUGINS_LIST | cut -d ' ' 
-f 1`])
-
-AC_SUBST([with_audio_output_method])
-AC_MSG_RESULT($with_audio_output_method)
-
 # current, age and revision values for shared libraries.
 LIB_SDAUDIO_CURRENT=2 # Current main version (increment on every API change -- 
incompatible AND extensions)
 LIB_SDAUDIO_REVISION=4 # Current minor version (increment on every 
implementation change)
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 13493d0..54dd64c 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -14,7 +14,7 @@ speech_dispatcher_CFLAGS = $(ERROR_CFLAGS)
 speech_dispatcher_CPPFLAGS = $(inc_local) $(DOTCONF_CFLAGS) $(GLIB_CFLAGS) \
        $(GMODULE_CFLAGS) $(GTHREAD_CFLAGS) -DSYS_CONF=\"$(spdconfdir)\" \
        -DSND_DATA=\"$(snddatadir)\" -DMODULEBINDIR=\"$(modulebindir)\" \
-       -D_GNU_SOURCE -DDEFAULT_AUDIO_METHOD=\"$(with_audio_output_method)\"
+       -D_GNU_SOURCE -DDEFAULT_AUDIO_METHOD=\"$(default_audio_method)\"
 speech_dispatcher_LDFLAGS = $(RDYNAMIC)
 speech_dispatcher_LDADD = $(lib_common) $(DOTCONF_LIBS) $(GLIB_LIBS) \
        $(GMODULE_LIBS) $(GTHREAD_LIBS) -lpthread $(EXTRA_SOCKET_LIBS)
-- 
1.7.2.2




reply via email to

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