diff --git a/src/App.vue b/src/App.vue
index 6cee83d..a46768c 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,23 +1,26 @@
+
diff --git a/src/components/AppBar.vue b/src/components/AppBar.vue
new file mode 100644
index 0000000..d6c94a6
--- /dev/null
+++ b/src/components/AppBar.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
diff --git a/src/components/Noise.vue b/src/components/Noise.vue
index 8ff528d..73ab7f5 100644
--- a/src/components/Noise.vue
+++ b/src/components/Noise.vue
@@ -37,6 +37,20 @@
Stop
+
+
+
+
@@ -54,18 +69,15 @@
-
-
-
@@ -86,13 +98,13 @@
-
+
-
+
({
startDisabled: false,
- noiseDuration: 4,
+ isTimerEnabled: false,
+ noiseDuration: 60,
timeRemaining: 0,
noiseColorOptions: ["pink", "white", "brown"],
noiseColor: "pink",
@@ -13,32 +14,39 @@ export default {
isFilterEnabled: false,
frequencyCutoff: 20000,
filterTypeOptions: ["lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "notch", "allpass", "peaking"],
- filterType: "lowpass"
+ filterType: "lowpass",
+ rules: {
+ number: value => !isNaN(parseInt(value, 10)) || 'Invalid number',
+ negative: value => (!isNaN(parseInt(value, 10)) && value <= 0) || "Can't be greater than 0"
+ }
}),
created() {
this.noise = new Noise()
+ this.filter = new Filter()
},
methods: {
playNoise() {
this.startDisabled = true
Transport.cancel()
- this.filter = new Filter(this.frequencyCutoff, this.filterType).toDestination()
-
if (this.isFilterEnabled) {
+ this.filter = new Filter(this.frequencyCutoff, this.filterType).toDestination()
this.noise = new Noise({volume: this.noiseVolume, type: this.noiseColor}).connect(this.filter)
} else {
this.noise = new Noise({volume: this.noiseVolume, type: this.noiseColor}).toDestination()
}
- this.noise.sync().start(0).stop(this.noiseDuration)
+
+ if (this.isTimerEnabled) {
+ this.noise.sync().start(0).stop(this.noiseDuration)
+ Transport.loopEnd = this.noiseDuration
+ this.timeRemaining = this.noiseDuration
+ this.transportInterval = setInterval(() => this.stopTransport(), this.noiseDuration * 1000 + 100)
+ this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
+ } else {
+ this.noise.sync().start(0)
+ }
Transport.start()
- Transport.loopEnd = this.noiseDuration
-
- this.transportInterval = setInterval(() => this.stopTransport(), this.noiseDuration * 1000 + 100)
-
- this.timeRemaining = this.noiseDuration
- this.timeRemainingInterval = setInterval(() => this.startTimer(), 1000)
},
stopTransport() {
clearInterval(this.transportInterval)
@@ -50,6 +58,12 @@ export default {
},
startTimer() {
this.timeRemaining -= 1
+ },
+ updateVolume() {
+ this.noise.volume.value = this.noiseVolume
+ },
+ updateNoiseColor() {
+ this.noise.type = this.noiseColor
}
},
}
diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js
index 5bdec19..b9da89d 100644
--- a/src/plugins/vuetify.js
+++ b/src/plugins/vuetify.js
@@ -4,4 +4,5 @@ import Vuetify from 'vuetify/lib/framework';
Vue.use(Vuetify);
export default new Vuetify({
+ theme: { dark: false },
});