@potatosalad775/eqcaps-device-bridge 0.5.1 → 0.6.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 +97 -59
- package/dist/analysis.d.ts +23 -1
- package/dist/analysis.d.ts.map +1 -1
- package/dist/analysis.js +12 -0
- package/dist/analysis.js.map +1 -1
- package/dist/device.d.ts +50 -21
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +229 -197
- package/dist/device.js.map +1 -1
- package/dist/handler.d.ts +35 -26
- package/dist/handler.d.ts.map +1 -1
- package/dist/handler.js.map +1 -1
- package/dist/handlers/airoha.d.ts +5 -4
- package/dist/handlers/airoha.d.ts.map +1 -1
- package/dist/handlers/airoha.js +5 -11
- package/dist/handlers/airoha.js.map +1 -1
- package/dist/handlers/conexant-usb-hid.d.ts.map +1 -1
- package/dist/handlers/conexant-usb-hid.js +2 -5
- package/dist/handlers/conexant-usb-hid.js.map +1 -1
- package/dist/handlers/edifier-serial.d.ts.map +1 -1
- package/dist/handlers/edifier-serial.js +2 -5
- package/dist/handlers/edifier-serial.js.map +1 -1
- package/dist/handlers/fiio-f110.d.ts.map +1 -1
- package/dist/handlers/fiio-f110.js +2 -5
- package/dist/handlers/fiio-f110.js.map +1 -1
- package/dist/handlers/fiio-usb-hid.d.ts.map +1 -1
- package/dist/handlers/fiio-usb-hid.js +1 -4
- package/dist/handlers/fiio-usb-hid.js.map +1 -1
- package/dist/handlers/fiio-usb-serial.d.ts.map +1 -1
- package/dist/handlers/fiio-usb-serial.js +1 -4
- package/dist/handlers/fiio-usb-serial.js.map +1 -1
- package/dist/handlers/fosi-audio-usb-hid.d.ts.map +1 -1
- package/dist/handlers/fosi-audio-usb-hid.js +2 -5
- package/dist/handlers/fosi-audio-usb-hid.js.map +1 -1
- package/dist/handlers/index.d.ts +3 -3
- package/dist/handlers/jds-labs-usb-serial.d.ts.map +1 -1
- package/dist/handlers/jds-labs-usb-serial.js +2 -5
- package/dist/handlers/jds-labs-usb-serial.js.map +1 -1
- package/dist/handlers/ktmicro-usb-hid.d.ts.map +1 -1
- package/dist/handlers/ktmicro-usb-hid.js +4 -11
- package/dist/handlers/ktmicro-usb-hid.js.map +1 -1
- package/dist/handlers/moondrop-edge-serial.d.ts.map +1 -1
- package/dist/handlers/moondrop-edge-serial.js +2 -5
- package/dist/handlers/moondrop-edge-serial.js.map +1 -1
- package/dist/handlers/moondrop-old-fashioned-hid.d.ts.map +1 -1
- package/dist/handlers/moondrop-old-fashioned-hid.js +2 -5
- package/dist/handlers/moondrop-old-fashioned-hid.js.map +1 -1
- package/dist/handlers/moondrop-usb-hid.d.ts.map +1 -1
- package/dist/handlers/moondrop-usb-hid.js +2 -5
- package/dist/handlers/moondrop-usb-hid.js.map +1 -1
- package/dist/handlers/nothing-usb-serial.d.ts +5 -2
- package/dist/handlers/nothing-usb-serial.d.ts.map +1 -1
- package/dist/handlers/nothing-usb-serial.js +1 -4
- package/dist/handlers/nothing-usb-serial.js.map +1 -1
- package/dist/handlers/qudelix-usb-hid.d.ts +8 -4
- package/dist/handlers/qudelix-usb-hid.d.ts.map +1 -1
- package/dist/handlers/qudelix-usb-hid.js +109 -16
- package/dist/handlers/qudelix-usb-hid.js.map +1 -1
- package/dist/handlers/qudelix-v2-usb-hid.d.ts +8 -4
- package/dist/handlers/qudelix-v2-usb-hid.d.ts.map +1 -1
- package/dist/handlers/qudelix-v2-usb-hid.js +95 -10
- package/dist/handlers/qudelix-v2-usb-hid.js.map +1 -1
- package/dist/handlers/qudelix.d.ts +5 -3
- package/dist/handlers/qudelix.d.ts.map +1 -1
- package/dist/handlers/qudelix.js +9 -4
- package/dist/handlers/qudelix.js.map +1 -1
- package/dist/handlers/tanchjim-rita-serial.d.ts.map +1 -1
- package/dist/handlers/tanchjim-rita-serial.js +2 -5
- package/dist/handlers/tanchjim-rita-serial.js.map +1 -1
- package/dist/handlers/topping-usb-hid.d.ts.map +1 -1
- package/dist/handlers/topping-usb-hid.js +4 -13
- package/dist/handlers/topping-usb-hid.js.map +1 -1
- package/dist/handlers/walkplay-hid.d.ts.map +1 -1
- package/dist/handlers/walkplay-hid.js +1 -4
- package/dist/handlers/walkplay-hid.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +5 -6
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +6 -4
- package/dist/io.js.map +1 -1
- package/dist/protocols.d.ts +38 -1
- package/dist/protocols.d.ts.map +1 -1
- package/dist/protocols.js +49 -34
- package/dist/protocols.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @potatosalad775/eqcaps-device-bridge
|
|
2
2
|
|
|
3
3
|
Reads and writes parametric EQ on audio hardware: FiiO, Walkplay-chipset dongles, Moondrop,
|
|
4
|
-
KT Micro, Fosi Audio, Qudelix, Topping, JDS Labs, Nothing, Tanchjim, Edifier, Audeze and others,
|
|
5
|
-
hardware device in the [eqcaps](https://github.com/potatosalad775/eqcaps) database. Protocols
|
|
6
|
-
ported from [devicePEQ](https://github.com/jeromeof/devicePEQ), and changed to do what each
|
|
7
|
-
|
|
4
|
+
KT Micro, Fosi Audio, Qudelix, Topping, JDS Labs, Nothing, Tanchjim, Edifier, Audeze and others,
|
|
5
|
+
every hardware device in the [eqcaps](https://github.com/potatosalad775/eqcaps) database. Protocols
|
|
6
|
+
ported from [devicePEQ](https://github.com/jeromeof/devicePEQ), and changed to do what each vendor's
|
|
7
|
+
own app does where one is known.
|
|
8
8
|
|
|
9
9
|
- **No platform types.** Handlers talk to two small transport interfaces (`HidTransport`,
|
|
10
10
|
`StreamTransport`). Browser transports for WebHID, Web Serial and Web Bluetooth are in
|
|
@@ -12,24 +12,21 @@ vendor's own app does where one is known.
|
|
|
12
12
|
implements the interfaces over its own USB stack.
|
|
13
13
|
- **Driven by the database.** The bridge knows how to talk to a device, not what it accepts or
|
|
14
14
|
which device it is. The client matches a connected device to its eqcaps profile; the profile
|
|
15
|
-
says what the device accepts (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
says what the device accepts (`plan` with `@potatosalad775/eqcaps-core` before writing) and, in
|
|
16
|
+
its `protocol`, which handler drives it with which settings. `protocolFor({ chosen, matches,
|
|
17
|
+
usbVendorId })` gives the protocol in the order every app takes: the chosen profile's own, else
|
|
18
|
+
that of the most specific match that has one this bridge can drive, else a guess from a HID
|
|
19
|
+
device's USB vendor, and says which it was (`source`). `protocolForMatches(matches)` and
|
|
20
|
+
`protocolOf(profile)` are its first two steps on their own. A device added to the database on a
|
|
21
|
+
protocol the bridge already speaks needs no new bridge release.
|
|
20
22
|
- **Writes exactly what it is given.** No clamping, padding, type conversion or compensation. A
|
|
21
23
|
value the wire can't carry or a type the protocol has no code for is a `BridgeError`, before
|
|
22
24
|
anything is sent.
|
|
23
25
|
|
|
24
26
|
```ts
|
|
25
27
|
import { createClient } from '@potatosalad775/eqcaps-client';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
guessProtocol,
|
|
29
|
-
identityOf,
|
|
30
|
-
openDevice,
|
|
31
|
-
protocolForMatches
|
|
32
|
-
} from '@potatosalad775/eqcaps-device-bridge';
|
|
28
|
+
import { plan } from '@potatosalad775/eqcaps-core';
|
|
29
|
+
import { identityOf, openDevice, protocolFor } from '@potatosalad775/eqcaps-device-bridge';
|
|
33
30
|
import { requestHidDevice } from '@potatosalad775/eqcaps-device-bridge/browser';
|
|
34
31
|
|
|
35
32
|
const client = createClient();
|
|
@@ -39,21 +36,29 @@ const transport = await requestHidDevice({ entries: index?.profiles ?? [] });
|
|
|
39
36
|
if (transport) {
|
|
40
37
|
const { best, matches } = await client.matchDevice(identityOf(transport));
|
|
41
38
|
const profile = best ? await client.loadProfile(best.id) : null;
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
// The profile's protocol, a matched profile's, or a guess from the vendor (experimental).
|
|
40
|
+
const protocol = protocolFor({
|
|
41
|
+
chosen: best?.entry,
|
|
42
|
+
matches,
|
|
43
|
+
usbVendorId: transport.vendorId
|
|
44
|
+
})?.protocol;
|
|
44
45
|
if (protocol) {
|
|
45
46
|
const device = openDevice(transport, protocol, profile ? { profile } : {});
|
|
46
47
|
|
|
47
48
|
// Read: written values, as the device holds them.
|
|
48
|
-
const
|
|
49
|
+
const held = await device.pull();
|
|
49
50
|
|
|
50
|
-
// Write: what the user wants, fitted to the device, every band filled
|
|
51
|
-
//
|
|
51
|
+
// Write: what the user wants, fitted to the device, every band filled (core's `plan`).
|
|
52
|
+
// Given what the device holds, bands the user left empty keep it, written flat; given the
|
|
53
|
+
// capabilities, the preamp and the right channel go out only where the device takes them.
|
|
52
54
|
if (profile) {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const planned = plan(
|
|
56
|
+
profile,
|
|
57
|
+
{ filters: wantedFilters, preamp: wantedPreamp },
|
|
58
|
+
{ ...device.capabilities, held }
|
|
59
|
+
);
|
|
60
|
+
planned.channels[0].fit.changes; // what had to move to fit, to show before writing
|
|
61
|
+
await device.push(planned.write);
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
|
@@ -81,8 +86,13 @@ device, and whether an old handle went or was reused, for telling these cases ap
|
|
|
81
86
|
`device.capabilities` says what the protocol can do (`canRead`, `canWrite`, `readsPreamp`,
|
|
82
87
|
`readsSlot`, `writesPreamp`, `writesSlot`, `needsBandCount`, the filter `types` it has wire codes
|
|
83
88
|
for, the `wire` grid it can carry, preset `slots`, `disconnectOnSave`, `experimental`,
|
|
84
|
-
`readsFirmware`, `readsEnabled`, `listsSlots`, `editsSlots`,
|
|
85
|
-
`controls` it drives).
|
|
89
|
+
`readsCurrentSlot`, `canEnable`, `readsFirmware`, `readsEnabled`, `listsSlots`, `editsSlots`,
|
|
90
|
+
`perChannel` and the device `controls` it drives). They are the device's word: where one says no,
|
|
91
|
+
the device answers for the handler without asking it (`currentSlot()` and `eqEnabled()` give
|
|
92
|
+
null, `setEnabled()` and the preset edits are `unsupported`). A handler states one only where it
|
|
93
|
+
depends on its options; otherwise `readsCurrentSlot`, `canEnable`, `readsEnabled` and
|
|
94
|
+
`editsSlots` are the handler having the method, and `writesPreamp` is its wire grid carrying a
|
|
95
|
+
preamp. Where the EQ switch is separate from the preset (`readsEnabled`),
|
|
86
96
|
`eqEnabled()` reads it, and `currentSlot()` gives the preset whether the EQ is on or off. A push
|
|
87
97
|
with a `preamp`, `slot` or `right` channel the protocol can't write is refused, not sent without
|
|
88
98
|
it, and so is a pull of a `slot` the protocol can't read. Each handler's `codec` turns a push
|
|
@@ -91,6 +101,16 @@ request into frames and back without a device, for checking what a value becomes
|
|
|
91
101
|
write takes, the filter types with wire codes, and each field's wire range and resolution as an
|
|
92
102
|
eqcaps domain. That is `handler-code` knowledge (SPEC §10): what a device can be sent, not what it
|
|
93
103
|
accepts. `handlerCodeUrl(handler, commit)` is the source `ref` for it.
|
|
104
|
+
`wireConstraints(protocol, bandCount)` gives the same as the constraints of a profile (a band
|
|
105
|
+
count one write carries, the types, each field's domain or null where the wire bounds none, and
|
|
106
|
+
the preamp as `manual` over its wire grid or `unknown`), for an app that drives a device without
|
|
107
|
+
a profile on a guessed protocol, or a profile being started. The caller fills the null fields
|
|
108
|
+
with placeholders of its own.
|
|
109
|
+
|
|
110
|
+
A program that must never write (the inspector, D40) opens a device with
|
|
111
|
+
`openReader(transport, protocol, options)` in place of `openDevice`: the same device with `pull`,
|
|
112
|
+
`currentSlot`, `eqEnabled`, `slots`, `bandCount`, `firmware`, `readControls`, `eq` and `close`
|
|
113
|
+
only, on every view.
|
|
94
114
|
|
|
95
115
|
## Handlers and their options
|
|
96
116
|
|
|
@@ -124,9 +144,10 @@ device's EQ memories), `disconnectOnSave`, `baudRate` (serial; default 115200 ov
|
|
|
124
144
|
Bluetooth) and `experimental`. A preset marked `"bypass": true` is the one that turns the EQ off:
|
|
125
145
|
`setEnabled(false)` selects it, and reading it back reports no current slot. Only `fiio-usb-hid`
|
|
126
146
|
and `ktmicro-usb-hid` turn the EQ off with a preset (KT Micro's default is slot 2, unless its
|
|
127
|
-
`enableRegister` is set); the others refuse a `bypass` preset. Presets marked `"writable": true`
|
|
128
|
-
write may target; once any preset is marked, the unmarked ones
|
|
129
|
-
bridge passes the mark on in `capabilities.slots` and doesn't
|
|
147
|
+
`enableRegister` is set); the others refuse a `bypass` preset. Presets marked `"writable": true`
|
|
148
|
+
(format 1.1) are the user memories a write may target; once any preset is marked, the unmarked ones
|
|
149
|
+
are built-in curves (SPEC §9). The bridge passes the mark on in `capabilities.slots` and doesn't
|
|
150
|
+
enforce it. A new option goes in `src/protocols.ts` (`OPTIONS`) and this table.
|
|
130
151
|
|
|
131
152
|
## Presets a device keeps as a list
|
|
132
153
|
|
|
@@ -161,29 +182,35 @@ refused (`invalid-request`): create it first. Like controls, these are never cal
|
|
|
161
182
|
## Other EQs
|
|
162
183
|
|
|
163
184
|
A profile's `protocol.eqs` (format 1.3, SPEC §9.2) lists the device's EQs besides the one the
|
|
164
|
-
profile describes: Qudelix's speaker EQ under its user EQ. One connection drives them all
|
|
165
|
-
|
|
185
|
+
profile describes: Qudelix's speaker EQ under its user EQ. One connection drives them all:
|
|
186
|
+
`openDevice` gives the device viewed as the EQ the profile describes, and `eq(id)` gives it
|
|
187
|
+
viewed as another.
|
|
166
188
|
|
|
167
189
|
```ts
|
|
168
|
-
import { eqProfile } from '@potatosalad775/eqcaps-core';
|
|
190
|
+
import { eqProfile, plan } from '@potatosalad775/eqcaps-core';
|
|
169
191
|
|
|
170
192
|
for (const eq of device.capabilities.eqs) {
|
|
171
193
|
console.log(eq.id, eq.name, eq.bandCount, eq.slots, eq.perChannel);
|
|
172
194
|
}
|
|
173
|
-
const
|
|
195
|
+
const speaker = device.eq('spk'); // the same connection, viewed as the speaker EQ
|
|
196
|
+
const held = await speaker.pull();
|
|
174
197
|
const spk = eqProfile(profile, 'spk')!; // the profile of that EQ: band count, presets, channels
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
await
|
|
178
|
-
|
|
198
|
+
const planned = plan(spk, { filters: wantedFilters }, { ...speaker.capabilities, held });
|
|
199
|
+
await speaker.push(planned.write);
|
|
200
|
+
await speaker.eqEnabled(); // also currentSlot(), bandCount(), setEnabled(on, slot), slots()
|
|
201
|
+
speaker.capabilities.slots; // the speaker EQ's presets; speaker.capabilities.perChannel likewise
|
|
179
202
|
```
|
|
180
203
|
|
|
181
|
-
|
|
204
|
+
A view is the device with one EQ's `pull`, `push`, switch, presets and band count, and that EQ's
|
|
205
|
+
`capabilities.slots` and `capabilities.perChannel`. The firmware, the controls and `close()` are
|
|
206
|
+
the device's, the same from every view. The views share one queue, so operations on two EQs
|
|
207
|
+
never interleave; `eq(id)` gives the same view each time, and `eq()` the profile's own.
|
|
182
208
|
`capabilities.eqs` holds the listed EQs this bridge's handler drives, each with its own preset
|
|
183
|
-
`slots` and `perChannel` (below); one the handler doesn't know is
|
|
184
|
-
isn't there is an `invalid-request
|
|
185
|
-
|
|
186
|
-
|
|
209
|
+
`slots` and `perChannel` (below), the same list on every view; one the handler doesn't know is
|
|
210
|
+
left out, and asking for an EQ that isn't there is an `invalid-request` from `eq()`. An EQ the
|
|
211
|
+
device's current mode lacks (a Qudelix in single-EQ mode) answers each operation `unsupported`.
|
|
212
|
+
The EQs are independent: a push to one leaves the others as they are. A handler names its EQs in
|
|
213
|
+
`eqs` and reads the operation's from `ctx.eq`; a new one goes there and in the table above.
|
|
187
214
|
|
|
188
215
|
## Left and right channels
|
|
189
216
|
|
|
@@ -191,29 +218,34 @@ A profile with `channels: "independent"` (format 1.4, SPEC §9) describes an EQ
|
|
|
191
218
|
filter set and a preamp for each output channel; a listed EQ may say it for itself (format 1.5,
|
|
192
219
|
SPEC §9.2), and `eqProfile` carries it. Where the handler drives that EQ's channels apart, a push
|
|
193
220
|
takes the right channel as `right`, and a pull returns it: `capabilities.perChannel` says so for
|
|
194
|
-
the
|
|
221
|
+
the EQ the device is viewed as, and `perChannel` of each of `capabilities.eqs` for that one
|
|
222
|
+
before its view is opened.
|
|
195
223
|
|
|
196
224
|
```ts
|
|
197
|
-
const left = fit(profile, wantedLeft, wantedLeftPreamp);
|
|
198
|
-
const right = fit(profile, wantedRight, wantedRightPreamp);
|
|
199
225
|
const held = await device.pull(); // held.right: the right channel, equal to the left or not
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
preamp:
|
|
206
|
-
}
|
|
207
|
-
}
|
|
226
|
+
const planned = plan(
|
|
227
|
+
profile,
|
|
228
|
+
{
|
|
229
|
+
filters: wantedLeft,
|
|
230
|
+
preamp: wantedLeftPreamp,
|
|
231
|
+
right: { filters: wantedRight, preamp: wantedRightPreamp }
|
|
232
|
+
},
|
|
233
|
+
{ ...device.capabilities, held }
|
|
234
|
+
);
|
|
235
|
+
await device.push(planned.write); // write.right: the right channel, where it goes out apart
|
|
236
|
+
planned.channels; // each channel's fit: the left's, then the right's
|
|
208
237
|
```
|
|
209
238
|
|
|
239
|
+
`plan` fits and completes each channel on its own and carries `right` only where the profile
|
|
240
|
+
says `independent` and the view is `perChannel`; elsewhere its write is the left for both.
|
|
241
|
+
|
|
210
242
|
With `right`, `filters` and `preamp` are the left channel's, and `right.preamp` left out is
|
|
211
243
|
`preamp`. Without it a push writes both channels alike, as on a linked EQ, and every handler takes
|
|
212
|
-
it. `right`
|
|
213
|
-
|
|
244
|
+
it. `right` on a view whose EQ isn't `perChannel` is an `invalid-request`, never written to both
|
|
245
|
+
channels. A pull of a `perChannel` EQ always has
|
|
214
246
|
`right`, also when the channels are equal, and its top-level `filters` and `preamp` are the left
|
|
215
|
-
channel's; other pulls have none. A handler says `perChannel` in its capabilities
|
|
216
|
-
|
|
247
|
+
channel's; other pulls have none. A handler says `perChannel` in its capabilities, which the
|
|
248
|
+
bridge asks for each EQ (`capabilities(transport, options, eq)`; it may depend on the options),
|
|
217
249
|
takes `right` in its push and codec, and returns it from its pull. The bridge never reads a
|
|
218
250
|
profile's `channels`; the protocol tests check the data against the handlers.
|
|
219
251
|
|
|
@@ -233,7 +265,11 @@ await device.writeControl('volume', 24); // only when the user changed it
|
|
|
233
265
|
|
|
234
266
|
`capabilities.controls` holds the profile's controls this bridge drives. `readControls()` gives
|
|
235
267
|
null for a control the device doesn't have now: its `firmware` range doesn't hold (unknown firmware
|
|
236
|
-
counts as outside it),
|
|
268
|
+
counts as outside it), the control its `when` names holds another value, or it is a setting of an
|
|
269
|
+
EQ the device's mode lacks (a Qudelix in single-EQ mode has no headphone EQ). A control with `eq`
|
|
270
|
+
(format 1.6) is a setting of one EQ, `true` for the profile's own or the id of one in
|
|
271
|
+
`capabilities.eqs`; it is read and written here like any other, from every view, and an app shows
|
|
272
|
+
it with that EQ. `writeControl` refuses
|
|
237
273
|
a value the control doesn't take (`invalid-request`) and a control the device doesn't have now
|
|
238
274
|
(`unsupported`), then reads the value back (`rejected` if it didn't take). For a control marked
|
|
239
275
|
`reconnect` it skips the read-back and returns `{ reconnect: true }`: the device may drop the
|
|
@@ -251,6 +287,8 @@ its role), so data newer than the bridge still drives the rest.
|
|
|
251
287
|
| `walkplay-hid` | `dacFilter`, `gainLevel`, `workMode`, `volume` (one byte each); `dre` (toggle, held as 0 on, 1 off; Tanchjim's app); `micGain`, `leftGain`, `rightGain` (dB, on a 1/256 grid). From NICEHCK's and Walkplay's web apps; `firmware()` too |
|
|
252
288
|
| `moondrop-usb-hid` | `globalGain` (dB on a 1/256 grid: read with `[0x80,3,0]`, written with `[1,3,2,s16 LE]` and the offset save `[1,4,0]`); then features that are read with `[0x80,cmd,0]` (the value at byte 3) and written with `[1,cmd,1,value]`, 50 ms, and no save: `dacFilter` (`0x11`), `dacMode` (`0x1D`), `led` (`0x28`, or `ledCommand`; 0 or 1), `gainLevel` (`0x26`), `ancMode` (`0x25`), `dualMicEnc` (`0x34`; 0 or 1); `promptTone` (on or off, 0 or 1) and `promptToneVolume`, which are bytes 0 and 1 of the three-byte `0x2B` (on, volume, tone): a write reads the three, changes its own and writes all three back, so the tone is never changed. A value that is not a whole number from 0 to 255 (0 or 1 for the toggles) is `unrepresentable`; the ones a device takes are the profile's. With `linkCheck`, the link is asked about before each read and write. From Moondrop's web app; `firmware()` too |
|
|
253
289
|
| `ktmicro-usb-hid` | `globalGain` (the KT0211L's DAC gain register 0x3b as a step), `globalGainDb` (the same register in dB on models that hold it so, minus ten times the dB); both use `gainRegister` in place of 0x3b when it is set (Walkplay's SchemeNo19 holds the dB in 0x57). From Kiwi Ears' web app and Walkplay's Android app |
|
|
290
|
+
| `qudelix-usb-hid` | `headroom` and `headroomSpk` (dB; the headroom of the EQ the profile describes, which is the all-band EQ in single-EQ mode, and of the headphone EQ, held as tenths); `crossfeed` (the level of the EQ the profile describes, 0 to 50); `dacFilter` and `gain` (the device's own numbers, one command each). A headroom or crossfeed write is refused (`rejected`) while that EQ is off, as the app's editor holds them still then; `headroomSpk` reads null in single-EQ mode. On a T71 only the two headrooms are driven; its crossfeed and DAC settings are `unsupported`. From Qudelix's app for Chrome; tried on a 5K |
|
|
291
|
+
| `qudelix-v2-usb-hid` | `headroom`, `headroomSpk`, `crossfeed`, `dacFilter` and `gain`, as on `qudelix-usb-hid`. Each write sends the whole element that holds the setting with the one field changed: the EQ's configuration, the preset attributes, the DAC configuration. From Qudelix's app for Chrome; tried on a 5K Plus |
|
|
254
292
|
| `topping-usb-hid` | `volume` and `balance` (dB; the device holds the volume as attenuation in 0.5 dB steps, or 1 dB in its 1 dB step mode, and the balance as signed tenths); `mute`, `input`, `output`, `gain`, `lineMode`, `dacFilter`, `polarity`, `crossfeed`, `brightness` (the device's own numbers). DX5 II only; the other families' settings are not driven. A volume write is refused (`rejected`) while a line output is in DAC mode, as the app sends nothing then. From Topping's web app; tried on a DX5 II |
|
|
255
293
|
|
|
256
294
|
Errors are `BridgeError`s with a `code`: `unsupported-type`, `unrepresentable`, `unsupported`,
|
package/dist/analysis.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Domain, FilterType } from '@potatosalad775/eqcaps-core';
|
|
1
|
+
import type { Domain, FilterType, Preamp } from '@potatosalad775/eqcaps-core';
|
|
2
2
|
import type { WireGrid } from './handler.ts';
|
|
3
3
|
import type { Protocol } from './protocols.ts';
|
|
4
4
|
/** The most bands the analysis tries to encode. */
|
|
@@ -29,6 +29,28 @@ export interface CodecAnalysis {
|
|
|
29
29
|
}
|
|
30
30
|
/** What `protocol`'s codec can write, worked out offline. */
|
|
31
31
|
export declare function analyzeCodec(protocol: Protocol): CodecAnalysis;
|
|
32
|
+
/**
|
|
33
|
+
* A protocol's wire limits as the constraints of a profile: where a device has no profile (an app
|
|
34
|
+
* drives it on a guessed protocol), or a profile is being started for it (the inspector's draft).
|
|
35
|
+
* Wire limits only (SPEC §10, `handler-code`): what a write can carry, not what the device takes.
|
|
36
|
+
*/
|
|
37
|
+
export interface WireConstraints {
|
|
38
|
+
/** `bandCount` as asked, held within what one write carries. */
|
|
39
|
+
bandCount: number;
|
|
40
|
+
/** Types with wire codes, in the codec's order; a vendor's own (`x-`) are left out. */
|
|
41
|
+
types: FilterType[];
|
|
42
|
+
/**
|
|
43
|
+
* Each band field over its wire grid; null where the wire is a float with no limit of its own,
|
|
44
|
+
* or carries no Q. The caller fills those with a placeholder of its own.
|
|
45
|
+
*/
|
|
46
|
+
freq: Domain | null;
|
|
47
|
+
q: Domain | null;
|
|
48
|
+
gain: Domain | null;
|
|
49
|
+
/** `manual` over the preamp's wire grid; `unknown` where the wire bounds none or carries none. */
|
|
50
|
+
preamp: Preamp;
|
|
51
|
+
}
|
|
52
|
+
/** `protocol`'s wire limits as profile constraints, for `bandCount` bands (default 10). */
|
|
53
|
+
export declare function wireConstraints(protocol: Protocol, bandCount?: number): WireConstraints;
|
|
32
54
|
/** Where a handler's code lives in this repository, at `commit`. */
|
|
33
55
|
export declare function handlerCodeUrl(handler: Protocol['handler'], commit: string): string;
|
|
34
56
|
//# sourceMappingURL=analysis.d.ts.map
|
package/dist/analysis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAU,UAAU,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAU,UAAU,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAEtF,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,0DAA0D;IAC1D,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B;;;;OAIG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iCAAiC;IACjC,IAAI,EAAE,QAAQ,CAAC;CACf;AAiED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAc9D;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,kGAAkG;IAClG,MAAM,EAAE,MAAM,CAAC;CACf;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,SAAK,GAAG,eAAe,CAUnF;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnF"}
|
package/dist/analysis.js
CHANGED
|
@@ -85,6 +85,18 @@ export function analyzeCodec(protocol) {
|
|
|
85
85
|
wire
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
/** `protocol`'s wire limits as profile constraints, for `bandCount` bands (default 10). */
|
|
89
|
+
export function wireConstraints(protocol, bandCount = 10) {
|
|
90
|
+
const a = analyzeCodec(protocol);
|
|
91
|
+
return {
|
|
92
|
+
bandCount: Math.min(Math.max(bandCount, a.bands.min), a.bands.max),
|
|
93
|
+
types: a.types.filter((t) => !t.startsWith('x-')),
|
|
94
|
+
freq: a.freq,
|
|
95
|
+
q: a.q,
|
|
96
|
+
gain: a.gain,
|
|
97
|
+
preamp: a.preamp ? { mode: 'manual', gain: a.preamp } : { mode: 'unknown' }
|
|
98
|
+
};
|
|
99
|
+
}
|
|
88
100
|
/** Where a handler's code lives in this repository, at `commit`. */
|
|
89
101
|
export function handlerCodeUrl(handler, commit) {
|
|
90
102
|
return `https://github.com/potatosalad775/eqcaps/blob/${commit}/packages/device-bridge/src/handlers/${handler}.ts`;
|
package/dist/analysis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.js","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"m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"}
|
package/dist/device.d.ts
CHANGED
|
@@ -21,10 +21,16 @@ export interface DeviceCapabilities extends HandlerCapabilities {
|
|
|
21
21
|
types: readonly FilterType[];
|
|
22
22
|
/** What the write frames can carry. A profile domain outside it can't be written. */
|
|
23
23
|
wire: WireGrid;
|
|
24
|
+
/** Push writes `preamp` when given: the wire carries one (`wire.preamp`). */
|
|
25
|
+
writesPreamp: boolean;
|
|
26
|
+
/** `currentSlot()` asks the device rather than answering null. */
|
|
27
|
+
readsCurrentSlot: boolean;
|
|
28
|
+
/** `setEnabled()` sends a command. */
|
|
29
|
+
canEnable: boolean;
|
|
24
30
|
/**
|
|
25
|
-
* The preset slots of the EQ
|
|
26
|
-
* (`listsSlots`), these are the ones it has room for, under the data's names: `slots()`
|
|
27
|
-
* which exist now.
|
|
31
|
+
* The preset slots of the EQ this device is viewed as (`eq()`). Where the device keeps a list of
|
|
32
|
+
* presets (`listsSlots`), these are the ones it has room for, under the data's names: `slots()`
|
|
33
|
+
* says which exist now.
|
|
28
34
|
*/
|
|
29
35
|
slots: readonly Slot[];
|
|
30
36
|
/** `slots()` asks the device, which keeps a list of presets with names of its own. */
|
|
@@ -32,13 +38,13 @@ export interface DeviceCapabilities extends HandlerCapabilities {
|
|
|
32
38
|
/** `createSlot()`, `renameSlot()` and `deleteSlot()` send commands. */
|
|
33
39
|
editsSlots: boolean;
|
|
34
40
|
/**
|
|
35
|
-
* `push` takes the right channel as `right`, and `pull` returns it (SPEC §9), on the
|
|
36
|
-
*
|
|
41
|
+
* `push` takes the right channel as `right`, and `pull` returns it (SPEC §9), on the EQ this
|
|
42
|
+
* device is viewed as.
|
|
37
43
|
*/
|
|
38
44
|
perChannel: boolean;
|
|
39
45
|
/**
|
|
40
|
-
* The device's other EQs (SPEC §9.2), each with its own slots: `
|
|
41
|
-
*
|
|
46
|
+
* The device's other EQs (SPEC §9.2), each with its own slots: `eq(id)` gives the device viewed
|
|
47
|
+
* as one. Empty for a device with one EQ, and the same list on every view.
|
|
42
48
|
*/
|
|
43
49
|
eqs: readonly EqInfo[];
|
|
44
50
|
/** The device drops the connection after a push that saves; reconnect afterwards. */
|
|
@@ -58,7 +64,13 @@ export interface ControlWriteResult {
|
|
|
58
64
|
/** The control is marked `reconnect`: the device may drop the connection, so reconnect. */
|
|
59
65
|
reconnect: boolean;
|
|
60
66
|
}
|
|
61
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* A connected device, viewed as one of its EQs: a transport driven by a protocol. `openDevice`
|
|
69
|
+
* gives it viewed as the EQ its profile describes; `eq(id)` gives it viewed as another (SPEC
|
|
70
|
+
* §9.2). `pull`, `push`, the EQ's switch, its presets and its band count are that EQ's, and so
|
|
71
|
+
* are `capabilities.slots` and `capabilities.perChannel`. The firmware, the controls and closing
|
|
72
|
+
* are the device's, the same from every view.
|
|
73
|
+
*/
|
|
62
74
|
export interface BridgeDevice {
|
|
63
75
|
readonly transport: Transport;
|
|
64
76
|
readonly protocol: Protocol;
|
|
@@ -67,23 +79,20 @@ export interface BridgeDevice {
|
|
|
67
79
|
pull(request?: PullRequest): Promise<PullResult>;
|
|
68
80
|
push(request: PushRequest): Promise<PushResult>;
|
|
69
81
|
/**
|
|
70
|
-
* Each of the next four takes the id of one of `capabilities.eqs` as `eq`, and is about the
|
|
71
|
-
* profile's own EQ without it.
|
|
72
|
-
*
|
|
73
82
|
* The active preset slot; null when the protocol can't say, or (on some bypass-preset
|
|
74
83
|
* protocols) when the EQ is off. Where the EQ switch is separate state (`readsEnabled`), this is
|
|
75
84
|
* the preset the device plays when its EQ is on, whether it is on or not.
|
|
76
85
|
*/
|
|
77
|
-
currentSlot(
|
|
86
|
+
currentSlot(): Promise<number | null>;
|
|
78
87
|
/** Whether the EQ is on (`readsEnabled`); null when the protocol or device doesn't say. */
|
|
79
|
-
eqEnabled(
|
|
80
|
-
setEnabled(enabled: boolean, slot?: number
|
|
88
|
+
eqEnabled(): Promise<boolean | null>;
|
|
89
|
+
setEnabled(enabled: boolean, slot?: number): Promise<void>;
|
|
81
90
|
/**
|
|
82
91
|
* The preset slots as they are now. Where the device keeps a list (`listsSlots`) it is asked:
|
|
83
92
|
* the presets it holds, under the names it stores, ids counting from 0, followed by the data's
|
|
84
93
|
* `bypass` preset if there is one. Elsewhere this is `capabilities.slots`.
|
|
85
94
|
*/
|
|
86
|
-
slots(
|
|
95
|
+
slots(): Promise<readonly Slot[]>;
|
|
87
96
|
/**
|
|
88
97
|
* The next three need `editsSlots`. This one adds an empty preset after the last and returns
|
|
89
98
|
* it; without a `name` the device or handler picks one. Refused when the device is full. The
|
|
@@ -91,26 +100,26 @@ export interface BridgeDevice {
|
|
|
91
100
|
*/
|
|
92
101
|
createSlot(request?: {
|
|
93
102
|
name?: string;
|
|
94
|
-
eq?: string;
|
|
95
103
|
}): Promise<Slot>;
|
|
96
104
|
/** Renames a preset. A name the device can't store is refused, never shortened. */
|
|
97
|
-
renameSlot(slot: number, name: string
|
|
105
|
+
renameSlot(slot: number, name: string): Promise<void>;
|
|
98
106
|
/**
|
|
99
107
|
* Deletes a preset. The ones after it move down by one and the device may switch to another:
|
|
100
108
|
* ask `slots()` and `currentSlot()` afterwards.
|
|
101
109
|
*/
|
|
102
|
-
deleteSlot(slot: number
|
|
110
|
+
deleteSlot(slot: number): Promise<void>;
|
|
103
111
|
/** The device's firmware version, read once; null when the protocol or device doesn't say. */
|
|
104
112
|
firmware(): Promise<string | null>;
|
|
105
113
|
/**
|
|
106
114
|
* The band count the device reports, asked each time; null when the protocol or device doesn't
|
|
107
115
|
* say. It can differ from the profile's `bandCount`: the bridge doesn't reconcile them.
|
|
108
116
|
*/
|
|
109
|
-
bandCount(
|
|
117
|
+
bandCount(): Promise<number | null>;
|
|
110
118
|
/**
|
|
111
119
|
* The current value of every control in `capabilities.controls`; null for one the device
|
|
112
|
-
* doesn't have now (SPEC §9.1: its firmware range or `when` doesn't hold
|
|
113
|
-
* push never touch
|
|
120
|
+
* doesn't have now (SPEC §9.1: its firmware range or `when` doesn't hold, or its handler says
|
|
121
|
+
* so, as for a setting of an EQ the device's mode lacks). Opt-in: pull and push never touch
|
|
122
|
+
* controls.
|
|
114
123
|
*/
|
|
115
124
|
readControls(): Promise<Record<string, number | null>>;
|
|
116
125
|
/**
|
|
@@ -119,6 +128,13 @@ export interface BridgeDevice {
|
|
|
119
128
|
* when the user changed the control (SPEC §9.1).
|
|
120
129
|
*/
|
|
121
130
|
writeControl(id: string, value: number): Promise<ControlWriteResult>;
|
|
131
|
+
/**
|
|
132
|
+
* This device viewed as another of its EQs: an id of `capabilities.eqs`, or none for the EQ the
|
|
133
|
+
* profile describes. The same connection, one operation at a time across every view, and the
|
|
134
|
+
* same view each time it is asked for. An EQ the profile doesn't list is refused here
|
|
135
|
+
* (`invalid-request`); one the device's current mode lacks answers each operation `unsupported`.
|
|
136
|
+
*/
|
|
137
|
+
eq(id?: string): BridgeDevice;
|
|
122
138
|
close(): Promise<void>;
|
|
123
139
|
}
|
|
124
140
|
/** The transport kinds a handler runs over. */
|
|
@@ -130,4 +146,17 @@ export declare const handlerTransports: (id: string) => readonly Transport["kind
|
|
|
130
146
|
* the database knows, `guessProtocol(vendorId)` otherwise. Operations run one at a time.
|
|
131
147
|
*/
|
|
132
148
|
export declare function openDevice(transport: Transport, protocol: Protocol, options?: OpenOptions): BridgeDevice;
|
|
149
|
+
/**
|
|
150
|
+
* The reading side of a connected device (D40): what `BridgeDevice` has that sends no write.
|
|
151
|
+
* `pull` and the other reads do send their requests; nothing here changes what the device holds.
|
|
152
|
+
*/
|
|
153
|
+
export type DeviceReader = Pick<BridgeDevice, 'transport' | 'protocol' | 'identity' | 'capabilities' | 'pull' | 'currentSlot' | 'eqEnabled' | 'slots' | 'bandCount' | 'firmware' | 'readControls' | 'close'> & {
|
|
154
|
+
/** This device viewed as another of its EQs (SPEC §9.2), for reading too. */
|
|
155
|
+
eq(id?: string): DeviceReader;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* `openDevice` for a program that must never write (the inspector, D40): the object it gives has
|
|
159
|
+
* no `push`, `setEnabled`, `writeControl` or preset editing, on any view.
|
|
160
|
+
*/
|
|
161
|
+
export declare function openReader(transport: Transport, protocol: Protocol, options?: OpenOptions): DeviceReader;
|
|
133
162
|
//# sourceMappingURL=device.d.ts.map
|
package/dist/device.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,OAAO,EAEZ,KAAK,UAAU,EACf,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EACX,UAAU,EACV,MAAM,EACN,mBAAmB,EAEnB,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACxC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,oCAAoC;IACpC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC9D,oDAAoD;IACpD,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B,qFAAqF;IACrF,IAAI,EAAE,QAAQ,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,sFAAsF;IACtF,UAAU,EAAE,OAAO,CAAC;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