From 89e0282ece3db0d31c81bb30794d559889fb7dee Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 27 Apr 2017 14:03:38 -0400 Subject: startAudioContext --- client/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'client/index.js') diff --git a/client/index.js b/client/index.js index 35faf17..85ca15f 100644 --- a/client/index.js +++ b/client/index.js @@ -4,12 +4,13 @@ import keys from './lib/keys' import color from './lib/color' import kalimba from './lib/kalimba' import scales from './lib/scales' -import { mod } from './lib/util' +import { mod, browser, requestAudioContext } from './lib/util' const nx = window.nx -const noteCount = 24 +const noteCount = browser.isMobile ? 18 : 24 const stepCount = 16 +const cellSize = browser.isMobile ? 22 : 27 let grid @@ -24,7 +25,9 @@ var loop = new Tone.Sequence(function(time, col){ } }, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "16n") -nx.onload = () => { +nx.onload = () => requestAudioContext(ready) + +function ready () { grid = nx.widgets.grid grid.sequenceMode = true grid.bpm = 1 @@ -32,7 +35,7 @@ nx.onload = () => { grid.row = noteCount grid.init() - grid.resize(480, 640) + grid.resize(cellSize * stepCount, cellSize * noteCount) grid.draw() nx.widgets.scale.choices = scales.names() -- cgit v1.2.3-70-g09d2