Start work for getting filter to work while noise is playing

This commit is contained in:
Kevin Thomas
2021-07-26 22:56:40 -07:00
parent fea573bf48
commit 5557536b92
3 changed files with 16 additions and 4 deletions

View File

@@ -100,7 +100,7 @@
v-model="isFilterEnabled" v-model="isFilterEnabled"
label="Enabled" label="Enabled"
class="mb-5" class="mb-5"
:disabled="startDisabled" @change="updateFilter"
/> />
</v-row> </v-row>
</v-col> </v-col>
@@ -112,7 +112,6 @@
:items="filterTypeOptions" :items="filterTypeOptions"
label="Filter Type" label="Filter Type"
class="mx-3" class="mx-3"
:disabled="!isFilterEnabled || startDisabled"
/> />
<v-slider <v-slider
@@ -120,7 +119,6 @@
label="Frequency Cutoff (Hz)" label="Frequency Cutoff (Hz)"
thumb-label="always" thumb-label="always"
:thumb-size="40" :thumb-size="40"
:disabled="!isFilterEnabled || startDisabled"
max="20000" max="20000"
min="0" min="0"
class="mx-3" class="mx-3"

View File

@@ -26,6 +26,7 @@ export default {
}, },
methods: { methods: {
playNoise () { playNoise () {
console.log('frequencyCutoff: ', this.frequencyCutoff)
this.startDisabled = true this.startDisabled = true
Transport.cancel() Transport.cancel()
@@ -55,6 +56,9 @@ export default {
clearInterval(this.timeRemainingInterval) clearInterval(this.timeRemainingInterval)
this.timeRemaining = 0 this.timeRemaining = 0
this.noise = new Noise()
this.filter = new Filter()
}, },
startTimer () { startTimer () {
this.timeRemaining -= 1 this.timeRemaining -= 1
@@ -64,6 +68,16 @@ export default {
}, },
updateNoiseColor () { updateNoiseColor () {
this.noise.type = this.noiseColor this.noise.type = this.noiseColor
},
updateFilter () {
console.log('change')
if (this.isFilterEnabled) {
this.filter = new Filter(this.frequencyCutoff, this.filterType).toDestination()
this.noise.connect(this.filter)
} else {
this.noise.disconnect(this.filter)
this.noise.toDestination()
}
} }
} }
} }

View File

@@ -41,7 +41,7 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.name === 'Home') { if (to.name === 'TMP_Home') {
instance.get('/auth') instance.get('/auth')
.then(response => { .then(response => {
if (response.status === 200) { if (response.status === 200) {