backend for EQ preset sharing(#289)
* added import/export to menu * fix error * oops * added author to eq preset for later use * Added error checking to EQ import * made eq backend pass JSON objects instead of strings
This commit is contained in:
parent
3924c2fb87
commit
184eb55455
1 changed files with 25 additions and 2 deletions
|
@ -274,14 +274,14 @@
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": app.getLz('action.import'),
|
"name": app.getLz('action.import'),
|
||||||
"action": function () {
|
"action": function () {
|
||||||
notyf.error("Not implemented yet")
|
this.importPreset()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"export": {
|
"export": {
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": app.getLz('action.export'),
|
"name": app.getLz('action.export'),
|
||||||
"action": function () {
|
"action": function () {
|
||||||
notyf.error("Not implemented yet")
|
this.exportPreset()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -398,6 +398,29 @@
|
||||||
preset.vibrantBass = app.cfg.audio.equalizer.vibrantBass
|
preset.vibrantBass = app.cfg.audio.equalizer.vibrantBass
|
||||||
notyf.success("Saved Preset")
|
notyf.success("Saved Preset")
|
||||||
},
|
},
|
||||||
|
exportPreset() {
|
||||||
|
const preset = app.cfg.audio.equalizer.presets.find(p => p.preset == app.cfg.audio.equalizer.preset)
|
||||||
|
const jsonObj = {"name": preset.name, "author": app.chrome.userinfo.attributes.name, "frequency": preset.frequencies, "gain": preset.gain, "q": preset.Q, "preamp": preset.preamp, "mix": preset.mix, "vibrantBass": preset.vibrantBass};
|
||||||
|
ipcRenderer.send("export-eq", jsonObj)
|
||||||
|
},
|
||||||
|
importPreset() {
|
||||||
|
ipcRenderer.sendSync("import-eq").then((result) => {
|
||||||
|
let newPreset = new self.eqPreset()
|
||||||
|
newPreset.name = result.name
|
||||||
|
newPreset.author = result.author
|
||||||
|
newPreset.frequencies = result.frequency
|
||||||
|
newPreset.gain = result.gain
|
||||||
|
newPreset.Q = result.q
|
||||||
|
newPreset.preamp = result.preamp
|
||||||
|
newPreset.mix = result.mix
|
||||||
|
newPreset.vibrantBass = result.vibrantBass
|
||||||
|
app.cfg.audio.equalizer.presets.push(newPreset)
|
||||||
|
notyf.success("Imported preset " + result.name)
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("[EQ Import] " + err)
|
||||||
|
notyf.error("Could not import preset")
|
||||||
|
})
|
||||||
|
},
|
||||||
applyPreset(preset) {
|
applyPreset(preset) {
|
||||||
Object.assign(this.$root.cfg.audio.equalizer, preset)
|
Object.assign(this.$root.cfg.audio.equalizer, preset)
|
||||||
this.changePreamp()
|
this.changePreamp()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue