diff --git a/server/boot/db.js b/server/boot/db.js index 64f8640..85281f8 100644 --- a/server/boot/db.js +++ b/server/boot/db.js @@ -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') + } } }) }) diff --git a/server/routes/profiles.js b/server/routes/profiles.js index 0107427..9f76a55 100644 --- a/server/routes/profiles.js +++ b/server/routes/profiles.js @@ -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) }) diff --git a/src/components/NoisePage.vue b/src/components/NoisePage.vue index 9eaeed4..57b1f63 100644 --- a/src/components/NoisePage.vue +++ b/src/components/NoisePage.vue @@ -652,7 +652,9 @@ - {{ sample.name }} +

+ {{ sample.name }} +

@@ -679,6 +681,84 @@

{{ loadedSamples[index].volume }}

+ + +

+ Effects +

+
+ + + + + + + +
+

{{ sample.reverbPreDelay }}

+
+
+ + + +
+

{{ sample.reverbDecay }}

+
+
+ + + +
+

{{ sample.reverbWet }}%

+
+
+ + + + diff --git a/src/components/noise.js b/src/components/noise.js index 292577a..7b6b9b2 100644 --- a/src/components/noise.js +++ b/src/components/noise.js @@ -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) {