From e8864387c61f209cfb6c2478f63abe33255b8f4b Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 18 Apr 2017 18:40:06 -0400 Subject: [PATCH] Use native audio buffer source node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of the Tone js wrapper for it, because a recent update to Tone changed the ‘onended’ callback in a way that broke our “play sound until done” block. --- src/SoundPlayer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SoundPlayer.js b/src/SoundPlayer.js index 0c93ce0..debf85e 100644 --- a/src/SoundPlayer.js +++ b/src/SoundPlayer.js @@ -60,7 +60,8 @@ class SoundPlayer { return; } - this.bufferSource = new Tone.BufferSource(this.buffer.get()); + this.bufferSource = Tone.context.createBufferSource(); + this.bufferSource.buffer = this.buffer.get(); this.bufferSource.playbackRate.value = this.playbackRate; this.bufferSource.connect(this.outputNode); this.bufferSource.start();