-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Made all played notes react to ui changes * Added an actual keyboard and mobile compatibility * fix deployed code * messed it up again * why * better start and ui * made fully editable envelopes * bugfixing and real const nodes * added export and prepared import * Imported nodes, modulations missing * import export DONE!!!!
- Loading branch information
1 parent
65d364c
commit 7970a51
Showing
7 changed files
with
312 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const VERSION = 1; | ||
const MAGIC = "PLO"; | ||
|
||
function export_all() { | ||
const data = new Blob( | ||
[MAGIC, String(VERSION), '\n', JSON.stringify({fx: fx.serialize(), mod: serializeModulations()})], | ||
{ | ||
type: "application/octet-stream", | ||
} | ||
); | ||
const a = document.createElement('a'); | ||
a.download = 'plox.afx'; | ||
a.href = window.URL.createObjectURL(data); | ||
a.dataset.downloadurl = [data.type, a.download, a.href].join(':'); | ||
a.click(); | ||
} | ||
|
||
async function import_all() { | ||
const pickerOpts = { | ||
types: [ | ||
{ | ||
description: "Audio fx exported file", | ||
accept: { | ||
"application/octet-stream": [".afx"], | ||
}, | ||
}, | ||
], | ||
excludeAcceptAllOption: true, | ||
multiple: false | ||
}; | ||
|
||
const contents = await window.showOpenFilePicker(pickerOpts).then((handle) => { | ||
return handle[0].getFile().then((file) => file.text()); | ||
}); | ||
|
||
if(!contents.startsWith(MAGIC)) { | ||
return false; | ||
} | ||
|
||
closeFx(); | ||
|
||
const lines = contents.split("\n"); | ||
const header = lines[0]; | ||
const data = JSON.parse(lines[1]); | ||
|
||
switch(header.substring(3)) { | ||
case '1': | ||
const nodes = fx.deserialize(data.fx); | ||
deserializeModulations(nodes, data.mod); | ||
break; | ||
case '2': | ||
default: | ||
return false; | ||
} | ||
return true; | ||
} |
Oops, something went wrong.