fractal-midi 0.1.0-alpha.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.
Files changed (123) hide show
  1. package/LICENSE +200 -0
  2. package/NOTICE +28 -0
  3. package/README.md +147 -0
  4. package/dist/am4/applicability.d.ts +61 -0
  5. package/dist/am4/applicability.d.ts.map +1 -0
  6. package/dist/am4/applicability.js +285 -0
  7. package/dist/am4/blockTypes.d.ts +43 -0
  8. package/dist/am4/blockTypes.d.ts.map +1 -0
  9. package/dist/am4/blockTypes.js +48 -0
  10. package/dist/am4/cacheEnums.d.ts +46 -0
  11. package/dist/am4/cacheEnums.d.ts.map +1 -0
  12. package/dist/am4/cacheEnums.js +734 -0
  13. package/dist/am4/cacheParams.d.ts +3533 -0
  14. package/dist/am4/cacheParams.d.ts.map +1 -0
  15. package/dist/am4/cacheParams.js +1996 -0
  16. package/dist/am4/editorControlLabels.d.ts +45 -0
  17. package/dist/am4/editorControlLabels.d.ts.map +1 -0
  18. package/dist/am4/editorControlLabels.js +15894 -0
  19. package/dist/am4/index.d.ts +28 -0
  20. package/dist/am4/index.d.ts.map +1 -0
  21. package/dist/am4/index.js +31 -0
  22. package/dist/am4/ir/preset.d.ts +24 -0
  23. package/dist/am4/ir/preset.d.ts.map +1 -0
  24. package/dist/am4/ir/preset.js +12 -0
  25. package/dist/am4/ir/transpile.d.ts +9 -0
  26. package/dist/am4/ir/transpile.d.ts.map +1 -0
  27. package/dist/am4/ir/transpile.js +19 -0
  28. package/dist/am4/locations.d.ts +32 -0
  29. package/dist/am4/locations.d.ts.map +1 -0
  30. package/dist/am4/locations.js +58 -0
  31. package/dist/am4/paramNames.d.ts +55 -0
  32. package/dist/am4/paramNames.d.ts.map +1 -0
  33. package/dist/am4/paramNames.js +863 -0
  34. package/dist/am4/paramNamesGenerated.d.ts +41 -0
  35. package/dist/am4/paramNamesGenerated.d.ts.map +1 -0
  36. package/dist/am4/paramNamesGenerated.js +183 -0
  37. package/dist/am4/parameterBridge.d.ts +46 -0
  38. package/dist/am4/parameterBridge.d.ts.map +1 -0
  39. package/dist/am4/parameterBridge.js +300 -0
  40. package/dist/am4/params.d.ts +9577 -0
  41. package/dist/am4/params.d.ts.map +1 -0
  42. package/dist/am4/params.js +4537 -0
  43. package/dist/am4/setParam.d.ts +414 -0
  44. package/dist/am4/setParam.d.ts.map +1 -0
  45. package/dist/am4/setParam.js +819 -0
  46. package/dist/am4/shared/paramHelpers.d.ts +55 -0
  47. package/dist/am4/shared/paramHelpers.d.ts.map +1 -0
  48. package/dist/am4/shared/paramHelpers.js +146 -0
  49. package/dist/am4/symbolicIds.d.ts +11 -0
  50. package/dist/am4/symbolicIds.d.ts.map +1 -0
  51. package/dist/am4/symbolicIds.js +587 -0
  52. package/dist/am4/typeApplicability.d.ts +39 -0
  53. package/dist/am4/typeApplicability.d.ts.map +1 -0
  54. package/dist/am4/typeApplicability.js +466 -0
  55. package/dist/am4/variantResolverTables.d.ts +51 -0
  56. package/dist/am4/variantResolverTables.d.ts.map +1 -0
  57. package/dist/am4/variantResolverTables.js +3128 -0
  58. package/dist/axe-fx-ii/blockTypes.d.ts +45 -0
  59. package/dist/axe-fx-ii/blockTypes.d.ts.map +1 -0
  60. package/dist/axe-fx-ii/blockTypes.js +116 -0
  61. package/dist/axe-fx-ii/index.d.ts +5 -0
  62. package/dist/axe-fx-ii/index.d.ts.map +1 -0
  63. package/dist/axe-fx-ii/index.js +18 -0
  64. package/dist/axe-fx-ii/paramAliases.d.ts +54 -0
  65. package/dist/axe-fx-ii/paramAliases.d.ts.map +1 -0
  66. package/dist/axe-fx-ii/paramAliases.js +146 -0
  67. package/dist/axe-fx-ii/params.d.ts +11502 -0
  68. package/dist/axe-fx-ii/params.d.ts.map +1 -0
  69. package/dist/axe-fx-ii/params.js +2847 -0
  70. package/dist/axe-fx-ii/setParam.d.ts +560 -0
  71. package/dist/axe-fx-ii/setParam.d.ts.map +1 -0
  72. package/dist/axe-fx-ii/setParam.js +888 -0
  73. package/dist/axe-fx-iii/blockTypes.d.ts +87 -0
  74. package/dist/axe-fx-iii/blockTypes.d.ts.map +1 -0
  75. package/dist/axe-fx-iii/blockTypes.js +156 -0
  76. package/dist/axe-fx-iii/enumOverlay.d.ts +73 -0
  77. package/dist/axe-fx-iii/enumOverlay.d.ts.map +1 -0
  78. package/dist/axe-fx-iii/enumOverlay.js +236 -0
  79. package/dist/axe-fx-iii/index.d.ts +9 -0
  80. package/dist/axe-fx-iii/index.d.ts.map +1 -0
  81. package/dist/axe-fx-iii/index.js +20 -0
  82. package/dist/axe-fx-iii/params.d.ts +179 -0
  83. package/dist/axe-fx-iii/params.d.ts.map +1 -0
  84. package/dist/axe-fx-iii/params.js +6913 -0
  85. package/dist/axe-fx-iii/setParam.d.ts +460 -0
  86. package/dist/axe-fx-iii/setParam.d.ts.map +1 -0
  87. package/dist/axe-fx-iii/setParam.js +910 -0
  88. package/dist/index.d.ts +2 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/index.js +12 -0
  91. package/dist/shared/checksum.d.ts +10 -0
  92. package/dist/shared/checksum.d.ts.map +1 -0
  93. package/dist/shared/checksum.js +14 -0
  94. package/dist/shared/device.d.ts +195 -0
  95. package/dist/shared/device.d.ts.map +1 -0
  96. package/dist/shared/device.js +27 -0
  97. package/dist/shared/index.d.ts +8 -0
  98. package/dist/shared/index.d.ts.map +1 -0
  99. package/dist/shared/index.js +11 -0
  100. package/dist/shared/lineage/amp-lineage.json +8313 -0
  101. package/dist/shared/lineage/axefx2-amp-lineage.json +5871 -0
  102. package/dist/shared/lineage/axefx2-delay-lineage.json +226 -0
  103. package/dist/shared/lineage/axefx2-drive-lineage.json +575 -0
  104. package/dist/shared/lineage/axefx2-reverb-lineage.json +467 -0
  105. package/dist/shared/lineage/cab-lineage.json +10777 -0
  106. package/dist/shared/lineage/chorus-lineage.json +173 -0
  107. package/dist/shared/lineage/compressor-lineage.json +338 -0
  108. package/dist/shared/lineage/delay-lineage.json +313 -0
  109. package/dist/shared/lineage/drive-lineage.json +1844 -0
  110. package/dist/shared/lineage/flanger-lineage.json +313 -0
  111. package/dist/shared/lineage/phaser-lineage.json +208 -0
  112. package/dist/shared/lineage/reverb-lineage.json +793 -0
  113. package/dist/shared/lineage/wah-lineage.json +117 -0
  114. package/dist/shared/lineageLookup.d.ts +69 -0
  115. package/dist/shared/lineageLookup.d.ts.map +1 -0
  116. package/dist/shared/lineageLookup.js +196 -0
  117. package/dist/shared/packValue.d.ts +40 -0
  118. package/dist/shared/packValue.d.ts.map +1 -0
  119. package/dist/shared/packValue.js +105 -0
  120. package/dist/shared/types.d.ts +23 -0
  121. package/dist/shared/types.d.ts.map +1 -0
  122. package/dist/shared/types.js +9 -0
  123. package/package.json +75 -0
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "0.1.0-alpha.0";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // fractal-midi public entry point.
2
+ //
3
+ // The shape exposed here is intentionally narrow at the root; consumers
4
+ // import from the subpath that matches their device or layer:
5
+ //
6
+ // import { packValue, fractalChecksum } from 'fractal-midi/shared';
7
+ // import { ... } from 'fractal-midi/am4';
8
+ // import { ... } from 'fractal-midi/axe-fx-ii';
9
+ //
10
+ // The root `VERSION` constant is convenience-only — useful for log
11
+ // lines and version pinning sanity checks.
12
+ export const VERSION = '0.1.0-alpha.0';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Fractal SysEx XOR checksum.
3
+ * Confirmed across all observed AM4 messages — see docs/SYSEX-MAP.md.
4
+ *
5
+ * cs = (XOR of every byte from F0 through the last data byte) & 0x7F
6
+ *
7
+ * The result is appended just before the F7 terminator.
8
+ */
9
+ export declare function fractalChecksum(bytes: readonly number[]): number;
10
+ //# sourceMappingURL=checksum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checksum.d.ts","sourceRoot":"","sources":["../../src/shared/checksum.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAIhE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Fractal SysEx XOR checksum.
3
+ * Confirmed across all observed AM4 messages — see docs/SYSEX-MAP.md.
4
+ *
5
+ * cs = (XOR of every byte from F0 through the last data byte) & 0x7F
6
+ *
7
+ * The result is appended just before the F7 terminator.
8
+ */
9
+ export function fractalChecksum(bytes) {
10
+ let acc = 0;
11
+ for (const b of bytes)
12
+ acc ^= b;
13
+ return acc & 0x7f;
14
+ }
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Fractal device abstraction.
3
+ *
4
+ * Each Fractal device family member (AM4, Axe-Fx II XL+, Axe-Fx III,
5
+ * FM3, FM9, VP4) implements `FractalDevice` to expose its protocol
6
+ * details (model byte, parameter registry, message builders) and its
7
+ * capability flags (scene count, slot count, channels per block).
8
+ *
9
+ * The MCP server holds a single `activeDevice: FractalDevice`
10
+ * reference and dispatches tool calls through it. Adding a new device
11
+ * means adding a new implementation under `src/fractal/<device-name>/`,
12
+ * not touching the server tools.
13
+ *
14
+ * Designed 2026-05-04 (Session 47, Path C of multi-device roadmap).
15
+ * v0.1.0 ships AM4 only; Axe-Fx II is the first follow-up.
16
+ */
17
+ import type { ParamId } from './types.js';
18
+ /**
19
+ * Minimal shape every device's parameter entry shares. Each device's
20
+ * own param type extends this with device-specific fields (AM4's `unit`,
21
+ * `scaling`, `pidLow`/`pidHigh`; Axe-Fx II's `paramId`, `groupCode`,
22
+ * `controlType`, etc.). The shared interface is intentionally narrow so
23
+ * tool-surface code that walks any device's registry only depends on
24
+ * these universal fields.
25
+ */
26
+ export interface BaseParam {
27
+ readonly block: string;
28
+ readonly name: string;
29
+ readonly displayMin?: number;
30
+ readonly displayMax?: number;
31
+ readonly enumValues?: Readonly<Record<number, string>>;
32
+ }
33
+ /**
34
+ * Identifies a parsed inbound SysEx message's role. Used by the
35
+ * predicate functions on `FractalDevice` so the server can wait for
36
+ * the right kind of response without knowing the protocol details.
37
+ */
38
+ export interface ReadResponse {
39
+ pidLow: number;
40
+ pidHigh: number;
41
+ /** The 32-bit unsigned int packed into the response payload. */
42
+ asUInt32LE(): number;
43
+ /** The Q15-normalized [0,1] internal float for use with `decode`. */
44
+ asInternalFloat(): number;
45
+ }
46
+ /**
47
+ * Per-device capability flags. The server uses these for tool input
48
+ * validation (`scene` ≤ `sceneCount`, etc.) and for capability-aware
49
+ * tool descriptions. Adding a new capability here requires updating
50
+ * every device's implementation — by design, so the surface stays
51
+ * honest.
52
+ */
53
+ export interface DeviceCapabilities {
54
+ /**
55
+ * Number of scenes per preset.
56
+ * - AM4 = 4 (the outlier — smallest device in the family)
57
+ * - Axe-Fx II XL+ = 8 (per the official Scenes Mini-Manual,
58
+ * Fractal Audio: `Axe-Fx-II-Scenes-Mini-Manual-1.02.pdf`)
59
+ * - Axe-Fx III, FM3, FM9, VP4 = 8 (per their respective manuals)
60
+ */
61
+ readonly sceneCount: number;
62
+ /**
63
+ * Number of effect slots in the signal chain. AM4 = 4 (linear).
64
+ * Axe-Fx II XL+ = 12. Axe-Fx III/FM9 = grid (effectively up to 16+
65
+ * slots arranged in rows × columns).
66
+ */
67
+ readonly slotCount: number;
68
+ /**
69
+ * Channels available per block. AM4 = 4 (A/B/C/D). Axe-Fx III also
70
+ * 4. Some devices may not have channels at all (`'none'`).
71
+ */
72
+ readonly channelsPerBlock: 'A-D' | 'A-H' | 'none';
73
+ /**
74
+ * Routing topology. Linear = the AM4's "blocks in series" model.
75
+ * Grid = Axe-Fx III/FM9 row × column matrix routing. v0.1.0 supports
76
+ * 'linear' only; grid devices land at v0.2 with a routing schema
77
+ * extension to apply_preset.
78
+ */
79
+ readonly routing: 'linear' | 'grid';
80
+ /**
81
+ * Total preset locations. AM4 = 104 (banks A-Z × 4). Axe-Fx II = 384.
82
+ * Axe-Fx III = 512. Used for write-safety bounds checks and for
83
+ * `formatLocationCode`.
84
+ */
85
+ readonly presetLocationCount: number;
86
+ }
87
+ /**
88
+ * Information returned by a device's `identify()` call. Populated
89
+ * from the wire response to GET_FIRMWARE_VERSION (function 0x08) at
90
+ * server startup.
91
+ */
92
+ export interface DeviceIdentity {
93
+ readonly modelByte: number;
94
+ readonly firmwareVersion: string;
95
+ readonly buildDate?: string;
96
+ }
97
+ /**
98
+ * Block-type registry: enum values like `{ amp: 0x003a, drive: 0x0076,
99
+ * ... }` mapping block-type names to their wire-level pidLow.
100
+ */
101
+ export type BlockTypeRegistry = Readonly<Record<string, number>>;
102
+ /**
103
+ * Parameter registry: every addressable parameter on the device,
104
+ * keyed by `<block>.<name>`. Each device exposes its own param shape
105
+ * (which extends `BaseParam`); generic-tool code only walks the shared
106
+ * fields. AM4's `KNOWN_PARAMS` and Axe-Fx II's `AXE_FX_II_PARAMS` both
107
+ * satisfy this.
108
+ */
109
+ export type ParamRegistry = Readonly<Record<string, BaseParam>>;
110
+ /**
111
+ * The contract every Fractal device implementation satisfies.
112
+ *
113
+ * Implementations live under `src/fractal/<device-name>/device.ts`
114
+ * and export a single instance: `export const AM4_DEVICE: FractalDevice`,
115
+ * `export const AXE_FX_II_DEVICE: FractalDevice`, etc.
116
+ *
117
+ * Methods that build wire bytes return `number[]` to match the
118
+ * existing `node-midi` send signature; methods that read return
119
+ * structured types so the server doesn't need protocol-level knowledge.
120
+ */
121
+ export interface FractalDevice {
122
+ /** Wire-level model byte (e.g. 0x15 for AM4, 0x03 for Axe-Fx II XL+). */
123
+ readonly modelByte: number;
124
+ /** Display name shown in tool descriptions and logs. */
125
+ readonly displayName: string;
126
+ /** Short slug used in URLs / file paths (e.g. "am4", "axe-fx-ii"). */
127
+ readonly slug: string;
128
+ /** Capability flags consulted by tools for validation + UX. */
129
+ readonly capabilities: DeviceCapabilities;
130
+ /**
131
+ * Optional substring used to filter MIDI ports during discovery.
132
+ * Hardware-specific; e.g. AM4's port name contains "AM4". Used by
133
+ * `connect()` when no port is explicitly requested.
134
+ */
135
+ readonly midiPortPattern?: RegExp;
136
+ readonly knownParams: ParamRegistry;
137
+ readonly blockTypes: BlockTypeRegistry;
138
+ /**
139
+ * Display-name aliases for parameters (e.g. `mix_level` → `mix`).
140
+ * Empty for devices without aliases.
141
+ */
142
+ readonly paramAliases: Readonly<Record<string, string>>;
143
+ /** Convert a 0-based location index to a human display ("A01" / "U4" / etc.). */
144
+ formatLocationCode(locationIndex: number): string;
145
+ /** Same but in Fractal's preferred display style ("U4" not "U04"). */
146
+ formatLocationDisplay(locationIndex: number): string;
147
+ /** Parse "A01" / "U4" / "Z04" → 0-based location index. Throws on invalid. */
148
+ parseLocationCode(code: string): number;
149
+ /** Resolve a block-type display name or wire value to its wire value. */
150
+ resolveBlockType(input: string | number): number | undefined;
151
+ /** Reverse-lookup: wire value → display name. */
152
+ blockNameForValue(value: number): string | undefined;
153
+ buildSetParam(key: string, displayValue: number): number[];
154
+ buildReadParam(param: ParamId, readType?: number): number[];
155
+ buildSetBlockType(slot: 1 | 2 | 3 | 4, blockTypeValue: number): number[];
156
+ buildSetBlockBypass(blockPidLow: number, bypassed: boolean): number[];
157
+ buildSwitchScene(sceneIndex: number): number[];
158
+ buildSwitchPreset(locationIndex: number): number[];
159
+ buildSetPresetName(locationIndex: number, name: string): number[];
160
+ buildSetSceneName(sceneIndex: number, name: string): number[];
161
+ buildSaveToLocation(locationIndex: number): number[];
162
+ isWriteEcho(write: number[], response: number[]): boolean;
163
+ isCommandAck(write: number[], response: number[]): boolean;
164
+ isReadResponse(read: number[], response: number[]): boolean;
165
+ parseReadResponse(bytes: number[]): ReadResponse;
166
+ /**
167
+ * Send a firmware-identify request and return parsed device info.
168
+ * Used at server startup to confirm which device is connected.
169
+ * Returns undefined if the device doesn't respond within the
170
+ * implementation's chosen timeout.
171
+ */
172
+ identify?(send: (bytes: number[]) => void, recv: () => Promise<number[]>): Promise<DeviceIdentity | undefined>;
173
+ }
174
+ /**
175
+ * Registry of all supported Fractal devices. Server walks this at
176
+ * startup, asking each registered device's `identify()` (if defined)
177
+ * to find a match against the connected hardware.
178
+ *
179
+ * Order matters for fallback: when no device responds to identify,
180
+ * the first entry is used as the default. AM4 is the v0.1.0 default
181
+ * since it's the only fully-implemented device.
182
+ */
183
+ export declare const FRACTAL_DEVICE_REGISTRY: FractalDevice[];
184
+ export declare function registerDevice(device: FractalDevice): void;
185
+ /**
186
+ * Pick a device by its model byte. Returns undefined if no registered
187
+ * device matches — caller decides whether to fall back to the default.
188
+ */
189
+ export declare function deviceByModelByte(modelByte: number): FractalDevice | undefined;
190
+ /**
191
+ * Pick a device by slug (used for explicit selection via env var or
192
+ * config flag).
193
+ */
194
+ export declare function deviceBySlug(slug: string): FractalDevice | undefined;
195
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/shared/device.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,UAAU,IAAI,MAAM,CAAC;IAC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C9D,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAGrD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC1D,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3D,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC5D,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAGjD;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CAChH;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,aAAa,EAAO,CAAC;AAE3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAE1D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE9E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Registry of all supported Fractal devices. Server walks this at
3
+ * startup, asking each registered device's `identify()` (if defined)
4
+ * to find a match against the connected hardware.
5
+ *
6
+ * Order matters for fallback: when no device responds to identify,
7
+ * the first entry is used as the default. AM4 is the v0.1.0 default
8
+ * since it's the only fully-implemented device.
9
+ */
10
+ export const FRACTAL_DEVICE_REGISTRY = [];
11
+ export function registerDevice(device) {
12
+ FRACTAL_DEVICE_REGISTRY.push(device);
13
+ }
14
+ /**
15
+ * Pick a device by its model byte. Returns undefined if no registered
16
+ * device matches — caller decides whether to fall back to the default.
17
+ */
18
+ export function deviceByModelByte(modelByte) {
19
+ return FRACTAL_DEVICE_REGISTRY.find((d) => d.modelByte === modelByte);
20
+ }
21
+ /**
22
+ * Pick a device by slug (used for explicit selection via env var or
23
+ * config flag).
24
+ */
25
+ export function deviceBySlug(slug) {
26
+ return FRACTAL_DEVICE_REGISTRY.find((d) => d.slug === slug);
27
+ }
@@ -0,0 +1,8 @@
1
+ export { fractalChecksum } from './checksum.js';
2
+ export { packValue, unpackValue, packFloat32LE, unpackFloat32LE, packValueChunked, unpackValueChunked, } from './packValue.js';
3
+ export type { ParamId } from './types.js';
4
+ export type { BaseParam, ReadResponse, DeviceCapabilities, DeviceIdentity, BlockTypeRegistry, ParamRegistry, FractalDevice, } from './device.js';
5
+ export { FRACTAL_DEVICE_REGISTRY, registerDevice, deviceByModelByte, deviceBySlug, } from './device.js';
6
+ export { LINEAGE_BLOCKS, loadLineage, scoreRecord, matchesStructured, formatLineageRecord, runLineageLookup, } from './lineageLookup.js';
7
+ export type { LineageBlock, LineageRecord, LineageLookupAsk, LineageLookupHit, LineageLookupResult, } from './lineageLookup.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EACV,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,11 @@
1
+ // Barrel for fractal-midi/shared.
2
+ //
3
+ // Vendor-shared protocol primitives that every Fractal device family
4
+ // member builds on: SysEx checksum, septet pack/unpack, packed-float
5
+ // codec, and the shared `ParamId` / `FractalDevice` type shapes.
6
+ //
7
+ // Pure code — no MIDI transport dependency. Bring your own.
8
+ export { fractalChecksum } from './checksum.js';
9
+ export { packValue, unpackValue, packFloat32LE, unpackFloat32LE, packValueChunked, unpackValueChunked, } from './packValue.js';
10
+ export { FRACTAL_DEVICE_REGISTRY, registerDevice, deviceByModelByte, deviceBySlug, } from './device.js';
11
+ export { LINEAGE_BLOCKS, loadLineage, scoreRecord, matchesStructured, formatLineageRecord, runLineageLookup, } from './lineageLookup.js';