speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 1/1] add --with-audio-output-method=<name> option


From: Andrei Kholodnyi
Subject: [PATCH 1/1] add --with-audio-output-method=<name> option
Date: Thu, 2 Dec 2010 14:35:00 +0100

it is possible now to set a default audio output method during configure
if option is not set during configure,
then the first available audio method is used,
e.g. if pulse, alsa and libao are available, pulse will be taken as a default
---
 configure.ac               |   65 +++++++++++++++++++++++++-------------------
 src/server/Makefile.am     |    5 +++-
 src/server/configuration.c |    8 +----
 3 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/configure.ac b/configure.ac
index 58a233c..d8bfb3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,6 +203,21 @@ AM_CONDITIONAL([pico_support], [test $with_pico = "yes"])
 # clear static audio plugins list
 STATIC_AUDIO_PLUGINS_LIST=""
 
+# check for pulseaudio support
+AC_ARG_WITH([pulse],
+       [AS_HELP_STRING([--with-pulse], [include pulseaudio support])],
+       [],
+       [with_pulse=check])
+AS_IF([test $with_pulse != "no"],
+       [PKG_CHECK_MODULES([PULSE], [libpulse-simple],
+               [with_pulse=yes;
+               STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST pulse"],
+               [AS_IF([test $with_pulse = "yes"],
+                       [AC_MSG_FAILURE([pulseaudio is not available])])])])
+AM_CONDITIONAL([pulse_support], [test $with_pulse = "yes"])
+AC_SUBST([PULSE_CFLAGS])
+AC_SUBST([PULSE_LIBS])
+
 # check for alsa support
 AC_ARG_WITH([alsa],
        [AS_HELP_STRING([--with-alsa], [include ALSA support])],
@@ -233,6 +248,19 @@ AM_CONDITIONAL([libao_support], [test $with_libao = "yes"])
 AC_SUBST([LIBAO_CFLAGS])
 AC_SUBST([LIBAO_LIBS])
 
+#check for OSS support
+AC_ARG_WITH([oss],
+       [AS_HELP_STRING([--with-oss], [include oss support])],
+       [],
+       [with_oss=check])
+AS_IF([test $with_oss != "no"],
+       [AC_CHECK_HEADER([sys/soundcard.h],
+               [with_oss=yes;
+               STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST oss"],
+               [AS_IF([test $with_oss = "yes"],
+                       [AC_MSG_FAILURE([oss is not available])])])])
+AM_CONDITIONAL([oss_support], [test $with_oss = "yes"])
+
 # check for NAS support
 AC_ARG_WITH([nas],
        [AS_HELP_STRING([--with-nas], [include network audio system (nas) 
support])],
@@ -249,34 +277,6 @@ AS_IF([test $with_nas != "no"],
 AM_CONDITIONAL([nas_support], [test $with_nas = "yes"])
 AC_SUBST([NAS_LIBS])
 
-#check for OSS support
-AC_ARG_WITH([oss],
-       [AS_HELP_STRING([--with-oss], [include oss support])],
-       [],
-       [with_oss=check])
-AS_IF([test $with_oss != "no"],
-       [AC_CHECK_HEADER([sys/soundcard.h],
-               [with_oss=yes;
-               STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST oss"],
-               [AS_IF([test $with_oss = "yes"],
-                       [AC_MSG_FAILURE([oss is not available])])])])
-AM_CONDITIONAL([oss_support], [test $with_oss = "yes"])
-
-# check for pulseaudio support
-AC_ARG_WITH([pulse],
-       [AS_HELP_STRING([--with-pulse], [include pulseaudio support])],
-       [],
-       [with_pulse=check])
-AS_IF([test $with_pulse != "no"],
-       [PKG_CHECK_MODULES([PULSE], [libpulse-simple],
-               [with_pulse=yes;
-               STATIC_AUDIO_PLUGINS_LIST="$STATIC_AUDIO_PLUGINS_LIST pulse"],
-               [AS_IF([test $with_pulse = "yes"],
-                       [AC_MSG_FAILURE([pulseaudio is not available])])])])
-AM_CONDITIONAL([pulse_support], [test $with_pulse = "yes"])
-AC_SUBST([PULSE_CFLAGS])
-AC_SUBST([PULSE_LIBS])
-
 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,6 +286,15 @@ 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 47f69de..13493d0 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -11,7 +11,10 @@ speech_dispatcher_SOURCES = speechd.c speechd.h server.c 
server.h \
        output.c output.h sem_functions.c sem_functions.h \
        index_marking.c index_marking.h
 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
+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)\"
 speech_dispatcher_LDFLAGS = $(RDYNAMIC)
 speech_dispatcher_LDADD = $(lib_common) $(DOTCONF_LIBS) $(GLIB_LIBS) \
        $(GMODULE_LIBS) $(GTHREAD_LIBS) -lpthread $(EXTRA_SOCKET_LIBS)
diff --git a/src/server/configuration.c b/src/server/configuration.c
index 6306015..d9acada 100644
--- a/src/server/configuration.c
+++ b/src/server/configuration.c
@@ -454,12 +454,8 @@ load_default_global_set_options()
     GlobalFDSet.ssml_mode = SPD_DATA_TEXT;
     GlobalFDSet.notification = 0;
 
-#ifdef __SUNPRO_C
-/* Added by Willie Walker - default to OSS for Solaris */
-    GlobalFDSet.audio_output_method = g_strdup("oss");
-#else
-    GlobalFDSet.audio_output_method = g_strdup("pulse");
-#endif /* __SUNPRO_C */
+
+    GlobalFDSet.audio_output_method = g_strdup(DEFAULT_AUDIO_METHOD);
     GlobalFDSet.audio_oss_device = g_strdup("/dev/dsp");
     GlobalFDSet.audio_alsa_device = g_strdup("default");
     GlobalFDSet.audio_nas_server = g_strdup("tcp/localhost:5450");
-- 
1.7.0.4




reply via email to

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