* speaker-test cleanups and fixes
@ 2009-05-10 0:27 Dan McGee
2009-05-10 0:27 ` [PATCH 1/3] speaker-test: allow frequency to be floating point Dan McGee
2009-05-11 7:10 ` speaker-test cleanups and fixes Jaroslav Kysela
0 siblings, 2 replies; 5+ messages in thread
From: Dan McGee @ 2009-05-10 0:27 UTC (permalink / raw)
To: alsa-devel
This is a series of 3 (mostly unrelated) patches to clean up and fix up a
few shortcomings I found in the speaker-test program. Please let me know
of any concerns or comments on the patches.
-Dan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] speaker-test: allow frequency to be floating point
2009-05-10 0:27 speaker-test cleanups and fixes Dan McGee
@ 2009-05-10 0:27 ` Dan McGee
2009-05-10 0:27 ` [PATCH 2/3] Allow frequencies down to 30 Hz Dan McGee
2009-05-11 7:10 ` speaker-test cleanups and fixes Jaroslav Kysela
1 sibling, 1 reply; 5+ messages in thread
From: Dan McGee @ 2009-05-10 0:27 UTC (permalink / raw)
To: alsa-devel; +Cc: Dan McGee
Use atof() rather than atoi() to store the frequency- we were already using
a floating point value internally but did not let the user specify one from
the command line.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
speaker-test/speaker-test.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 63a7151..5e00ea4 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -76,7 +76,7 @@ static unsigned int speaker = 0; /* count of channels */
static unsigned int buffer_time = 0; /* ring buffer length in us */
static unsigned int period_time = 0; /* period time in us */
static unsigned int nperiods = 4; /* number of periods */
-static double freq = 440; /* sinusoidal wave frequency in Hz */
+static double freq = 440.0; /* sinusoidal wave frequency in Hz */
static int test_type = TEST_PINK_NOISE; /* Test type. 1 = noise, 2 = sine wave */
static pink_noise_t pink;
static snd_pcm_uframes_t buffer_size;
@@ -860,9 +860,9 @@ int main(int argc, char *argv[]) {
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 < 50.0 ? 50.0 : freq;
+ freq = freq > 5000.0 ? 5000.0 : freq;
break;
case 'b':
buffer_time = atoi(optarg);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] Allow frequencies down to 30 Hz
2009-05-10 0:27 ` [PATCH 1/3] speaker-test: allow frequency to be floating point Dan McGee
@ 2009-05-10 0:27 ` Dan McGee
2009-05-10 0:27 ` [PATCH 3/3] Remove dead/commented out code Dan McGee
0 siblings, 1 reply; 5+ messages in thread
From: Dan McGee @ 2009-05-10 0:27 UTC (permalink / raw)
To: alsa-devel; +Cc: Dan McGee
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
This patch is partially an RFC- it seems odd that we limit the frequency
at all. I proposed lowering it to 30 here only because that is what my
subwoofer can handle, but it may be better to just accept anything above
zero, or choose something like 20.
-Dan
speaker-test/speaker-test.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 5e00ea4..38e5462 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -861,7 +861,7 @@ int main(int argc, char *argv[]) {
break;
case 'f':
freq = atof(optarg);
- freq = freq < 50.0 ? 50.0 : freq;
+ freq = freq < 30.0 ? 30.0 : freq;
freq = freq > 5000.0 ? 5000.0 : freq;
break;
case 'b':
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] Remove dead/commented out code
2009-05-10 0:27 ` [PATCH 2/3] Allow frequencies down to 30 Hz Dan McGee
@ 2009-05-10 0:27 ` Dan McGee
0 siblings, 0 replies; 5+ messages in thread
From: Dan McGee @ 2009-05-10 0:27 UTC (permalink / raw)
To: alsa-devel; +Cc: Dan McGee
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
speaker-test/speaker-test.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 38e5462..d983a4f 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -142,17 +142,6 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
float *samp_f = (float*) frames;
while (count-- > 0) {
- //res = sin((phase * 2 * M_PI) / max_phase - M_PI) * 32767;
- //res = sin((phase * 2 * M_PI) / max_phase - M_PI) * 32767;
- //res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */
- //if (res > 0) res = 10000;
- //if (res < 0) res = -10000;
-
- /* printf("%e\n",res); */
- //ires = res;
- //ires = ((16 - (count & 0xf)) <<24);
- //ires = 0;
-
for(chn=0;chn<channels;chn++) {
switch (format) {
case SND_PCM_FORMAT_S8:
@@ -195,11 +184,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas
res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0.75 ; /* Don't use MAX volume */
fres = res;
*samp_f++ = fres;
- //*samp32++ = 0xF2345678;
- //printf("res=%lf, ires=%d 0x%x, samp32=0x%x\n",res,ires, ires, samp32[-1]);
} else {
- //*samp32++ = ires+0x10000;
- //*samp32++ = ires;
*samp_f++ = 0.0;
}
break;
--
1.6.2.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: speaker-test cleanups and fixes
2009-05-10 0:27 speaker-test cleanups and fixes Dan McGee
2009-05-10 0:27 ` [PATCH 1/3] speaker-test: allow frequency to be floating point Dan McGee
@ 2009-05-11 7:10 ` Jaroslav Kysela
1 sibling, 0 replies; 5+ messages in thread
From: Jaroslav Kysela @ 2009-05-11 7:10 UTC (permalink / raw)
To: Dan McGee; +Cc: alsa-devel
On Sat, 9 May 2009, Dan McGee wrote:
> This is a series of 3 (mostly unrelated) patches to clean up and fix up a
> few shortcomings I found in the speaker-test program. Please let me know
> of any concerns or comments on the patches.
Hi,
I applied all 5 patches to our git repo. Thanks for your code.
Jaroslav
-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-11 7:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-10 0:27 speaker-test cleanups and fixes Dan McGee
2009-05-10 0:27 ` [PATCH 1/3] speaker-test: allow frequency to be floating point Dan McGee
2009-05-10 0:27 ` [PATCH 2/3] Allow frequencies down to 30 Hz Dan McGee
2009-05-10 0:27 ` [PATCH 3/3] Remove dead/commented out code Dan McGee
2009-05-11 7:10 ` speaker-test cleanups and fixes Jaroslav Kysela
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.