@openmixer/omx-contract 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/data/kernels/chorus.json +22 -0
- package/data/kernels/deesser.json +8 -0
- package/data/kernels/drive.json +20 -0
- package/data/kernels/eq.json +160 -4
- package/data/kernels/fbs.json +148 -0
- package/data/kernels/flanger.json +22 -0
- package/data/kernels/gate.json +8 -0
- package/data/kernels/hrp.json +62 -0
- package/data/kernels/mixmatrix.json +9 -0
- package/data/kernels/phaser.json +6 -0
- package/data/kernels/reverb.json +17 -0
- package/data/kernels/rotary.json +9 -0
- package/data/kernels/rta.json +15 -0
- package/data/kernels/tremolo.json +9 -0
- package/data/primitives.json +51 -0
- package/data/rates.json +29 -0
- package/dist/ts/omx-contract.d.ts +416 -0
- package/dist/ts/omx-contract.js +682 -0
- package/include/omxcontract/omx_contract_limits.h +198 -0
- package/lib/data.mjs +11 -1
- package/lib/eq-defaults.mjs +87 -0
- package/lib/fmt.mjs +2 -2
- package/lib/semver.mjs +12 -2
- package/lib/validate.mjs +60 -1
- package/package.json +1 -1
- package/render/c.mjs +76 -10
- package/render/doors.mjs +6 -3
- package/render/ts.mjs +40 -2
- package/schema/omx-contract.schema.json +39 -3
- package/share/omx-contract/omx-contract.json +590 -4
- package/render/c/omx_plugin_param.h +0 -25
- package/render/c/params-generate.mjs +0 -83
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
* Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
-
*
|
|
4
|
-
* omx_plugin_param.h — the SHAPE of one generated plugin parameter, and nothing else: no number
|
|
5
|
-
* lives here. The rows are rendered by `omx-contract render --target c` into omx_<plugin>_params.h
|
|
6
|
-
* beside this file, from FreeMixer/omx-contract's data/plugins/ (omx-contract spec §4.2); a DPF
|
|
7
|
-
* plugin's initParameter reads them and types no range of its own.
|
|
8
|
-
*/
|
|
9
|
-
#ifndef OMX_PLUGIN_PARAM_H
|
|
10
|
-
#define OMX_PLUGIN_PARAM_H
|
|
11
|
-
|
|
12
|
-
/** A whole-number travel (declared `step` >= 1 over integer bounds). */
|
|
13
|
-
#define OMX_PLUGIN_PARAM_INTEGER 1u
|
|
14
|
-
/** A declared boolean: domain {0, 1}, the come-up value declared. */
|
|
15
|
-
#define OMX_PLUGIN_PARAM_TOGGLE 2u
|
|
16
|
-
|
|
17
|
-
typedef struct {
|
|
18
|
-
const char *symbol; /* the declared field name — the LV2 symbol, the CLAP param's identity */
|
|
19
|
-
const char *name; /* derived from the symbol, never a label table */
|
|
20
|
-
const char *unit;
|
|
21
|
-
float min, max, def;
|
|
22
|
-
unsigned flags;
|
|
23
|
-
} omx_plugin_param;
|
|
24
|
-
|
|
25
|
-
#endif /* OMX_PLUGIN_PARAM_H */
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
3
|
-
/**
|
|
4
|
-
* The parameter-table half of the C renderer: `generate` and its helpers, moved from openmixer's
|
|
5
|
-
* packages/omx-plugins/tools/params-gen.mjs (omx-contract spec §3.4). Two changes only: the plugin
|
|
6
|
-
* (header, prefix, source) is handed in instead of looked up in params-gen's PLUGINS, which is data
|
|
7
|
-
* now (data/plugins/), and the banner's "Produced by" lines are a parameter whose default is
|
|
8
|
-
* params-gen's own text, so the frozen openmixer sheet still renders byte for byte.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** params-gen.mjs's banner lines, for a render of openmixer's own selection (test/fixtures/). */
|
|
12
|
-
export const PARAMS_GEN_PRODUCED_BY = (source) => ` * Produced by packages/omx-plugins/tools/params-gen.mjs from @freemixer/core:
|
|
13
|
-
* ${source}.
|
|
14
|
-
* Regenerate: \`node packages/omx-plugins/tools/params-gen.mjs\`, then commit the result
|
|
15
|
-
* (docs/design/specs/2026-09-25-omx-plugins-dpf.md §3c). Order is append-only (§3b).`;
|
|
16
|
-
|
|
17
|
-
/** The flag bits `include/omx_plugin_param.h` (PLUGIN_INCLUDE_DIR) declares. */
|
|
18
|
-
const FLAG_INTEGER = 'OMX_PLUGIN_PARAM_INTEGER';
|
|
19
|
-
const FLAG_TOGGLE = 'OMX_PLUGIN_PARAM_TOGGLE';
|
|
20
|
-
|
|
21
|
-
/** `timeMs` (unit ms) -> "Time"; `feedback` -> "Feedback". Derived, never a label table. */
|
|
22
|
-
export function labelOf(symbol, unit) {
|
|
23
|
-
const words = symbol.replace(/([a-z0-9])([A-Z])/g, '$1 $2').split(' ');
|
|
24
|
-
if (words.length > 1 && unit && words[words.length - 1].toLowerCase() === unit.toLowerCase()) words.pop();
|
|
25
|
-
const s = words.join(' ');
|
|
26
|
-
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** `timeMs` -> `TIME_MS`. */
|
|
30
|
-
export function constName(symbol) {
|
|
31
|
-
return symbol.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function floatLiteral(n) {
|
|
35
|
-
if (!Number.isFinite(n)) throw new Error(`params-gen: non-finite bound ${n}`);
|
|
36
|
-
return `${Number.isInteger(n) ? `${n}.0` : `${n}`}f`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function cString(s) {
|
|
40
|
-
return JSON.stringify(s);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** The header text for one kernel's resolved parameter list. Pure: no clock, no path, no host. */
|
|
44
|
-
export function generate(plugin, params) {
|
|
45
|
-
const { header, prefix, source } = plugin;
|
|
46
|
-
const producedBy = plugin.producedBy ?? PARAMS_GEN_PRODUCED_BY(source);
|
|
47
|
-
const guard = header.replace(/\W/g, '_').toUpperCase();
|
|
48
|
-
const enumLines = params.map((p, i) => ` ${prefix}_PARAM_${constName(p.symbol)} = ${i},`);
|
|
49
|
-
const rows = params.map((p) => {
|
|
50
|
-
const flags = [];
|
|
51
|
-
if (p.toggle) flags.push(FLAG_TOGGLE);
|
|
52
|
-
else if (p.step >= 1 && Number.isInteger(p.step) && Number.isInteger(p.min) && Number.isInteger(p.max)) flags.push(FLAG_INTEGER);
|
|
53
|
-
return ` { ${cString(p.symbol)}, ${cString(labelOf(p.symbol, p.unit))}, ${cString(p.unit)}, ${floatLiteral(p.min)}, ${floatLiteral(p.max)}, ${floatLiteral(p.def)}, ${flags.length ? flags.join(' | ') : '0u'} },`;
|
|
54
|
-
});
|
|
55
|
-
const macros = params.flatMap((p) => {
|
|
56
|
-
const n = `${prefix}_PARAM_${constName(p.symbol)}`;
|
|
57
|
-
return [`#define ${n}_MIN ${floatLiteral(p.min)}`, `#define ${n}_MAX ${floatLiteral(p.max)}`, `#define ${n}_DEFAULT ${floatLiteral(p.def)}`];
|
|
58
|
-
});
|
|
59
|
-
return `// SPDX-License-Identifier: GPL-3.0-or-later
|
|
60
|
-
// Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
|
|
61
|
-
#ifndef ${guard}
|
|
62
|
-
#define ${guard}
|
|
63
|
-
/*
|
|
64
|
-
* GENERATED — DO NOT EDIT BY HAND.
|
|
65
|
-
${producedBy}
|
|
66
|
-
*/
|
|
67
|
-
#include "omx_plugin_param.h"
|
|
68
|
-
|
|
69
|
-
enum {
|
|
70
|
-
${enumLines.join('\n')}
|
|
71
|
-
${prefix}_PARAM_COUNT = ${params.length}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
static const omx_plugin_param ${prefix}_PARAMS[${prefix}_PARAM_COUNT] = {
|
|
75
|
-
${rows.join('\n')}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/* One macro per declared bound: what a C face reads where a constant is needed. */
|
|
79
|
-
${macros.join('\n')}
|
|
80
|
-
|
|
81
|
-
#endif /* ${guard} */
|
|
82
|
-
`;
|
|
83
|
-
}
|