]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
fade: Infrastructure for the modular mixer API.
authorAndre Noll <maan@systemlinux.org>
Sun, 15 Jul 2012 11:08:28 +0000 (13:08 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 7 Oct 2012 09:12:07 +0000 (11:12 +0200)
This commit prepares for supporting more than one mixer by introducing
$mixers in configure.ac which contains the set of supported mixers. It
creates an empty oss_mix.c file to which the oss-specific code will
be moved in the next patch.

The fade-specific stuff of configure.ac is moved to a separate section
since whether to build fade will soon no longer depend on OSS only.

The patch is a bit large due to some generic m4 macros being moved to
the top of configure.ac as they are needed in the new fade section.

configure.ac
error.h
oss_mix.c [new file with mode: 0644]

index d11c3ad7355537f6b343718618875aad3acd2944..b6010490a705c80f70c102c49aa31fb524267bcb 100644 (file)
@@ -7,6 +7,11 @@ AC_PREREQ([2.61])
 AC_INIT([paraslash],[git],[maan@systemlinux.org])
 AC_CONFIG_HEADER([config.h])
 
+AC_SUBST(install_sh, [$INSTALL])
+AC_CONFIG_FILES([Makefile])
+AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
+AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
+AC_DEFUN([objlist_to_errlist],[$(for i in $@; do printf "DEFINE_ERRLIST($(echo $i| tr 'a-z' 'A-Z'));"; done) [const char **para_errlist[[]]] = {$(for i in $@; do printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; done) }])
 AC_PATH_PROG(UNAMEPATH, uname, no)
 if test "$UNAMEPATH" = "no"; then
        AC_MSG_ERROR(unable to determine system type)
@@ -146,11 +151,6 @@ client_ldflags=""
 gui_cmdline_objs="add_cmdline(gui)"
 gui_errlist_objs="exec signal string stat ringbuffer fd gui gui_theme"
 gui_objs="$gui_cmdline_objs $gui_errlist_objs"
-
-fade_cmdline_objs="add_cmdline(fade)"
-fade_errlist_objs="fade exec string fd"
-
-
 ########################################################################### snprintf
 # ===========================================================================
 #        http://www.nongnu.org/autoconf-archive/ax_func_snprintf.html
@@ -804,19 +804,21 @@ OLD_LD_FLAGS="$LDFLAGS"
 OLD_LIBS="$LIBS"
 
 have_oss="yes"
-msg="=> will not build para_fade/oss writer"
+msg="=> will not build oss writer"
 
 AC_CHECK_HEADER(sys/soundcard.h, [
-       extras="$extras fade"
-       executables="$executables fade"
-       all_errlist_objs="$all_errlist_objs oss_write fade"
        audiod_errlist_objs="$audiod_errlist_objs oss_write"
        audiod_cmdline_objs="$audiod_cmdline_objs add_cmdline(oss_write)"
-
        write_errlist_objs="$write_errlist_objs oss_write"
        write_cmdline_objs="$write_cmdline_objs add_cmdline(oss_write)"
+       fade_errlist_objs="$fade_errlist_objs oss_mix"
+       all_errlist_objs="$all_errlist_objs oss_write oss_mix"
+
        writers="$writers oss"
        default_writer="OSS_WRITE"
+       mixers="${mixers}oss "
+       default_mixer="OSS_MIX"
+
        AC_CHECK_LIB(ossaudio, _oss_ioctl, [
                        audiod_ldflags="$audiod_ldflags -lossaudio"
                        write_ldflags="$write_ldflags -lossaudio"
@@ -874,6 +876,44 @@ fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
+########################################################################### fade
+if test -n "$mixers"; then
+       extras="$extras fade"
+       executables="$executables fade"
+       all_errlist_objs="$all_errlist_objs fade"
+       fade_errlist_objs="$fade_errlist_objs fade exec string fd"
+       fade_cmdline_objs="add_cmdline(fade)"
+       fade_objs="$fade_cmdline_objs $fade_errlist_objs"
+       AC_SUBST(fade_objs, add_dot_o($fade_objs))
+       AC_SUBST(fade_ldflags, $fade_ldflags)
+       AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
+               objlist_to_errlist($fade_errlist_objs),
+               errors used by para_fade)
+       enum="$(
+               for i in $mixers; do
+                       printf "${i}_MIX, " | tr '[a-z]' '[A-Z]'
+               done
+       )"
+       AC_DEFINE_UNQUOTED(MIXER_ENUM, $enum NUM_SUPPORTED_MIXERS,
+               enum of supported mixers)
+       AC_DEFINE_UNQUOTED(DEFAULT_MIXER, $default_mixer,
+               use this mixer if none was specified)
+       names="$(for i in $mixers; do printf \"$i\",' ' ; done)"
+       AC_DEFINE_UNQUOTED(MIXER_NAMES, $names, supported mixer names)
+       inits="$(
+               for i in $mixers; do
+                       printf 'extern void '$i'_mix_init(struct mixer *); '
+               done
+       )"
+       AC_DEFINE_UNQUOTED(DECLARE_MIXER_INITS, $inits,
+               init functions of the supported mixers)
+       array="$(for i in $mixers; do printf '{.init = '$i'_mix_init},'; done)"
+       AC_DEFINE_UNQUOTED(MIXER_ARRAY, $array, array of supported mixers)
+       mixer_summary="mixers supported by para_fade: $mixers"
+else
+       AC_MSG_WARN([no mixer support])
+       mixer_summary="para_fade: no"
+fi
 ########################################################################### libao
 OLD_CPPFLAGS="$CPPFLAGS"
 OLD_LD_FLAGS="$LDFLAGS"
@@ -995,16 +1035,6 @@ fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
-#############################################################
-
-
-AC_SUBST(install_sh, [$INSTALL])
-AC_CONFIG_FILES([Makefile])
-
-
-AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
-AC_DEFUN([add_para],[$(for i in $@; do printf "para_$i "; done)])
-AC_DEFUN([objlist_to_errlist],[$(for i in $@; do printf "DEFINE_ERRLIST($(echo $i| tr 'a-z' 'A-Z'));"; done) [const char **para_errlist[[]]] = {$(for i in $@; do printf "PARA_ERRLIST($(echo $i | tr 'a-z' 'A-Z')), "; done) }])
 ############################################################# error2.h
 AC_MSG_NOTICE(creating error2.h)
 for i in $executables; do
@@ -1056,7 +1086,6 @@ write_objs="$write_cmdline_objs $write_errlist_objs"
 client_objs="$client_cmdline_objs $client_errlist_objs"
 audioc_objs="$audioc_cmdline_objs $audioc_errlist_objs"
 afh_objs="$afh_cmdline_objs $afh_errlist_objs"
-fade_objs="$fade_cmdline_objs $fade_errlist_objs"
 
 AC_SUBST(recv_objs, add_dot_o($recv_objs))
 AC_SUBST(recv_ldflags, $recv_ldflags)
@@ -1102,12 +1131,6 @@ AC_SUBST(gui_objs, add_dot_o($gui_objs))
 AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
        objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
 
-AC_SUBST(fade_objs, add_dot_o($fade_objs))
-AC_SUBST(fade_ldflags, $fade_ldflags)
-AC_DEFINE_UNQUOTED(INIT_FADE_ERRLISTS,
-       objlist_to_errlist($fade_errlist_objs), errors used by para_fade)
-
-
 enum="$(for i in $filters; do printf "${i}_FILTER, " | tr '[a-z]' '[A-Z]'; done)"
 AC_DEFINE_UNQUOTED(FILTER_ENUM, $enum NUM_SUPPORTED_FILTERS,
        enum of supported filters)
@@ -1144,4 +1167,5 @@ id3 version2 support: $have_libid3tag
 filters supported by para_audiod/para_filter: $filters
 writers supported by para_audiod/para_write: $writers
 optional executables: $extras
+$mixer_summary
 ])
diff --git a/error.h b/error.h
index 2474e0ab87778a01da7c8c70290bc22b41d901e0..59c20767fa6450af97d6c487df94cd192996be08 100644 (file)
--- a/error.h
+++ b/error.h
@@ -33,6 +33,7 @@ DEFINE_ERRLIST_OBJECT_ENUM;
 #define FILE_WRITE_ERRORS
 #define STDIN_ERRORS
 #define WRITE_ERRORS
+#define OSS_MIX_ERRORS
 
 extern const char **para_errlist[];
 
diff --git a/oss_mix.c b/oss_mix.c
new file mode 100644 (file)
index 0000000..e69de29