summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-07-28 15:24:01 -0400
committerBrian Cully <bjc@spork.org>2025-07-28 15:24:01 -0400
commitd9be9dc9a0b72b08d5bfaf3803bb4c2ba1fb84d1 (patch)
tree71f73442a325623bc5556681a86d1287e4270245 /main.mjs
parent7ca6bcfb6cab46103f2f6d8e714c3e06b8157033 (diff)
downloadchords-d9be9dc9a0b72b08d5bfaf3803bb4c2ba1fb84d1.tar.gz
chords-d9be9dc9a0b72b08d5bfaf3803bb4c2ba1fb84d1.zip
wip: get tones playing again
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs13
1 files changed, 8 insertions, 5 deletions
diff --git a/main.mjs b/main.mjs
index 38cfc60..ad45d90 100644
--- a/main.mjs
+++ b/main.mjs
@@ -28,16 +28,18 @@ function play({ detail }) {
}
}).filter(n => n);
- player = new Player(played.map(([n, o]) => {
- return toCents([noteA, 4], [n, o]);
- }));
- player.start();
+ const getOffsets = () => {
+ return played.map(([n, o]) => toCents([noteA, 4], [n, o]));
+ }
+ player = document.querySelector('x-player');
+ player.getOffsets = getOffsets;
+ player.isPlaying = true;
}
function stop(e) {
console.debug('got stopEvent', e);
if (player) {
- player.stop();
+ player.isPlaying = false;
}
}
@@ -62,6 +64,7 @@ function init() {
Fretboard.register();
KeyPicker.register();
History.register();
+ Player.register();
// todo: maybe just attach the listener to document?
document.querySelectorAll(Fretboard.name).forEach(f => {