@open-audio-stack/core
Version:
Open-source audio plugin management software
116 lines (115 loc) • 3.59 kB
JavaScript
import { architectures } from '../types/Architecture.js';
import { configDefaults } from '../helpers/config.js';
import { fileFormats } from '../types/FileFormat.js';
import { fileTypes } from '../types/FileType.js';
import { licenses } from '../types/License.js';
import { pluginFormats } from '../types/PluginFormat.js';
import { pluginTypes } from '../types/PluginType.js';
import { presetFormats } from '../types/PresetFormat.js';
import { presetTypes } from '../types/PresetType.js';
import { projectFormats } from '../types/ProjectFormat.js';
import { projectTypes } from '../types/ProjectType.js';
import { systemTypes } from '../types/SystemType.js';
import { pluginCategoryEffects, pluginCategoryInstruments, } from '../types/PluginCategory.js';
import { Base } from './Base.js';
export class Config extends Base {
config;
constructor(config) {
super();
this.config = { ...configDefaults(), ...config };
}
get(key) {
return this.config[key];
}
getAll() {
return this.config;
}
set(key, val) {
this.config[key] = val;
}
// Architectures.
architecture(type) {
return architectures.filter(architecture => type === architecture.value)[0];
}
architectures() {
return architectures;
}
// File formats and types.
fileFormat(format) {
return fileFormats.filter(fileFormat => format === fileFormat.value)[0];
}
fileFormats() {
return fileFormats;
}
fileType(type) {
return fileTypes.filter(fileType => type === fileType.value)[0];
}
fileTypes() {
return fileTypes;
}
// Licenses
license(type) {
return licenses.filter(license => type === license.value)[0];
}
licenses() {
return licenses;
}
// Plugin formats and types.
pluginCategoryEffect(effect) {
return pluginCategoryEffects.filter(pluginCategoryEffect => effect === pluginCategoryEffect.value)[0];
}
pluginCategoryEffects() {
return pluginCategoryEffects;
}
pluginCategoryInstrument(instrument) {
return pluginCategoryInstruments.filter(pluginCategoryInstrument => instrument === pluginCategoryInstrument.value)[0];
}
pluginCategoryInstruments() {
return pluginCategoryInstruments;
}
pluginFormat(format) {
return pluginFormats.filter(pluginFormat => format === pluginFormat.value)[0];
}
pluginFormats() {
return pluginFormats;
}
pluginType(type) {
return pluginTypes.filter(pluginType => type === pluginType.value)[0];
}
pluginTypes() {
return pluginTypes;
}
// Preset formats and types.
presetFormat(format) {
return presetFormats.filter(presetFormat => format === presetFormat.value)[0];
}
presetFormats() {
return presetFormats;
}
presetType(type) {
return presetTypes.filter(presetType => type === presetType.value)[0];
}
presetTypes() {
return presetTypes;
}
// Project formats and types.
projectFormat(format) {
return projectFormats.filter(projectFormat => format === projectFormat.value)[0];
}
projectFormats() {
return projectFormats;
}
projectType(type) {
return projectTypes.filter(projectType => type === projectType.value)[0];
}
projectTypes() {
return projectTypes;
}
// Systems.
system(type) {
return systemTypes.filter(system => type === system.value)[0];
}
systems() {
return systemTypes;
}
}