diff --git a/server/boot/db.js b/server/boot/db.js index eb361c2..7fe5e78 100644 --- a/server/boot/db.js +++ b/server/boot/db.js @@ -37,9 +37,10 @@ module.exports = function () { db.run(`CREATE TABLE IF NOT EXISTS samples ( id INTEGER PRIMARY KEY, - name TEXT UNIQUE, + name TEXT, user INTEGER, - FOREIGN KEY(user) REFERENCES users(id))` + FOREIGN KEY(user) REFERENCES users(id), + UNIQUE(user,name))` ) db.run(`CREATE TABLE IF NOT EXISTS profiles_samples ( diff --git a/src/components/noise.js b/src/components/noise.js index 64ea95a..c50f79b 100644 --- a/src/components/noise.js +++ b/src/components/noise.js @@ -96,7 +96,7 @@ export default { } else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && this.isTremoloEnabled) { this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start() this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo) - this.noise.connect(this.filter) + this.noise = new Noise({ volume: this.volume, type: this.noiseColor }).connect(this.filter) this.lfo = new LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] }) this.lfo.connect(this.filter.frequency).start() } else { @@ -207,7 +207,11 @@ export default { this.addDefaultProfile() } else { this.profileItems = response.data.profiles - this.selectedProfile = this.profileItems.find(p => p.id === profileId + 1) + if (profileId === 0) { + this.selectedProfile = this.profileItems[0] + } else { + this.selectedProfile = this.profileItems.find(p => p.id === profileId) + } this.loadProfile() } } @@ -250,7 +254,7 @@ export default { }).then(response => { if (response.status === 200) { this.profileDialog = false - this.populateProfileItems(response.data.id - 1) + this.populateProfileItems(response.data.id) } }) .catch((error) => {