added preset import/export
This commit is contained in:
parent
05abb26625
commit
46da10803e
1 changed files with 116 additions and 115 deletions
|
@ -238,20 +238,20 @@
|
||||||
"icon": "./assets/feather/share.svg",
|
"icon": "./assets/feather/share.svg",
|
||||||
"name": app.getLz('action.import'),
|
"name": app.getLz('action.import'),
|
||||||
action: () => {
|
action: () => {
|
||||||
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: () => {
|
action: () => {
|
||||||
notyf.error("Not implemented yet")
|
this.exportPreset()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.$root.cfg.audio.equalizer.userGenerated) {
|
if (!this.$root.cfg.audio.equalizer.userGenerated) {
|
||||||
delete menu.items.delete
|
delete menu.items.delete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,8 +298,9 @@
|
||||||
try {
|
try {
|
||||||
for (var i = 0; i < 21; i++) {
|
for (var i = 0; i < 21; i++) {
|
||||||
CiderAudio.audioNodes.vibrantbassNode[i].gain.value = app.cfg.audio.maikiwiAudio.vibrantBass.gain[i] * (app.cfg.audio.equalizer.vibrantBass / 10);
|
CiderAudio.audioNodes.vibrantbassNode[i].gain.value = app.cfg.audio.maikiwiAudio.vibrantBass.gain[i] * (app.cfg.audio.equalizer.vibrantBass / 10);
|
||||||
} CiderAudio.intelliGainComp_h0_0();}
|
} CiderAudio.intelliGainComp_h0_0();
|
||||||
catch(e) {
|
}
|
||||||
|
catch (e) {
|
||||||
CiderAudio.hierarchical_loading();
|
CiderAudio.hierarchical_loading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,14 +316,16 @@
|
||||||
CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
||||||
}
|
}
|
||||||
CiderAudio.intelliGainComp_h0_0();
|
CiderAudio.intelliGainComp_h0_0();
|
||||||
} catch(e) {CiderAudio.hierarchical_loading(); }
|
} catch (e) { CiderAudio.hierarchical_loading(); }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeGain(i) {
|
changeGain(i) {
|
||||||
if (Math.max(...app.cfg.audio.equalizer.gain) != 0) {
|
if (Math.max(...app.cfg.audio.equalizer.gain) != 0) {
|
||||||
try {CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
try {
|
||||||
CiderAudio.intelliGainComp_h0_0();}
|
CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
||||||
catch(e){CiderAudio.hierarchical_loading();}
|
CiderAudio.intelliGainComp_h0_0();
|
||||||
|
}
|
||||||
|
catch (e) { CiderAudio.hierarchical_loading(); }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CiderAudio.hierarchical_loading();
|
CiderAudio.hierarchical_loading();
|
||||||
|
@ -378,33 +381,31 @@
|
||||||
notyf.success("Saved Preset")
|
notyf.success("Saved Preset")
|
||||||
},
|
},
|
||||||
exportPreset() {
|
exportPreset() {
|
||||||
const preset = app.cfg.audio.equalizer.presets.find(p => p.preset == app.cfg.audio.equalizer.preset)
|
let 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, "mix": preset.mix, "vibrantBass": preset.vibrantBass};
|
this.$root.copyToClipboard(btoa(JSON.stringify(preset)))
|
||||||
ipcRenderer.send("export-eq", jsonObj)
|
|
||||||
},
|
},
|
||||||
importPreset() {
|
importPreset() {
|
||||||
ipcRenderer.sendSync("import-eq").then((result) => {
|
let self = this
|
||||||
let newPreset = new self.eqPreset()
|
bootbox.prompt("Enter preset share code", (res) => {
|
||||||
newPreset.name = result.name
|
if (res) {
|
||||||
newPreset.author = result.author
|
let preset = JSON.parse(atob(res))
|
||||||
newPreset.frequencies = result.frequency
|
if (preset.frequencies && preset.gain && preset.Q && preset.mix && preset.vibrantBass) {
|
||||||
newPreset.gain = result.gain
|
// self.applyPreset(preset)
|
||||||
newPreset.Q = result.q
|
app.cfg.audio.equalizer.presets.push(preset)
|
||||||
newPreset.mix = result.mix
|
notyf.success(`${preset.name} has been imported.`)
|
||||||
newPreset.vibrantBass = result.vibrantBass
|
}
|
||||||
app.cfg.audio.equalizer.presets.push(newPreset)
|
else {
|
||||||
notyf.success("Imported preset " + result.name)
|
notyf.error("Invalid Preset")
|
||||||
}).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.changeVibrantBass()
|
this.changeVibrantBass()
|
||||||
for (var i = 0; i < 10; i++) {
|
for (var i = 0; i < 10; i++) {
|
||||||
try {CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix}
|
try { CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix }
|
||||||
catch(e){
|
catch (e) {
|
||||||
CiderAudio.hierarchical_loading();
|
CiderAudio.hierarchical_loading();
|
||||||
CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
CiderAudio.audioNodes.audioBands[i].gain.value = app.cfg.audio.equalizer.gain[i] * app.cfg.audio.equalizer.mix
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue