diff --git a/Makefile b/Makefile
index 23b6b3a..a13f75b 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
all: js/application.js js/preact.min.js | js
-js/application.js : src/main.jsx src/application.jsx src/note_input.jsx src/radio_group.jsx
+js/application.js : src/main.jsx src/application.jsx src/note_input.jsx src/sine_wave_data.jsx
esbuild --bundle --jsx-factory=preact.h --jsx-fragment=preact.Fragment --format=esm \
src/main.jsx --outfile=js/application.js
diff --git a/src/application.jsx b/src/application.jsx
index b8b039d..f77c3c1 100644
--- a/src/application.jsx
+++ b/src/application.jsx
@@ -3,7 +3,7 @@
import { NoteInput, NoteFrequency } from './note_input';
import { RadioGroup } from './radio_group';
-
+import { SineWaveData } from './sine_wave_data';
function calc_sr(osc) {
// iigs is ~7.14Mhz / 8. Mirage is 8Mhz / 8
@@ -70,7 +70,7 @@ function Frequency(props) {
function nmultiply(x) {
if (x == 0) return 0;
if (x == 1) return n;
- return {x} * n;
+ return <>{x} * n>;
// return paren ? ({x} * n) : {x} * n;
}
function SampleDisplay(props) {
@@ -118,35 +118,22 @@ function SampleDisplay(props) {
return rv;
}
-function SineWave() {
- var rv = [];
- for (n = 0; n < 256; ++n) {
- var x = 128 + Math.round(127 * Math.sin(n * Math.PI / 128));
- var y = x.toString(16); if (y.length < 2) y = "0" + y;
- rv.push( y );
- if ((n & 0x07) == 0x07) rv.push("\n");
- else rv.push(', ');
- }
-
- return (
-
-
- );
-}
function NoteDisplay(props) {
- var { osc, wave, note } = props;
+ var { osc, note } = props;
+
+ const wave = 0; // 256
const sr = calc_sr(osc);
const note_frq = NoteFrequency(note);
const f = note_frq / (sr / (1 << (8 + wave)));
+ // best_res = 7 - Math.ceil(Math.log2(f)) ?
+ // best_freq = f * (1 << calc_shift(best_res, 0)) ?
+
var best_res = 0;
var best_freq = 0;
for (var res = 0; res < 8; ++res) {
@@ -158,14 +145,16 @@ function NoteDisplay(props) {
return (
<>
+
- {rv}
-
-
+
+ {code}
+
+
+ );
+}
\ No newline at end of file