dreckiger commit

This commit is contained in:
Simon Bruder 2018-02-21 19:33:38 +00:00
parent ccaa4d19ee
commit b9ef9b0a9b
4 changed files with 44 additions and 8 deletions

3
.gitignore vendored
View file

@ -12,3 +12,6 @@ yarn-error.log*
*.ntvs* *.ntvs*
*.njsproj *.njsproj
*.sln *.sln
# vim
*.swp

Binary file not shown.

Binary file not shown.

View file

@ -1,14 +1,25 @@
<template> <template>
<div class="main"> <div class="main">
<h1>Binaural Beats</h1> <h1>Binaural Beats {{ started ? 'started' : 'stopped' }}</h1>
<button v-on:click="start">Start</button> <button v-on:click="start">Start</button>
<button v-on:click="stop">Stop</button> <button v-on:click="stop">Stop</button>
<select v-model="waveform"> <select v-model="waveform">
<option disabled value="">Waveform</option>
<option>sine</option> <option>sine</option>
<option>square</option> <option>square</option>
<option>triangle</option> <option>triangle</option>
<option>sawtooth</option>
</select> </select>
<input v-model="leftEar.frequency.value"> <input v-model="leftEar.frequency.value">
<input v-model="rightEar.frequency.value">
<select v-model="preset">
<option disabled value="">Preset</option>
<option value="alpha">α waves</option>
<option value="beta">β waves</option>
<option value="gamma">γ waves</option>
<option value="delta">δ waves</option>
<option value="theta">θ waves</option>
</select>
</div> </div>
</template> </template>
@ -19,12 +30,24 @@ export default {
name: 'Main', name: 'Main',
data () { data () {
return { return {
started: false,
merge: null, merge: null,
leftEar: null, leftEar: null,
rightEar: null, rightEar: null,
waveform: 'sine', waveform: 'sine',
left: 440, preset: null,
right: 430 presets: {
alpha: {
waveform: 'sine',
right: 150,
left: 155
},
beta: {
waveform: 'sine',
right: 130,
left: 139
}
}
} }
}, },
created () { created () {
@ -38,22 +61,26 @@ export default {
this.leftEar.frequency.value = 440 this.leftEar.frequency.value = 440
this.rightEar.frequency.value = 430 this.rightEar.frequency.value = 430
}, },
updateWaveform: function () {
this.leftEar.type = this.waveform
this.rightEar.type = this.waveform
},
start: function () { start: function () {
this.leftEar.start() this.leftEar.start()
this.rightEar.start() this.rightEar.start()
this.started = true
}, },
stop: function () { stop: function () {
this.leftEar.stop() this.leftEar.stop()
this.rightEar.stop() this.rightEar.stop()
this.started = false
} }
}, },
watch: { watch: {
waveform: function () { waveform: function () {
this.updateWaveform() this.leftEar.type = this.waveform
this.rightEar.type = this.waveform
},
preset: function () {
this.waveform = this.presets[this.preset].waveform
this.leftEar.frequency.value = this.presets[this.preset].left
this.rightEar.frequency.value = this.presets[this.preset].right
} }
} }
} }
@ -61,4 +88,10 @@ export default {
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> <style scoped>
button, select, input {
color: black;
background-color: white;
border-width: 1px;
border-style: solid;
}
</style> </style>