alphatheta-connect 0.26.1 → 0.27.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,5 +1,7 @@
1
1
  import { Socket } from 'dgram';
2
2
  import { CDJStatus, Device } from "../types";
3
+ import { LoadSource } from './load';
4
+ export { LoadSource, makeLoadTrackPacket } from './load';
3
5
  interface Options {
4
6
  hostDevice: Device;
5
7
  device: Device;
@@ -11,7 +13,22 @@ interface Options {
11
13
  export declare const makePlaystatePacket: ({ hostDevice, device, playState }: Options) => Uint8Array<ArrayBuffer>;
12
14
  export default class Control {
13
15
  #private;
14
- constructor(beatSocket: Socket, hostDevice: Device);
16
+ constructor(beatSocket: Socket, hostDevice: Device, statusSocket?: Socket | null);
17
+ /**
18
+ * Send one Stagehand transport packet (0x07) carrying `op` with the press /
19
+ * release flag, for opcodes the named methods do not cover.
20
+ */
21
+ transport(device: Device, op: number, press: boolean): Promise<void>;
22
+ /**
23
+ * Tell a player to load a track, as rekordbox does when a row is dragged
24
+ * onto a deck: the Load Track command (0x19) from our status port to the
25
+ * player's. The player answers 0x1a and the load shows in its next status.
26
+ *
27
+ * `source` names where the track lives: a device number and its slot (a
28
+ * player's USB or SD, or the rekordbox slot of a library served over the
29
+ * link).
30
+ */
31
+ loadTrack(device: Device, trackId: number, source: LoadSource): Promise<void>;
15
32
  /**
16
33
  * Start or stop a CDJ on the network.
17
34
  * Delegates automatically to Stagehand-specific transport control if connected in Stagehand mode.
@@ -48,4 +65,3 @@ export default class Control {
48
65
  quantize?: number;
49
66
  }): Promise<void>;
50
67
  }
51
- export {};
@@ -0,0 +1,29 @@
1
+ import { Device, MediaSlot, TrackType } from "../types";
2
+ /**
3
+ * Where the track a Load Track command names lives: the device holding the
4
+ * media, its slot, and the track type as the player's status reports it.
5
+ */
6
+ export interface LoadSource {
7
+ deviceId: number;
8
+ slot: MediaSlot;
9
+ trackType?: TrackType;
10
+ }
11
+ /**
12
+ * Byte length of a Load Track command.
13
+ */
14
+ export declare const LOAD_TRACK_LENGTH = 88;
15
+ /**
16
+ * Generates the Load Track command (0x19, 88 bytes), unicast to a player's
17
+ * status port.
18
+ *
19
+ * Byte for byte what rekordbox 7.2 sends a CDJ-3000 (captured 2026-09-13 and
20
+ * verified live on two CDJ-3000s): the status-style header with a 20-byte
21
+ * name, `01 01`, our device number, the length `0034` of what follows, our
22
+ * number again, then the source device, slot and track type, the track ID
23
+ * big-endian, `32` at 0x33, the destination player counted from zero at
24
+ * 0x40, and `32` at 0x4b.
25
+ *
26
+ * A player only honours the command from the address its keep-alives
27
+ * announced and from port 50002.
28
+ */
29
+ export declare function makeLoadTrackPacket(hostDevice: Device, device: Device, trackId: number, source: LoadSource): Uint8Array;
@@ -1,15 +1,25 @@
1
1
  import { Device } from "../types";
2
2
  /**
3
- * Generates a Stagehand transport control packet (0x07, 56 bytes)
3
+ * Generates a Stagehand transport control packet (0x07, 48 bytes).
4
+ *
5
+ * Byte for byte what the iPad app sends a CDJ-3000 (captured 2026-05-23,
6
+ * `stagehand-allproto-20260523T142615.pcap`, pinned in the tests): the
7
+ * unicast header `03 01 00`, a byte that varies per command, the length
8
+ * `0030`, then `3a`, `01`, the opcode and the press flag each in their own
9
+ * 16-bit slot.
4
10
  *
5
11
  * @param hostDevice - The Stagehand device posing as sender
6
- * @param op - The command opcode (e.g. 0x0f, 0x14, 0x18, 0x1a, 0x1b)
12
+ * @param op - The command opcode (e.g. 0x0f, 0x14, 0x18, 0x19, 0x1a, 0x1b)
7
13
  * @param press - Whether the action is press (true) or release (false)
8
- * @param correlationByte - The randomized per-session correlation byte
14
+ * @param correlationByte - The per-session correlation byte
9
15
  */
10
16
  export declare function makeStagehandTransportPacket(hostDevice: Device, op: number, press: boolean, correlationByte: number): Uint8Array;
11
17
  /**
12
- * Generates a Stagehand preference write packet (0x6b, 124 bytes)
18
+ * Generates a Stagehand preference write packet (0x6b, 116 bytes).
19
+ *
20
+ * As captured from the iPad app (same capture as the transport packet): the
21
+ * unicast header `03 01 00 3a`, the length `0050`, the write flag, then the
22
+ * preference slots.
13
23
  *
14
24
  * @param hostDevice - The Stagehand device posing as sender
15
25
  * @param options - The preferences to write (onAir, quantize)
package/lib/index.d.ts CHANGED
@@ -1,6 +1,11 @@
1
+ export type { LoadSource } from './control';
2
+ export { default as Control } from './control';
1
3
  export * from './entities';
2
4
  export * from './mixstatus';
3
5
  export * from './network';
6
+ export * from './remote';
7
+ export * from './remote/hue';
8
+ export { createServer as createRemoteServer } from './remote/server';
4
9
  export { default as PositionEmitter } from './status/position';
5
10
  export * from './passive';
6
11
  export type { FileReader as ArtworkFileReader, ExtractedArtwork } from './artwork';