mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-15 04:38:00 +00:00
Implement reverb
This commit is contained in:
@@ -73,6 +73,15 @@ module.exports = function () {
|
||||
|
||||
db.run('PRAGMA user_version = 2')
|
||||
}
|
||||
|
||||
if (userVersion < 3) {
|
||||
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_enabled INTEGER DEFAULT 0')
|
||||
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_pre_delay REAL DEFAULT 0')
|
||||
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_decay REAL DEFAULT 0')
|
||||
db.run('ALTER TABLE profiles_samples ADD COLUMN reverb_wet INTEGER DEFAULT 0')
|
||||
|
||||
db.run('PRAGMA user_version = 3')
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -59,10 +59,22 @@ router.post('/profiles', (req, res) => {
|
||||
profileID = this.lastID
|
||||
|
||||
req.body.samples.forEach(s => {
|
||||
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
|
||||
db.run(`INSERT INTO profiles_samples(
|
||||
profile,
|
||||
sample,
|
||||
volume,
|
||||
reverb_enabled,
|
||||
reverb_pre_delay,
|
||||
reverb_decay,
|
||||
reverb_wet)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
||||
profileID,
|
||||
s.id,
|
||||
s.volume
|
||||
s.volume,
|
||||
s.reverbEnabled,
|
||||
s.reverbPreDelay,
|
||||
s.reverbDecay,
|
||||
s.reverbWet
|
||||
],
|
||||
(err) => {
|
||||
if (err) {
|
||||
@@ -204,10 +216,22 @@ router.put('/profiles/:profileId', (req, res) => {
|
||||
})
|
||||
|
||||
req.body.samples.forEach(s => {
|
||||
db.run('INSERT INTO profiles_samples (profile, sample, volume) VALUES (?, ?, ?)', [
|
||||
db.run(`INSERT INTO profiles_samples(
|
||||
profile,
|
||||
sample,
|
||||
volume,
|
||||
reverb_enabled,
|
||||
reverb_pre_delay,
|
||||
reverb_decay,
|
||||
reverb_wet)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)`, [
|
||||
req.params.profileId,
|
||||
s.id,
|
||||
s.volume
|
||||
s.volume,
|
||||
s.reverbEnabled,
|
||||
s.reverbPreDelay,
|
||||
s.reverbDecay,
|
||||
s.reverbWet
|
||||
],
|
||||
(err) => {
|
||||
if (err) {
|
||||
@@ -355,6 +379,10 @@ router.get('/profiles/:profileId', (req, res) => {
|
||||
samples.id,
|
||||
name,
|
||||
profiles_samples.volume,
|
||||
profiles_samples.reverb_enabled as reverbEnabled,
|
||||
profiles_samples.reverb_pre_delay as reverbPreDelay,
|
||||
profiles_samples.reverb_decay as reverbDecay,
|
||||
profiles_samples.reverb_wet as reverbWet,
|
||||
fade_in as fadeIn,
|
||||
loop_points_enabled as loopPointsEnabled,
|
||||
loop_start as loopStart,
|
||||
@@ -382,6 +410,10 @@ router.get('/profiles/:profileId', (req, res) => {
|
||||
sample.loopPointsEnabled = row.loopPointsEnabled === 1
|
||||
sample.loopStart = row.loopStart
|
||||
sample.loopEnd = row.loopEnd
|
||||
sample.reverbEnabled = row.reverbEnabled === 1
|
||||
sample.reverbPreDelay = row.reverbPreDelay
|
||||
sample.reverbDecay = row.reverbDecay
|
||||
sample.reverbWet = row.reverbWet
|
||||
|
||||
samples.push(sample)
|
||||
})
|
||||
|
||||
@@ -652,7 +652,9 @@
|
||||
<v-row
|
||||
justify="center"
|
||||
>
|
||||
<h2 class="headline font-weight-bold mb-5">
|
||||
{{ sample.name }}
|
||||
</h2>
|
||||
</v-row>
|
||||
|
||||
<v-row>
|
||||
@@ -679,6 +681,84 @@
|
||||
<p>{{ loadedSamples[index].volume }}</p>
|
||||
</div>
|
||||
</v-row>
|
||||
|
||||
<v-row
|
||||
justify="center"
|
||||
>
|
||||
<h2 class="headline mb-5">
|
||||
Effects
|
||||
</h2>
|
||||
</v-row>
|
||||
|
||||
<v-row justify="center">
|
||||
<v-checkbox
|
||||
v-model="sample.reverbEnabled"
|
||||
label="Reverb"
|
||||
/>
|
||||
</v-row>
|
||||
|
||||
<v-row justify="center">
|
||||
<v-slider
|
||||
v-model="sample.reverbPreDelay"
|
||||
:disabled="!sample.reverbEnabled"
|
||||
label="Pre Delay"
|
||||
thumb-label
|
||||
max="16"
|
||||
min="0"
|
||||
step="0.5"
|
||||
class="mx-3"
|
||||
@input="updateReverbPreDelay(sample.id, index)"
|
||||
/>
|
||||
<div
|
||||
class="mx-3"
|
||||
>
|
||||
<p>{{ sample.reverbPreDelay }}</p>
|
||||
</div>
|
||||
</v-row>
|
||||
|
||||
<v-row justify="center">
|
||||
<v-slider
|
||||
v-model="sample.reverbDecay"
|
||||
:disabled="!sample.reverbEnabled"
|
||||
label="Decay"
|
||||
thumb-label
|
||||
max="16"
|
||||
min="0"
|
||||
step="0.5"
|
||||
class="mx-3"
|
||||
@input="updateVolume"
|
||||
/>
|
||||
<div
|
||||
class="mx-3"
|
||||
>
|
||||
<p> {{ sample.reverbDecay }}</p>
|
||||
</div>
|
||||
</v-row>
|
||||
|
||||
<v-row justify="center">
|
||||
<v-slider
|
||||
v-model="sample.reverbWet"
|
||||
:disabled="!sample.reverbEnabled"
|
||||
label="Wet"
|
||||
thumb-label
|
||||
max="1"
|
||||
min="0"
|
||||
step="0.01"
|
||||
class="mx-3"
|
||||
@input="updateVolume"
|
||||
/>
|
||||
<div
|
||||
class="mx-3"
|
||||
>
|
||||
<p>{{ sample.reverbWet }}%</p>
|
||||
</div>
|
||||
</v-row>
|
||||
|
||||
<v-row>
|
||||
<v-divider
|
||||
class="mb-7"
|
||||
/>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-row>
|
||||
|
||||
|
||||
@@ -185,6 +185,12 @@ export default {
|
||||
this.players.player(s.id).setLoopPoints(s.loopStart, s.loopEnd)
|
||||
}
|
||||
this.players.player(s.id).volume.value = s.volume
|
||||
|
||||
if (s.reverbEnabled) {
|
||||
const reverb = new Tone.Reverb(s.reverbDecay).toDestination()
|
||||
reverb.set({ preDelay: s.reverbPreDelay, wet: s.reverbWet })
|
||||
this.players.player(s.id).connect(reverb)
|
||||
}
|
||||
})
|
||||
|
||||
if (this.isTimerEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user