diff --git a/src/main/mainWindow.js b/src/main/mainWindow.js index 49120e39..625b9714 100644 --- a/src/main/mainWindow.js +++ b/src/main/mainWindow.js @@ -47,6 +47,8 @@ export const createMainWindow = () => { if (!isDevelopment) { setTimeout(() => { mainWindow.setFullScreen(true) + event.newGuest.setAutoHideMenuBar(true) + event.newGuest.setMenuBarVisibility(false) event.newGuest.setFullScreen(true) }, 500) } diff --git a/src/store/clock/sagas.js b/src/store/clock/sagas.js index 2bb6b54e..4a2745e9 100644 --- a/src/store/clock/sagas.js +++ b/src/store/clock/sagas.js @@ -1,13 +1,11 @@ import 'babel-polyfill' - +import now from 'performance-now' import { takeEvery, put, call } from 'redux-saga/effects' -import * as a from './actions' import { inputFired } from '../inputs/actions' -import now from 'performance-now' +import * as a from './actions' const ppqn = 24 -let deltaInc = Math.PI / ppqn -let pulses, delta, beats, lastBar +let pulses, delta, beats, lastBar, totalBeats let seqStepCount = 0 // Sequencer step count const ppSeqStep = ppqn / 8 // Pulses per 8th beat const seqStepPerBar = ppSeqStep * 8 * 4 @@ -16,14 +14,13 @@ export const clockReset = () => { pulses = 0 delta = 0 beats = 0 + totalBeats = 0 lastBar = now() } export const newPulse = () => { pulses++ - delta += deltaInc seqStepCount++ - if (seqStepCount > seqStepPerBar - 1) { seqStepCount = 0 } @@ -31,11 +28,18 @@ export const newPulse = () => { if (pulses > 23) { pulses = 0 beats++ + totalBeats++ if (beats > 3) { beats = 0 } } - return { pulses, beats, delta, seqStepCount } + delta = pulses / ppqn + totalBeats + return { + pulses, + beats, + delta, + seqStepCount + } } export const calcBpm = () => { @@ -47,7 +51,9 @@ export const calcBpm = () => { export function* clockUpdate () { const info = yield call(newPulse) - yield put(inputFired('lfo', info.delta, { type: 'lfo' })) + yield put(inputFired('lfo', info.delta, { + type: 'lfo' + })) if (info.seqStepCount % ppSeqStep === 0) { yield put(inputFired('seq-step', info.seqStepCount / ppSeqStep)) diff --git a/src/utils/lfoProcess/index.js b/src/utils/lfoProcess/index.js index 35ff0f35..598a5625 100644 --- a/src/utils/lfoProcess/index.js +++ b/src/utils/lfoProcess/index.js @@ -4,21 +4,21 @@ export default (delta, shape, rate) => { switch (shape) { case 'sine': - y = Math.sin(x) + y = Math.cos(x * 6.28318530718) * 0.5 + 0.5 break case 'sawtooth': - y = (x - Math.floor(x + 0.5)) * 2 + y = x % 1 break case 'rSawtooth': - y = -(x - Math.floor(x + 0.5)) * 2 + y = 1 - (x % 1) break case 'square': - y = Math.sign(Math.sin(x)) + y = Math.floor((x % 1) * 2) break case 'triangle': - y = Math.abs((x - Math.floor(x + 0.5)) * 2) + y = Math.abs((x % 1) * 2 - 1) break } - return (y + 1) / 2 // convert from -1 ~ 1 to 0 ~ 1 + return y }