diff options
| author | Jules Laplace <jules@okfoc.us> | 2017-04-27 14:03:38 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2017-04-27 14:03:38 -0400 |
| commit | 89e0282ece3db0d31c81bb30794d559889fb7dee (patch) | |
| tree | a37ed2b07c14bf154f3af9403b591680dcddd134 /client/index.js | |
| parent | 370e7a69816bfc604386e4fd21acb465e48bdb0b (diff) | |
startAudioContext
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 11 |
1 files changed, 7 insertions, 4 deletions
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() |
