From patchwork Sun Feb 23 00:09:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: erik@caspar.alsa-project.org X-Patchwork-Id: 3709661 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6FA2A9F2ED for ; Mon, 24 Feb 2014 14:58:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C57A200DF for ; Mon, 24 Feb 2014 14:58:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5366A20131 for ; Mon, 24 Feb 2014 14:58:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 717F4265629; Mon, 24 Feb 2014 15:58: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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_NOFQDN1, NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1B9D8261AC4; Mon, 24 Feb 2014 15:47:20 +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 0584E262634; Sun, 23 Feb 2014 01:10:18 +0100 (CET) Received: from caspar (173-160-171-185-washington.hfc.comcastbusiness.net [173.160.171.185]) by alsa0.perex.cz (Postfix) with ESMTP id 2FBFC2625F3; Sun, 23 Feb 2014 01:10:12 +0100 (CET) Received: by caspar (Postfix, from userid 1000) id 481C12E0175; Sat, 22 Feb 2014 16:10:10 -0800 (PST) From: erik@caspar.alsa-project.org To: patch@alsa-project.org Date: Sat, 22 Feb 2014 16:09:57 -0800 Message-Id: <1393114197-4581-1-git-send-email-erik> X-Mailer: git-send-email 1.8.3.2 X-Mailman-Approved-At: Mon, 24 Feb 2014 15:47:18 +0100 Cc: alsa-devel@alsa-project.org, Erik Ackermann Subject: [alsa-devel] [PATCH - speaker-test 1/1] speaker-test: add --force-frequency option to allow hz outside range 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: Erik Ackermann Signed-off-by: Erik Ackermann diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index 261f399..22927f2 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -106,6 +106,7 @@ static snd_pcm_uframes_t period_size; static const char *given_test_wav_file = NULL; static char *wav_file_dir = SOUNDSDIR; static int debug = 0; +static int force_frequency = 0; static int in_aborting = 0; static snd_pcm_t *pcm_handle = NULL; @@ -1015,6 +1016,7 @@ static void help(void) "-w,--wavfile Use the given WAV file as a test sound\n" "-W,--wavdir Specify the directory containing WAV files\n" "-m,--chmap Specify the channel map to override\n" + "-X,--force-frequency force frequencies outside the 30-5000hz range\n" "\n")); printf(_("Recognized sample formats are:")); for (fmt = supported_formats; *fmt >= 0; fmt++) { @@ -1057,6 +1059,7 @@ int main(int argc, char *argv[]) { {"wavfile", 1, NULL, 'w'}, {"wavdir", 1, NULL, 'W'}, {"debug", 0, NULL, 'd'}, + {"force-frequncy", 1, NULL, 'X'}, #ifdef CONFIG_SUPPORT_CHMAP {"chmap", 1, NULL, 'm'}, #endif @@ -1078,7 +1081,7 @@ int main(int argc, char *argv[]) { while (1) { int c; - if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d" + if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:X" #ifdef CONFIG_SUPPORT_CHMAP "m:" #endif @@ -1114,8 +1117,6 @@ int main(int argc, char *argv[]) { break; case 'f': freq = atof(optarg); - freq = freq < 30.0 ? 30.0 : freq; - freq = freq > 5000.0 ? 5000.0 : freq; break; case 'b': buffer_time = atoi(optarg); @@ -1173,6 +1174,9 @@ int main(int argc, char *argv[]) { case 'd': debug = 1; break; + case 'X': + force_frequency = 1; + break; #ifdef CONFIG_SUPPORT_CHMAP case 'm': chmap = optarg; @@ -1190,6 +1194,11 @@ int main(int argc, char *argv[]) { exit(EXIT_SUCCESS); } + if (!force_frequency) { + freq = freq < 30.0 ? 30.0 : freq; + freq = freq > 5000.0 ? 5000.0 : freq; + } + if (test_type == TEST_WAV) format = SND_PCM_FORMAT_S16_LE; /* fixed format */