From d9be9dc9a0b72b08d5bfaf3803bb4c2ba1fb84d1 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 28 Jul 2025 15:24:01 -0400 Subject: wip: get tones playing again --- main.mjs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'main.mjs') 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 => { -- cgit v1.3