alphatheta-connect 0.22.0 → 0.23.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.
@@ -1,4 +1,10 @@
1
- import type { DeviceID } from "../types";
1
+ /**
2
+ * Mirrors {@link import('src/types').DeviceID}. Declared locally rather than
3
+ * imported so this module carries no dependencies at all: consumers re-export
4
+ * it into their own test setups, where the package's `src/*` path aliases do
5
+ * not resolve.
6
+ */
7
+ type DeviceID = number;
2
8
  /**
3
9
  * The highest device ID a CDJ will answer remotedb queries from.
4
10
  *
@@ -10,19 +16,62 @@ export declare const REMOTEDB_MAX_DEVICE_ID = 6;
10
16
  * The highest device ID the prolink protocol allows.
11
17
  */
12
18
  export declare const MAX_DEVICE_ID = 32;
19
+ /**
20
+ * How many player numbers each mixer can hand out.
21
+ *
22
+ * Players take their number from the mixer channel they are plugged into, so
23
+ * an N-channel mixer only ever produces players 1..N — and N+1 is the lowest
24
+ * number that no player on that rig can claim.
25
+ *
26
+ * These are physical channel counts, deliberately NOT the `channelCount` in
27
+ * the app's own capability table, which caps the DJM-V10 at 4 for its mixer
28
+ * signal model. Capping here would put us on player 5 of a 6-channel rig,
29
+ * which is the collision this table exists to avoid.
30
+ */
31
+ export declare const MIXER_PLAYER_CEILING: Record<string, number>;
32
+ /**
33
+ * What to assume about a mixer whose model we do not recognise.
34
+ *
35
+ * Four is both the most common layout and the choice that keeps remotedb
36
+ * metadata working: assuming six would push us to player 7 on every mixer
37
+ * released after this table was written, silently losing metadata for
38
+ * unanalyzed and streaming tracks. A six-channel unit we failed to recognise
39
+ * may later claim the number we took, which the announcer's conflict handling
40
+ * resolves by moving us.
41
+ */
42
+ export declare const DEFAULT_MIXER_PLAYER_CEILING = 4;
43
+ /** The fields {@link playerNumberCeiling} reads off a discovered device. */
44
+ export interface DeviceLike {
45
+ name: string;
46
+ type: number;
47
+ }
48
+ /**
49
+ * The highest player number the discovered gear can hand out, or undefined
50
+ * when nothing on the network implies one.
51
+ *
52
+ * Undefined means we have no mixer to reason from — players may have been
53
+ * numbered by hand anywhere in 1-6, and there is no better guess available.
54
+ */
55
+ export declare function playerNumberCeiling(devices: Iterable<DeviceLike>): number | undefined;
13
56
  export interface PickDeviceIdOptions {
14
57
  /**
15
58
  * Prefer an ID in the 1-6 range, which is the only range CDJs answer
16
59
  * remotedb metadata queries from (unanalyzed media, CD text, streaming
17
60
  * tracks).
18
61
  *
19
- * That range is shared with real players, so the search runs downwards from
20
- * 6: players number themselves from 1 upwards, so the top of the range is
21
- * the least likely to be claimed by a CDJ that powers on later.
22
- *
23
62
  * @default false
24
63
  */
25
64
  preferRemoteDb?: boolean;
65
+ /**
66
+ * The highest player number the rig can hand out, from
67
+ * {@link playerNumberCeiling}. The search starts just above it, so the
68
+ * number we take is one no player on this rig can be assigned.
69
+ *
70
+ * When omitted, the 1-6 range is searched downwards instead: players number
71
+ * themselves from 1 upwards, so the top of the range is the least likely to
72
+ * be claimed by a CDJ that powers on later.
73
+ */
74
+ playerCeiling?: number;
26
75
  }
27
76
  /**
28
77
  * Pick a device ID that no device on the network is currently using.
@@ -34,4 +83,5 @@ export interface PickDeviceIdOptions {
34
83
  * Returns null when every ID from 1 to 32 is occupied, in which case there is
35
84
  * no safe ID and the caller must not join the network.
36
85
  */
37
- export declare function pickAvailableDeviceId(usedIds: Iterable<DeviceID>, { preferRemoteDb }?: PickDeviceIdOptions): DeviceID | null;
86
+ export declare function pickAvailableDeviceId(usedIds: Iterable<DeviceID>, { preferRemoteDb, playerCeiling }?: PickDeviceIdOptions): DeviceID | null;
87
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alphatheta-connect",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "main": "lib/index.js",
5
5
  "author": "Evan Purkhiser <evanpurkhiser@gmail.com>",
6
6
  "contributors": [