All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anssi Hannula <anssi.hannula@mbnet.fi>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: [PATCH] Change the freq limit of speaker-test
Date: Tue, 21 Jun 2005 17:50:36 +0300	[thread overview]
Message-ID: <42B8293C.1060205@mbnet.fi> (raw)
In-Reply-To: <s5hzmtknf95.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

Takashi Iwai wrote:
> At Fri, 17 Jun 2005 21:14:48 +0300,
> Anssi Hannula wrote:
>>
>>I noticed that the speaker-test has limited sine wave frequency to 
>>50-5000 Hz. Attached patch changes that to 0-24575Hz (that's the limit 
>>at least here (x86-64) after which the freq would roll over to 0 Hz).
> 
> Does freq=0 really work?  I think this will result in zero-division.

Well, it produces the expected output (no sound) and does not crash.

> Also, atof() is better than atoi() for freq since freq is a double.
> 

OK, changed that. New patch attached.

-- 
Anssi Hannula


[-- Attachment #2: speaker-test_changelimits-atof.diff --]
[-- Type: text/x-patch, Size: 720 bytes --]

Index: speaker-test/speaker-test.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/speaker-test/speaker-test.c,v
retrieving revision 1.8
diff -u -r1.8 speaker-test.c
--- speaker-test/speaker-test.c	3 May 2005 18:36:08 -0000	1.8
+++ speaker-test/speaker-test.c	21 Jun 2005 14:44:01 -0000
@@ -531,9 +531,9 @@
       channels = channels > 1024 ? 1024 : channels;
       break;
     case 'f':
-      freq = atoi(optarg);
-      freq = freq < 50 ? 50 : freq;
-      freq = freq > 5000 ? 5000 : freq;
+      freq = atof(optarg);
+      freq = freq < 0 ? 0 : freq;
+      freq = freq > 24575 ? 24575 : freq;
       break;
     case 'b':
       buffer_time = atoi(optarg);

  reply	other threads:[~2005-06-21 14:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-17 18:14 [PATCH] Change the freq limit of speaker-test Anssi Hannula
2005-06-21 11:03 ` Takashi Iwai
2005-06-21 14:50   ` Anssi Hannula [this message]
2005-06-21 15:08     ` Takashi Iwai
2005-06-21 15:14       ` Anssi Hannula
2005-06-21 15:26         ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42B8293C.1060205@mbnet.fi \
    --to=anssi.hannula@mbnet.fi \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.