From 61dc64d88cddefe8ade1352291c66216909ca6e1 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Fri, 19 Feb 2010 00:32:19 -0500 Subject: [PATCH] Update progenv/gentimes.pl, and add gentimes.h --- progenv/gentimes.h | 10 ++++++++++ progenv/gentimes.pl | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 progenv/gentimes.h diff --git a/progenv/gentimes.h b/progenv/gentimes.h new file mode 100644 index 0000000..4d68e2a --- /dev/null +++ b/progenv/gentimes.h @@ -0,0 +1,10 @@ +#ifndef _GENTIMES_H_ +#define _GENTIMES_H_ + +extern const s8 sinetable[]; +extern const u16 freqtable[]; + +extern const int T0DIV; +extern const int T0MAX; + +#endif diff --git a/progenv/gentimes.pl b/progenv/gentimes.pl index 14f911f..679f915 100644 --- a/progenv/gentimes.pl +++ b/progenv/gentimes.pl @@ -28,13 +28,15 @@ my $FCPU = 20000000; my $SAMPLERATE = 16000; my $SINEWSIZE = 64; -print "static const s8 sinetable[] = {\n"; +print "#include \"progenv/gentimes.h\"\n"; + +print "const s8 sinetable[] = {\n"; print join ", ", map { int } @{gensinetab($SINEWSIZE,127)} ; print "};\n\n"; # The frequency table ranges from C1 (note 4) to B7 (note 87) # -print "static const u16 freqtable[] = {\n"; +print "const u16 freqtable[] = {\n"; foreach (@{genfreqtab($SAMPLERATE,4,87)}) { printf "%4x, ", int($_); } print "};\n\n"; @@ -44,6 +46,6 @@ my @t0denoms = ( undef, 1, 8, 64, 256, 1024, undef, undef ); my $ix = 1; while ($ix < 5 and $FCPU/$SAMPLERATE/$t0denoms[$ix] > 255) { $ix++; } die if $ix == 5; -print "static const int T0DIV = ", $ix, ";\n"; -print "static const int T0MAX = ", +print "const int T0DIV = ", $ix, ";\n"; +print "const int T0MAX = ", int($FCPU/$SAMPLERATE/$t0denoms[$ix]), ";\n\n"; -- 2.50.1