summaryrefslogtreecommitdiffstats
path: root/main.mjs
diff options
context:
space:
mode:
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 => {