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

View File

@@ -26,6 +26,7 @@ export default {
},
methods: {
playNoise () {
console.log('frequencyCutoff: ', this.frequencyCutoff)
this.startDisabled = true
Transport.cancel()
@@ -55,6 +56,9 @@ export default {
clearInterval(this.timeRemainingInterval)
this.timeRemaining = 0
this.noise = new Noise()
this.filter = new Filter()
},
startTimer () {
this.timeRemaining -= 1
@@ -64,6 +68,16 @@ export default {
},
updateNoiseColor () {
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) => {
if (to.name === 'Home') {
if (to.name === 'TMP_Home') {
instance.get('/auth')
.then(response => {
if (response.status === 200) {