[uClinux-dev] [patch] fixup tone includes, usage, and default
magnitude
Greg Ungerer
gerg at snapgear.com
Wed Jun 20 08:18:29 EDT 2007
Hi Mike,
Mike Frysinger wrote:
> the default magnitude is not initialized properly which can lead to very
> quite tones (inaudible actually), so i've set the default value to 100
> (since that's about half way between the min and max). i also fixed up
> the headers to pull in proper ones for prototypes and such, and touched
> up the usage to document the -m option and more accurately describe the
> -f flag.
>
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
Looks good, applied.
Thanks
Greg
> Index: user/play/tone.c
> ===================================================================
> RCS file: /usr/local/src/uClinux/local-cvs/,v/user/play/tone.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 tone.c
> --- user/play/tone.c 15 Jun 2007 05:02:14 -0000 1.1.1.1
> +++ user/play/tone.c 19 Jun 2007 23:19:00 -0000
> @@ -14,7 +14,9 @@
> #include <fcntl.h>
> #include <errno.h>
> #include <getopt.h>
> -#include <mathf.h>
> +#include <sys/ioctl.h>
> +#include <unistd.h>
> +#include <math.h>
>
> #include <linux/soundcard.h>
>
> @@ -143,14 +145,15 @@ char *wavnames[] = {
>
> void usage(int rc)
> {
> - printf("usage: tone [-?hsqrwe] [-f replay-freq] [wave-freq]\n\n"
> + printf("usage: tone [-?hsqrwe] [-m magnitude] [-f sample-freq] [wave-freq]\n\n"
> "\t-h?\tthis help\n"
> "\t-s\tsine wave output\n"
> "\t-q\tsquare wave output\n"
> "\t-r\tramp wave output\n"
> "\t-w\tsawtooth wave output\n"
> "\t-e\toutput big-endian data\n"
> - "\t-f\tfrequency of replay engine\n");
> + "\t-m\tmagnitude of wave (0 <= x <= 256)\n"
> + "\t-f\tsampling frequency\n");
> exit(rc);
> }
>
> @@ -161,6 +164,7 @@ int main(int argc, char *argv[])
> int ofd, i, c, size, mag, endian;
> int replayfreq, wavefreq, wavetyp;
>
> + mag = 100;
> replayfreq = 48000;
> wavetyp = SINE;
> wavefreq = 1000;
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>
--
------------------------------------------------------------------------
Greg Ungerer -- Chief Software Dude EMAIL: gerg at snapgear.com
SnapGear -- a Secure Computing Company PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
More information about the uClinux-dev
mailing list