]> hydra-www.ietfng.org Git - acmetensortoys-chiptunes/commitdiff
Update progenv/gentimes.pl, and add gentimes.h
authorNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Fri, 19 Feb 2010 05:32:19 +0000 (00:32 -0500)
committerNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Fri, 19 Feb 2010 05:32:19 +0000 (00:32 -0500)
progenv/gentimes.h [new file with mode: 0644]
progenv/gentimes.pl

diff --git a/progenv/gentimes.h b/progenv/gentimes.h
new file mode 100644 (file)
index 0000000..4d68e2a
--- /dev/null
@@ -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
index 14f911fdcedf5cc1ce3074ae5ba6b9e959bb47ce..679f9152590ee0e8ebfe0be0a6cb5825a030d4a0 100644 (file)
@@ -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";