summaryrefslogtreecommitdiff
path: root/client/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/index.js')
-rw-r--r--client/index.js11
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()