]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsabat: add standalone mode
authorLu, Han <han.lu@intel.com>
Tue, 15 Mar 2016 03:18:53 +0000 (11:18 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 15 Mar 2016 08:59:26 +0000 (09:59 +0100)
Add support for standalone mode where alsabat will run on a
different machine to the one being tested.
In standalone mode, the alsabat just generates, playback and
capture sound data like in normal mode, but does not analyze.
The alsabat being built without libfftw3 support is always work
in standalone mode.
The alsabat in normal mode can also bypass data analysis using
option "--standalone".

Signed-off-by: Lu, Han <han.lu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
bat/Makefile.am
bat/alsabat.1
bat/bat.c
bat/common.h
configure.ac

index 8dfafa99e179168a13e9f6f42bde148094cdc6c3..5646e9a6ad0955d7716be0e35032122e72f413e6 100644 (file)
@@ -6,7 +6,6 @@ EXTRA_DIST = alsabat.1
 alsabat_SOURCES = \
        bat.c \
        common.c \
-       analyze.c \
        signal.c \
        convert.c \
        alsa.c
@@ -15,8 +14,12 @@ noinst_HEADERS = \
        common.h \
        bat-signal.h \
        alsa.h \
-       convert.h \
-       analyze.h
+       convert.h
+
+if HAVE_LIBFFTW3
+alsabat_SOURCES += analyze.c
+noinst_HEADERS += analyze.h
+endif
 
 AM_CPPFLAGS = \
              -Wall -I$(top_srcdir)/include
index 8d0b9c0b9c0ec01f131fe3b418e8878e10abc3ff..5f41669dd1412d220edaa4a59e71dd2a9ddd4968 100644 (file)
@@ -120,6 +120,15 @@ Internal loopback mode.
 Playback, capture and analysis internal to ALSABAT only. This is intended
 for developers to test new ALSABAT features as no audio is routed outside
 of ALSABAT.
+.TP
+\fI\-\-standalone\fP
+Add support for standalone mode where ALSABAT will run on a different machine
+to the one being tested.
+In standalone mode, the sound data can be generated, playback and captured
+just like in normal mode, but will not be analyzed.
+The ALSABAT being built without libfftw3 support is always in standalone mode.
+The ALSABAT in normal mode can also bypass data analysis using option
+"--standalone".
 
 .SH EXAMPLES
 
index 9c637f2ac5f657d04af699a71e1a1f5daffa7e7b..85ec5aa362d6f55af8a8b5341acffd86b1dc674a 100644 (file)
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -33,7 +33,9 @@
 
 #include "alsa.h"
 #include "convert.h"
+#ifdef HAVE_LIBFFTW3
 #include "analyze.h"
+#endif
 
 static int get_duration(struct bat *bat)
 {
@@ -289,6 +291,7 @@ _("Usage: alsabat [-options]...\n"
 "      --file=#           file for playback\n"
 "      --saveplay=#       file that storing playback content, for debug\n"
 "      --local            internal loop, set to bypass pcm hardware devices\n"
+"      --standalone       standalone mode, to bypass analysis\n"
 ));
        fprintf(bat->log, _("Recognized sample formats are: %s %s %s %s\n"),
                        snd_pcm_format_name(SND_PCM_FORMAT_U8),
@@ -339,6 +342,7 @@ static void parse_arguments(struct bat *bat, int argc, char *argv[])
                {"file",     1, 0, OPT_READFILE},
                {"saveplay", 1, 0, OPT_SAVEPLAY},
                {"local",    0, 0, OPT_LOCAL},
+               {"standalone", 0, 0, OPT_STANDALONE},
                {0, 0, 0, 0}
        };
 
@@ -357,6 +361,9 @@ static void parse_arguments(struct bat *bat, int argc, char *argv[])
                case OPT_LOCAL:
                        bat->local = true;
                        break;
+               case OPT_STANDALONE:
+                       bat->standalone = true;
+                       break;
                case 'D':
                        if (bat->playback.device == NULL)
                                bat->playback.device = optarg;
@@ -601,7 +608,12 @@ int main(int argc, char *argv[])
                test_loopback(&bat);
 
 analyze:
-       err = analyze_capture(&bat);
+#ifdef HAVE_LIBFFTW3
+       if (!bat.standalone)
+               err = analyze_capture(&bat);
+#else
+       fprintf(bat.log, _("No libfftw3 library. Exit without analysis.\n"));
+#endif
 out:
        fprintf(bat.log, _("\nReturn value is %d\n"), err);
 
index 5417c0e5092a6d40f552320d67dfe1d7bb579613..30e39fcfeb5e32acf9a6e4d65c1222c76a7da83c 100644 (file)
@@ -23,6 +23,7 @@
 #define OPT_READFILE                   (OPT_BASE + 2)
 #define OPT_SAVEPLAY                   (OPT_BASE + 3)
 #define OPT_LOCAL                      (OPT_BASE + 4)
+#define OPT_STANDALONE                 (OPT_BASE + 5)
 
 #define COMPOSE(a, b, c, d)            ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
 #define WAV_RIFF                       COMPOSE('R', 'I', 'F', 'F')
@@ -150,6 +151,7 @@ struct bat {
        char *narg;                     /* argument string of duration */
        char *logarg;                   /* path name of log file */
        char *debugplay;                /* path name to store playback signal */
+       bool standalone;                /* enable to bypass analysis */
 
        struct pcm playback;
        struct pcm capture;
index 9e48190fe42d886137da7e903fd45acdf3e88ed6..d712872f20d7fb567b5d62390589447efcbed041 100644 (file)
@@ -79,7 +79,9 @@ if test x$bat = xtrue; then
   FFTW_INC=""
   FFTW_LIB=""
   FFTW_CFLAGS=""
-  AC_CHECK_LIB([fftw3], [fftw_malloc], , [AC_MSG_ERROR([Error: need FFTW3 library])])
+  dnl Check for libfftw3
+  have_libfftw3="yes"
+  AC_CHECK_LIB([fftw3], [fftw_malloc], , [have_libfftw3="no"])
   AC_CHECK_LIB([m], [sqrtf], , [AC_MSG_ERROR([Error: Need sqrtf])])
   AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([Error: need PTHREAD library])])
   FFTW_CFLAGS="$CFLAGS"
@@ -92,6 +94,7 @@ if test x$bat = xtrue; then
   AC_SUBST(FFTW_CFLAGS)
 
 fi
+AM_CONDITIONAL(HAVE_LIBFFTW3, test "$have_libfftw3" = "yes")
 
 dnl Check for librt
 LIBRT=""