From patchwork Tue Mar 15 03:18:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: han.lu@intel.com X-Patchwork-Id: 8585121 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 15556C0553 for ; Tue, 15 Mar 2016 03:18:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F14A2027D for ; Tue, 15 Mar 2016 03:18:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A1ABC202AE for ; Tue, 15 Mar 2016 03:18:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A6B792654CE; Tue, 15 Mar 2016 04:18:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DE31F264F37; Tue, 15 Mar 2016 04:17:19 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EF7552614D4; Tue, 15 Mar 2016 04:17:17 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id 8595926066B for ; Tue, 15 Mar 2016 04:17:12 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 14 Mar 2016 20:17:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,337,1455004800"; d="scan'208";a="924131417" Received: from hanlu-optiplex-9020.sh.intel.com ([10.239.13.11]) by fmsmga001.fm.intel.com with ESMTP; 14 Mar 2016 20:17:10 -0700 From: han.lu@intel.com To: tiwai@suse.de, liam.r.girdwood@linux.intel.com, bernard.gautier@intel.com, edward.c.popescu@intel.com, alsa-devel@alsa-project.org Date: Tue, 15 Mar 2016 11:18:53 +0800 Message-Id: <8c11985dbf81d6bcbe62b30600c478f7fc7f0d40.1458011641.git.han.lu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: Cc: "Lu, Han" Subject: [alsa-devel] [PATCH 2/3] alsabat: add standalone mode X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lu, Han" 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 diff --git a/bat/Makefile.am b/bat/Makefile.am index 8dfafa9..5646e9a 100644 --- a/bat/Makefile.am +++ b/bat/Makefile.am @@ -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 diff --git a/bat/alsabat.1 b/bat/alsabat.1 index 8d0b9c0..5f41669 100644 --- a/bat/alsabat.1 +++ b/bat/alsabat.1 @@ -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 diff --git a/bat/bat.c b/bat/bat.c index 9c637f2..85ec5aa 100644 --- 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); diff --git a/bat/common.h b/bat/common.h index 5417c0e..30e39fc 100644 --- a/bat/common.h +++ b/bat/common.h @@ -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; diff --git a/configure.ac b/configure.ac index bdb133c..f6f8103 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,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" @@ -83,6 +85,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=""