From 03d78a203b4aa74574006362cdc8806b55733322 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 10 Jan 2017 10:59:55 -0500 Subject: [PATCH] fix beatsToSec function (was getting millis) --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 2f8d4fc..d56b831 100644 --- a/src/index.js +++ b/src/index.js @@ -128,10 +128,14 @@ AudioPlayer.prototype.waitForBeats = function (beats) { return new Promise(function (resolve) { setTimeout(function () { resolve(); - }, ((60 / storedContext.audioEngine.currentTempo) * 1000 * beats)); + }, storedContext.beatsToSec(beats) * 1000); }); }; +AudioPlayer.prototype.beatsToSec = function (beats) { + return (60 / this.audioEngine.currentTempo) * beats; +}; + AudioPlayer.prototype.stopAllSounds = function () { // stop drum notes // for (var i = 0; i