Fix profile loading and noise bug

This commit is contained in:
Kevin Thomas
2021-11-08 00:30:20 -08:00
parent 12d2759a56
commit 3b1e23f2af
2 changed files with 10 additions and 5 deletions

View File

@@ -37,9 +37,10 @@ module.exports = function () {
db.run(`CREATE TABLE IF NOT EXISTS samples ( db.run(`CREATE TABLE IF NOT EXISTS samples (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
name TEXT UNIQUE, name TEXT,
user INTEGER, 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 ( db.run(`CREATE TABLE IF NOT EXISTS profiles_samples (

View File

@@ -96,7 +96,7 @@ export default {
} else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && this.isTremoloEnabled) { } else if (this.isFilterEnabled && this.isLFOFilterCutoffEnabled && this.isTremoloEnabled) {
this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start() this.tremolo = new Tremolo({ frequency: this.tremoloFrequency, depth: this.tremoloDepth }).toDestination().start()
this.filter = new Filter(this.filterCutoff, this.filterType).connect(this.tremolo) 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 = new LFO({ frequency: this.lfoFilterCutoffFrequency, min: this.lfoFilterCutoffRange[0], max: this.lfoFilterCutoffRange[1] })
this.lfo.connect(this.filter.frequency).start() this.lfo.connect(this.filter.frequency).start()
} else { } else {
@@ -207,7 +207,11 @@ export default {
this.addDefaultProfile() this.addDefaultProfile()
} else { } else {
this.profileItems = response.data.profiles 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() this.loadProfile()
} }
} }
@@ -250,7 +254,7 @@ export default {
}).then(response => { }).then(response => {
if (response.status === 200) { if (response.status === 200) {
this.profileDialog = false this.profileDialog = false
this.populateProfileItems(response.data.id - 1) this.populateProfileItems(response.data.id)
} }
}) })
.catch((error) => { .catch((error) => {