@holzchopf/flp-file
Version:
Reads and writes FL Studio project and state files.
37 lines (34 loc) • 842 B
JavaScript
/*
https://github.com/demberto/PyFLP/blob/master/pyflp/project.py
*/
const FLPFileFormatRaw = {
Project: 0,
Score: 16,
Automation: 24,
ChannelState: 32,
PluginState: 48,
GeneratorState: 49,
EffectState: 50,
InsertState: 64,
};
/**
* Specific file formats of [[FLPFile]]s.
*/
export const FLPFileFormat = {
...FLPFileFormatRaw,
/**
* Returns the name of a given file format ID, or `'unknown'`
* @param id File format ID.
*/
name: (id) => {
const names = Object.keys(FLPFileFormatRaw);
return names.find((n) => FLPFileFormatRaw[n] === id) ?? 'unknown';
},
/**
* Returns the ID for a given file format name, or `undefined`
* @param name File format name.
*/
byName: (name) => {
return FLPFileFormatRaw[name] ?? undefined;
}
};