alphatheta-connect 0.15.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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/lib/artwork/index.d.ts +9 -0
  4. package/lib/artwork/parsers/aiff.d.ts +2 -0
  5. package/lib/artwork/parsers/flac.d.ts +2 -0
  6. package/lib/artwork/parsers/id3.d.ts +2 -0
  7. package/lib/artwork/parsers/index.d.ts +5 -0
  8. package/lib/artwork/parsers/mp4.d.ts +2 -0
  9. package/lib/artwork/parsers/utils.d.ts +3 -0
  10. package/lib/artwork/reader.d.ts +15 -0
  11. package/lib/artwork/types.d.ts +44 -0
  12. package/lib/cli/index.d.ts +1 -0
  13. package/lib/cli.js +11431 -0
  14. package/lib/cli.js.map +1 -0
  15. package/lib/constants.d.ts +40 -0
  16. package/lib/control/index.d.ts +20 -0
  17. package/lib/db/getArtworkFromFile.d.ts +13 -0
  18. package/lib/db/getArtworkThumbnail.d.ts +29 -0
  19. package/lib/db/getFile.d.ts +29 -0
  20. package/lib/db/getMetadata.d.ts +28 -0
  21. package/lib/db/getPlaylist.d.ts +26 -0
  22. package/lib/db/getWaveforms.d.ts +29 -0
  23. package/lib/db/index.d.ts +70 -0
  24. package/lib/db/utils.d.ts +7 -0
  25. package/lib/devices/index.d.ts +66 -0
  26. package/lib/devices/utils.d.ts +5 -0
  27. package/lib/entities.d.ts +122 -0
  28. package/lib/index.d.ts +10 -0
  29. package/lib/index.js +13381 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/localdb/database-adapter.d.ts +49 -0
  32. package/lib/localdb/index.d.ts +104 -0
  33. package/lib/localdb/onelibrary-schema.d.ts +250 -0
  34. package/lib/localdb/onelibrary.d.ts +185 -0
  35. package/lib/localdb/orm.d.ts +60 -0
  36. package/lib/localdb/rekordbox.d.ts +112 -0
  37. package/lib/localdb/schema.d.ts +1 -0
  38. package/lib/localdb/utils.d.ts +5 -0
  39. package/lib/mixstatus/index.d.ts +109 -0
  40. package/lib/mixstatus/utils.d.ts +9 -0
  41. package/lib/network.d.ts +201 -0
  42. package/lib/nfs/index.d.ts +63 -0
  43. package/lib/nfs/programs.d.ts +61 -0
  44. package/lib/nfs/rpc.d.ts +60 -0
  45. package/lib/nfs/utils.d.ts +4 -0
  46. package/lib/nfs/xdr.d.ts +17 -0
  47. package/lib/passive/alphatheta.d.ts +94 -0
  48. package/lib/passive/devices.d.ts +64 -0
  49. package/lib/passive/index.d.ts +169 -0
  50. package/lib/passive/localdb.d.ts +122 -0
  51. package/lib/passive/pcap-adapter.d.ts +77 -0
  52. package/lib/passive/position.d.ts +32 -0
  53. package/lib/passive/remotedb.d.ts +49 -0
  54. package/lib/passive/status.d.ts +41 -0
  55. package/lib/remotedb/constants.d.ts +8 -0
  56. package/lib/remotedb/fields.d.ts +169 -0
  57. package/lib/remotedb/index.d.ts +160 -0
  58. package/lib/remotedb/message/index.d.ts +39 -0
  59. package/lib/remotedb/message/item.d.ts +530 -0
  60. package/lib/remotedb/message/response.d.ts +18 -0
  61. package/lib/remotedb/message/types.d.ts +227 -0
  62. package/lib/remotedb/queries.d.ts +99 -0
  63. package/lib/remotedb/utils.d.ts +23 -0
  64. package/lib/status/index.d.ts +39 -0
  65. package/lib/status/media.d.ts +22 -0
  66. package/lib/status/position.d.ts +29 -0
  67. package/lib/status/types.d.ts +170 -0
  68. package/lib/status/utils.d.ts +19 -0
  69. package/lib/types.d.ts +457 -0
  70. package/lib/types.js +274 -0
  71. package/lib/types.js.map +1 -0
  72. package/lib/utils/converters.d.ts +17 -0
  73. package/lib/utils/index.d.ts +28 -0
  74. package/lib/utils/telemetry.d.ts +82 -0
  75. package/lib/utils/udp.d.ts +20 -0
  76. package/lib/virtualcdj/index.d.ts +33 -0
  77. package/package.json +93 -0
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Used for control messages with the remote database
3
+ */
4
+ export declare enum ControlRequest {
5
+ Introduce = 0,
6
+ Disconnect = 256,
7
+ RenderMenu = 12288
8
+ }
9
+ /**
10
+ * Used to setup renders for specific Menus
11
+ */
12
+ export declare enum MenuRequest {
13
+ MenuRoot = 4096,
14
+ MenuGenre = 4097,
15
+ MenuArtist = 4098,
16
+ MenuAlbum = 4099,
17
+ MenuTrack = 4100,
18
+ MenuBPM = 4102,
19
+ MenuRating = 4103,
20
+ MenuYear = 4104,
21
+ MenuLabel = 4106,
22
+ MenuColor = 4109,
23
+ MenuTime = 4112,
24
+ MenuBitrate = 4113,
25
+ MenuHistory = 4114,
26
+ MenuFilename = 4115,
27
+ MenuKey = 4116,
28
+ MenuOriginalArtist = 4866,
29
+ MenuRemixer = 5634,
30
+ MenuPlaylist = 4357,
31
+ MenuArtistsOfGenre = 4353,
32
+ MenuAlbumsOfArtist = 4354,
33
+ MenuTracksOfAlbum = 4355,
34
+ MenuTracksOfRating = 4359,
35
+ MenuYearsOfDecade = 4360,
36
+ MenuArtistsOfLabel = 4362,
37
+ MenuTracksOfColor = 4365,
38
+ MenuTracksOfTime = 4368,
39
+ MenuTracksOfHistory = 4370,
40
+ MenuDistancesOfKey = 4372,
41
+ MenuAlbumsOfOriginalArtist = 5122,
42
+ MenuAlbumsOfRemixer = 5890,
43
+ MenuAlbumsOfGenreAndArtist = 4609,
44
+ MenuTracksOfArtistAndAlbum = 4610,
45
+ MenuTracksOfBPMPercentRange = 4614,
46
+ MenuTracksOfDecadeAndYear = 4616,
47
+ MenuAlbumsOfLabelAndArtist = 4618,
48
+ MenuTracksNearKey = 4628,
49
+ MenuTracksOfOriginalArtistAndAlbum = 5378,
50
+ MenuTracksOfRemixerAndAlbum = 6146,
51
+ MenuTracksOfGenreArtistAndAlbum = 4865,
52
+ MenuTracksOfLabelArtistAndAlbum = 4874,
53
+ MenuSearch = 4864,
54
+ MenuFolder = 8198
55
+ }
56
+ /**
57
+ * Request message types used to obtain specfiic track information
58
+ */
59
+ export declare enum DataRequest {
60
+ GetMetadata = 8194,
61
+ GetArtwork = 8195,
62
+ GetWaveformPreview = 8196,
63
+ GetTrackInfo = 8450,
64
+ GetGenericMetadata = 8706,
65
+ GetCueAndLoops = 8452,
66
+ GetBeatGrid = 8708,
67
+ GetWaveformDetailed = 10500,
68
+ GetAdvCueAndLoops = 11012,
69
+ GetWaveformHD = 11268
70
+ }
71
+ /**
72
+ * Response message types for messages sent back by the server.
73
+ */
74
+ export declare enum Response {
75
+ Success = 16384,
76
+ Error = 16387,
77
+ Artwork = 16386,
78
+ MenuItem = 16641,
79
+ MenuHeader = 16385,
80
+ MenuFooter = 16897,
81
+ BeatGrid = 17922,
82
+ CueAndLoop = 18178,
83
+ WaveformPreview = 17410,
84
+ WaveformDetailed = 18946,
85
+ AdvCueAndLoops = 19970,
86
+ WaveformHD = 20226
87
+ }
88
+ /**
89
+ * Request message types, only sent to the device.
90
+ */
91
+ export type Request = ControlRequest | MenuRequest | DataRequest;
92
+ export declare const Request: {
93
+ readonly [x: number]: string;
94
+ readonly GetMetadata: DataRequest.GetMetadata;
95
+ readonly GetArtwork: DataRequest.GetArtwork;
96
+ readonly GetWaveformPreview: DataRequest.GetWaveformPreview;
97
+ readonly GetTrackInfo: DataRequest.GetTrackInfo;
98
+ readonly GetGenericMetadata: DataRequest.GetGenericMetadata;
99
+ readonly GetCueAndLoops: DataRequest.GetCueAndLoops;
100
+ readonly GetBeatGrid: DataRequest.GetBeatGrid;
101
+ readonly GetWaveformDetailed: DataRequest.GetWaveformDetailed;
102
+ readonly GetAdvCueAndLoops: DataRequest.GetAdvCueAndLoops;
103
+ readonly GetWaveformHD: DataRequest.GetWaveformHD;
104
+ readonly MenuRoot: MenuRequest.MenuRoot;
105
+ readonly MenuGenre: MenuRequest.MenuGenre;
106
+ readonly MenuArtist: MenuRequest.MenuArtist;
107
+ readonly MenuAlbum: MenuRequest.MenuAlbum;
108
+ readonly MenuTrack: MenuRequest.MenuTrack;
109
+ readonly MenuBPM: MenuRequest.MenuBPM;
110
+ readonly MenuRating: MenuRequest.MenuRating;
111
+ readonly MenuYear: MenuRequest.MenuYear;
112
+ readonly MenuLabel: MenuRequest.MenuLabel;
113
+ readonly MenuColor: MenuRequest.MenuColor;
114
+ readonly MenuTime: MenuRequest.MenuTime;
115
+ readonly MenuBitrate: MenuRequest.MenuBitrate;
116
+ readonly MenuHistory: MenuRequest.MenuHistory;
117
+ readonly MenuFilename: MenuRequest.MenuFilename;
118
+ readonly MenuKey: MenuRequest.MenuKey;
119
+ readonly MenuOriginalArtist: MenuRequest.MenuOriginalArtist;
120
+ readonly MenuRemixer: MenuRequest.MenuRemixer;
121
+ readonly MenuPlaylist: MenuRequest.MenuPlaylist;
122
+ readonly MenuArtistsOfGenre: MenuRequest.MenuArtistsOfGenre;
123
+ readonly MenuAlbumsOfArtist: MenuRequest.MenuAlbumsOfArtist;
124
+ readonly MenuTracksOfAlbum: MenuRequest.MenuTracksOfAlbum;
125
+ readonly MenuTracksOfRating: MenuRequest.MenuTracksOfRating;
126
+ readonly MenuYearsOfDecade: MenuRequest.MenuYearsOfDecade;
127
+ readonly MenuArtistsOfLabel: MenuRequest.MenuArtistsOfLabel;
128
+ readonly MenuTracksOfColor: MenuRequest.MenuTracksOfColor;
129
+ readonly MenuTracksOfTime: MenuRequest.MenuTracksOfTime;
130
+ readonly MenuTracksOfHistory: MenuRequest.MenuTracksOfHistory;
131
+ readonly MenuDistancesOfKey: MenuRequest.MenuDistancesOfKey;
132
+ readonly MenuAlbumsOfOriginalArtist: MenuRequest.MenuAlbumsOfOriginalArtist;
133
+ readonly MenuAlbumsOfRemixer: MenuRequest.MenuAlbumsOfRemixer;
134
+ readonly MenuAlbumsOfGenreAndArtist: MenuRequest.MenuAlbumsOfGenreAndArtist;
135
+ readonly MenuTracksOfArtistAndAlbum: MenuRequest.MenuTracksOfArtistAndAlbum;
136
+ readonly MenuTracksOfBPMPercentRange: MenuRequest.MenuTracksOfBPMPercentRange;
137
+ readonly MenuTracksOfDecadeAndYear: MenuRequest.MenuTracksOfDecadeAndYear;
138
+ readonly MenuAlbumsOfLabelAndArtist: MenuRequest.MenuAlbumsOfLabelAndArtist;
139
+ readonly MenuTracksNearKey: MenuRequest.MenuTracksNearKey;
140
+ readonly MenuTracksOfOriginalArtistAndAlbum: MenuRequest.MenuTracksOfOriginalArtistAndAlbum;
141
+ readonly MenuTracksOfRemixerAndAlbum: MenuRequest.MenuTracksOfRemixerAndAlbum;
142
+ readonly MenuTracksOfGenreArtistAndAlbum: MenuRequest.MenuTracksOfGenreArtistAndAlbum;
143
+ readonly MenuTracksOfLabelArtistAndAlbum: MenuRequest.MenuTracksOfLabelArtistAndAlbum;
144
+ readonly MenuSearch: MenuRequest.MenuSearch;
145
+ readonly MenuFolder: MenuRequest.MenuFolder;
146
+ readonly Introduce: ControlRequest.Introduce;
147
+ readonly Disconnect: ControlRequest.Disconnect;
148
+ readonly RenderMenu: ControlRequest.RenderMenu;
149
+ };
150
+ /**
151
+ * All Known message types. These are used for both request and response messages.
152
+ */
153
+ export type MessageType = ControlRequest | MenuRequest | DataRequest | Response;
154
+ export declare const MessageType: {
155
+ readonly [x: number]: string;
156
+ readonly Success: Response.Success;
157
+ readonly Error: Response.Error;
158
+ readonly Artwork: Response.Artwork;
159
+ readonly MenuItem: Response.MenuItem;
160
+ readonly MenuHeader: Response.MenuHeader;
161
+ readonly MenuFooter: Response.MenuFooter;
162
+ readonly BeatGrid: Response.BeatGrid;
163
+ readonly CueAndLoop: Response.CueAndLoop;
164
+ readonly WaveformPreview: Response.WaveformPreview;
165
+ readonly WaveformDetailed: Response.WaveformDetailed;
166
+ readonly AdvCueAndLoops: Response.AdvCueAndLoops;
167
+ readonly WaveformHD: Response.WaveformHD;
168
+ readonly GetMetadata: DataRequest.GetMetadata;
169
+ readonly GetArtwork: DataRequest.GetArtwork;
170
+ readonly GetWaveformPreview: DataRequest.GetWaveformPreview;
171
+ readonly GetTrackInfo: DataRequest.GetTrackInfo;
172
+ readonly GetGenericMetadata: DataRequest.GetGenericMetadata;
173
+ readonly GetCueAndLoops: DataRequest.GetCueAndLoops;
174
+ readonly GetBeatGrid: DataRequest.GetBeatGrid;
175
+ readonly GetWaveformDetailed: DataRequest.GetWaveformDetailed;
176
+ readonly GetAdvCueAndLoops: DataRequest.GetAdvCueAndLoops;
177
+ readonly GetWaveformHD: DataRequest.GetWaveformHD;
178
+ readonly MenuRoot: MenuRequest.MenuRoot;
179
+ readonly MenuGenre: MenuRequest.MenuGenre;
180
+ readonly MenuArtist: MenuRequest.MenuArtist;
181
+ readonly MenuAlbum: MenuRequest.MenuAlbum;
182
+ readonly MenuTrack: MenuRequest.MenuTrack;
183
+ readonly MenuBPM: MenuRequest.MenuBPM;
184
+ readonly MenuRating: MenuRequest.MenuRating;
185
+ readonly MenuYear: MenuRequest.MenuYear;
186
+ readonly MenuLabel: MenuRequest.MenuLabel;
187
+ readonly MenuColor: MenuRequest.MenuColor;
188
+ readonly MenuTime: MenuRequest.MenuTime;
189
+ readonly MenuBitrate: MenuRequest.MenuBitrate;
190
+ readonly MenuHistory: MenuRequest.MenuHistory;
191
+ readonly MenuFilename: MenuRequest.MenuFilename;
192
+ readonly MenuKey: MenuRequest.MenuKey;
193
+ readonly MenuOriginalArtist: MenuRequest.MenuOriginalArtist;
194
+ readonly MenuRemixer: MenuRequest.MenuRemixer;
195
+ readonly MenuPlaylist: MenuRequest.MenuPlaylist;
196
+ readonly MenuArtistsOfGenre: MenuRequest.MenuArtistsOfGenre;
197
+ readonly MenuAlbumsOfArtist: MenuRequest.MenuAlbumsOfArtist;
198
+ readonly MenuTracksOfAlbum: MenuRequest.MenuTracksOfAlbum;
199
+ readonly MenuTracksOfRating: MenuRequest.MenuTracksOfRating;
200
+ readonly MenuYearsOfDecade: MenuRequest.MenuYearsOfDecade;
201
+ readonly MenuArtistsOfLabel: MenuRequest.MenuArtistsOfLabel;
202
+ readonly MenuTracksOfColor: MenuRequest.MenuTracksOfColor;
203
+ readonly MenuTracksOfTime: MenuRequest.MenuTracksOfTime;
204
+ readonly MenuTracksOfHistory: MenuRequest.MenuTracksOfHistory;
205
+ readonly MenuDistancesOfKey: MenuRequest.MenuDistancesOfKey;
206
+ readonly MenuAlbumsOfOriginalArtist: MenuRequest.MenuAlbumsOfOriginalArtist;
207
+ readonly MenuAlbumsOfRemixer: MenuRequest.MenuAlbumsOfRemixer;
208
+ readonly MenuAlbumsOfGenreAndArtist: MenuRequest.MenuAlbumsOfGenreAndArtist;
209
+ readonly MenuTracksOfArtistAndAlbum: MenuRequest.MenuTracksOfArtistAndAlbum;
210
+ readonly MenuTracksOfBPMPercentRange: MenuRequest.MenuTracksOfBPMPercentRange;
211
+ readonly MenuTracksOfDecadeAndYear: MenuRequest.MenuTracksOfDecadeAndYear;
212
+ readonly MenuAlbumsOfLabelAndArtist: MenuRequest.MenuAlbumsOfLabelAndArtist;
213
+ readonly MenuTracksNearKey: MenuRequest.MenuTracksNearKey;
214
+ readonly MenuTracksOfOriginalArtistAndAlbum: MenuRequest.MenuTracksOfOriginalArtistAndAlbum;
215
+ readonly MenuTracksOfRemixerAndAlbum: MenuRequest.MenuTracksOfRemixerAndAlbum;
216
+ readonly MenuTracksOfGenreArtistAndAlbum: MenuRequest.MenuTracksOfGenreArtistAndAlbum;
217
+ readonly MenuTracksOfLabelArtistAndAlbum: MenuRequest.MenuTracksOfLabelArtistAndAlbum;
218
+ readonly MenuSearch: MenuRequest.MenuSearch;
219
+ readonly MenuFolder: MenuRequest.MenuFolder;
220
+ readonly Introduce: ControlRequest.Introduce;
221
+ readonly Disconnect: ControlRequest.Disconnect;
222
+ readonly RenderMenu: ControlRequest.RenderMenu;
223
+ };
224
+ /**
225
+ * Returns a string representation of a message type
226
+ */
227
+ export declare function getMessageName(type: MessageType): string;
@@ -0,0 +1,99 @@
1
+ import * as entities from "../entities";
2
+ import { TelemetrySpan as Span } from "../utils/telemetry";
3
+ import { Item, ItemType } from './message/item';
4
+ import { Connection, LookupDescriptor, Query } from '.';
5
+ /**
6
+ * This module contains logic for each type of query to understand what
7
+ * arguments are required, and how to transform the resulting Items into
8
+ * something useful.
9
+ */
10
+ interface HandlerOpts<A extends Record<string, unknown> = Record<string, unknown>> {
11
+ conn: Connection;
12
+ lookupDescriptor: LookupDescriptor;
13
+ span: Span;
14
+ args: A;
15
+ }
16
+ type TrackQueryOpts = HandlerOpts<{
17
+ /**
18
+ * The ID of the track to query for
19
+ */
20
+ trackId: number;
21
+ }>;
22
+ /**
23
+ * Lookup track metadata from rekordbox and coerce it into a Track entity
24
+ */
25
+ declare function getMetadata(opts: TrackQueryOpts): Promise<entities.Track<entities.EntityFK.WithRelations>>;
26
+ /**
27
+ * Lookup generic metadata for an unanalyzed track
28
+ */
29
+ declare function getGenericMetadata(opts: TrackQueryOpts): Promise<entities.Track<entities.EntityFK.WithRelations>>;
30
+ /**
31
+ * Lookup the artwork image given the artworkId obtained from a track
32
+ */
33
+ declare function getArtwork(opts: HandlerOpts<{
34
+ artworkId: number;
35
+ }>): Promise<Buffer<ArrayBufferLike>>;
36
+ /**
37
+ * Lookup the beatgrid for the specified trackId
38
+ */
39
+ declare function getBeatgrid(opts: TrackQueryOpts): Promise<import("..").BeatGrid>;
40
+ /**
41
+ * Lookup the waveform preview for the specified trackId
42
+ */
43
+ declare function getWaveformPreview(opts: TrackQueryOpts): Promise<import("..").WaveformPreview>;
44
+ /**
45
+ * Lookup the detailed waveform for the specified trackId
46
+ */
47
+ declare function getWaveformDetailed(opts: TrackQueryOpts): Promise<import("..").WaveformDetailed>;
48
+ /**
49
+ * Lookup the HD (nexus2) waveform for the specified trackId
50
+ */
51
+ declare function getWaveformHD(opts: TrackQueryOpts): Promise<import("..").WaveformHD>;
52
+ /**
53
+ * Lookup the [hot]cue points and [hot]loops for a track
54
+ */
55
+ declare function getCueAndLoops(opts: TrackQueryOpts): Promise<import("..").CueAndLoop[]>;
56
+ /**
57
+ * Lookup the "advanced" (nexus2) [hot]cue points and [hot]loops for a track
58
+ */
59
+ declare function getCueAndLoopsAdv(opts: TrackQueryOpts): Promise<import("..").CueAndLoop[]>;
60
+ /**
61
+ * Lookup the track information, currently just returns the track path
62
+ */
63
+ declare function getTrackInfo(opts: TrackQueryOpts): Promise<string>;
64
+ type PlaylistQueryOpts = HandlerOpts<{
65
+ /**
66
+ * The ID of the playlist to query for. May be left blank to query the root
67
+ * playlist folder.
68
+ */
69
+ id?: number;
70
+ /**
71
+ * When querying for a playlist folder this must be true.
72
+ */
73
+ isFolderRequest: boolean;
74
+ }>;
75
+ /**
76
+ * Lookup playlist entries
77
+ */
78
+ declare function getPlaylist(opts: PlaylistQueryOpts): Promise<{
79
+ folders: entities.Playlist[];
80
+ playlists: entities.Playlist[];
81
+ trackEntries: Item<ItemType.TrackTitle>[];
82
+ }>;
83
+ export declare const queryHandlers: {
84
+ 8194: typeof getMetadata;
85
+ 8195: typeof getArtwork;
86
+ 8196: typeof getWaveformPreview;
87
+ 8450: typeof getTrackInfo;
88
+ 8706: typeof getGenericMetadata;
89
+ 8452: typeof getCueAndLoops;
90
+ 8708: typeof getBeatgrid;
91
+ 10500: typeof getWaveformDetailed;
92
+ 11012: typeof getCueAndLoopsAdv;
93
+ 11268: typeof getWaveformHD;
94
+ 4357: typeof getPlaylist;
95
+ };
96
+ export type Handler<T extends Query> = (typeof queryHandlers)[T];
97
+ export type HandlerArgs<T extends Query> = Parameters<Handler<T>>[0]['args'];
98
+ export type HandlerReturn<T extends Query> = ReturnType<Handler<T>>;
99
+ export {};
@@ -0,0 +1,23 @@
1
+ import { TelemetrySpan as Span } from "../utils/telemetry";
2
+ import { Items, ItemType } from './message/item';
3
+ import { Message } from './message';
4
+ import { Connection, LookupDescriptor } from '.';
5
+ export declare const fieldFromDescriptor: ({ hostDevice, menuTarget, trackSlot, trackType, }: LookupDescriptor) => {
6
+ value: number;
7
+ get buffer(): Buffer<ArrayBuffer>;
8
+ constructor: typeof import("./fields").BaseField;
9
+ data: Buffer;
10
+ };
11
+ export declare const makeRenderMessage: (descriptor: LookupDescriptor, offset: number, count: number, total: number) => Message<import("./message/types").ControlRequest.RenderMenu>;
12
+ /**
13
+ * Async generator to page through menu results after a successful lookup
14
+ * request.
15
+ */
16
+ export declare function renderItems<T extends ItemType = ItemType>(conn: Connection, descriptor: LookupDescriptor, total: number, span: Span): AsyncGenerator<Items[T], void, unknown>;
17
+ declare const colors: readonly [ItemType.ColorNone, ItemType.ColorPink, ItemType.ColorRed, ItemType.ColorOrange, ItemType.ColorYellow, ItemType.ColorGreen, ItemType.ColorAqua, ItemType.ColorBlue, ItemType.ColorPurple];
18
+ type ColorType = (typeof colors)[number];
19
+ /**
20
+ * Locate the color item in an item list
21
+ */
22
+ export declare const findColor: (items: Array<Items[ItemType]>) => Items[ColorType];
23
+ export {};
@@ -0,0 +1,39 @@
1
+ import StrictEventEmitter from 'strict-event-emitter-types';
2
+ import { Socket } from 'dgram';
3
+ import { EventEmitter } from 'events';
4
+ import { CDJStatus, MediaSlotInfo } from "../types";
5
+ import { makeMediaSlotRequest } from './media';
6
+ interface StatusEvents {
7
+ /**
8
+ * Fired each time the CDJ reports its status
9
+ */
10
+ status: (status: CDJStatus.State) => void;
11
+ /**
12
+ * Fired when the CDJ reports its media slot status
13
+ */
14
+ mediaSlot: (info: MediaSlotInfo) => void;
15
+ /**
16
+ * Fired when the mixer broadcasts on-air channel status
17
+ */
18
+ onAir: (status: CDJStatus.OnAirStatus) => void;
19
+ }
20
+ type Emitter = StrictEventEmitter<EventEmitter, StatusEvents>;
21
+ type MediaSlotOptions = Parameters<typeof makeMediaSlotRequest>[0];
22
+ /**
23
+ * The status emitter will report every time a device status is received
24
+ */
25
+ declare class StatusEmitter {
26
+ #private;
27
+ /**
28
+ * @param statusSocket A UDP socket to receive CDJ status packets on
29
+ */
30
+ constructor(statusSocket: Socket);
31
+ on: Emitter['on'];
32
+ off: Emitter['off'];
33
+ once: Emitter['once'];
34
+ /**
35
+ * Retrieve media slot status information.
36
+ */
37
+ queryMediaSlot(options: MediaSlotOptions): Promise<MediaSlotInfo>;
38
+ }
39
+ export default StatusEmitter;
@@ -0,0 +1,22 @@
1
+ import { Device, MediaSlot } from "../types";
2
+ interface Options {
3
+ /**
4
+ * The device asking for media info
5
+ */
6
+ hostDevice: Device;
7
+ /**
8
+ * The target device. This is the device we'll be querying for details of
9
+ * it's media slot.
10
+ */
11
+ device: Device;
12
+ /**
13
+ * The specific slot
14
+ */
15
+ slot: MediaSlot;
16
+ }
17
+ /**
18
+ * Get information about the media connected to the specified slot on the
19
+ * device.
20
+ */
21
+ export declare const makeMediaSlotRequest: ({ hostDevice, device, slot }: Options) => Uint8Array<ArrayBuffer>;
22
+ export {};
@@ -0,0 +1,29 @@
1
+ import StrictEventEmitter from 'strict-event-emitter-types';
2
+ import { Socket } from 'dgram';
3
+ import { EventEmitter } from 'events';
4
+ import { CDJStatus } from "../types";
5
+ interface PositionEvents {
6
+ /**
7
+ * Fired when an absolute position packet is received from a CDJ-3000+.
8
+ * These packets are sent approximately every 30ms while a track is loaded.
9
+ */
10
+ position: (position: CDJStatus.PositionState) => void;
11
+ }
12
+ type Emitter = StrictEventEmitter<EventEmitter, PositionEvents>;
13
+ /**
14
+ * The position emitter reports absolute playhead position updates from CDJ-3000+ devices.
15
+ * These packets provide precise track position independent of beat grids, enabling
16
+ * accurate timecode, lighting cue, and video synchronization even during scratching,
17
+ * reverse play, loops, and needle jumps.
18
+ */
19
+ declare class PositionEmitter {
20
+ #private;
21
+ /**
22
+ * @param beatSocket A UDP socket to receive position packets on port 50001
23
+ */
24
+ constructor(beatSocket: Socket);
25
+ on: Emitter['on'];
26
+ off: Emitter['off'];
27
+ once: Emitter['once'];
28
+ }
29
+ export default PositionEmitter;
@@ -0,0 +1,170 @@
1
+ import { DeviceID, MediaSlot, TrackType } from "../types";
2
+ /**
3
+ * Status flag bitmasks
4
+ */
5
+ export declare enum StatusFlag {
6
+ OnAir = 8,
7
+ Sync = 16,
8
+ Master = 32,
9
+ Playing = 64
10
+ }
11
+ /**
12
+ * Play state flags
13
+ */
14
+ export declare enum PlayState {
15
+ Empty = 0,
16
+ Loading = 2,
17
+ Playing = 3,
18
+ Looping = 4,
19
+ Paused = 5,
20
+ Cued = 6,
21
+ Cuing = 7,
22
+ PlatterHeld = 8,
23
+ Searching = 9,
24
+ SpunDown = 14,
25
+ Ended = 17
26
+ }
27
+ /**
28
+ * Represents various details about the current state of the CDJ.
29
+ */
30
+ export interface State {
31
+ /**
32
+ * The device reporting this status.
33
+ */
34
+ deviceId: number;
35
+ /**
36
+ * The ID of the track loaded on the device.
37
+ *
38
+ * 0 When no track is loaded.
39
+ */
40
+ trackId: number;
41
+ /**
42
+ * The device ID the track is loaded from.
43
+ *
44
+ * For example if you have two CDJs and you've loaded a track over the 'LINK',
45
+ * this will be the ID of the player with the USB media device connected to it.
46
+ */
47
+ trackDeviceId: DeviceID;
48
+ /**
49
+ * The MediaSlot the track is loaded from. For example a SD card or USB device.
50
+ */
51
+ trackSlot: MediaSlot;
52
+ /**
53
+ * The TrackType of the track, for example a CD or Rekordbox analyzed track.
54
+ */
55
+ trackType: TrackType;
56
+ /**
57
+ * The current play state of the CDJ.
58
+ */
59
+ playState: PlayState;
60
+ /**
61
+ * Whether the CDJ is currently reporting itself as 'on-air'.
62
+ *
63
+ * This is indicated by the red ring around the platter on the CDJ Nexus models.
64
+ * A DJM mixer must be ont he network for the CDJ to report this as true.
65
+ */
66
+ isOnAir: boolean;
67
+ /**
68
+ * Whether the CDJ is synced.
69
+ */
70
+ isSync: boolean;
71
+ /**
72
+ * Whether the CDJ is the master player.
73
+ */
74
+ isMaster: boolean;
75
+ /**
76
+ * Whether the CDJ is in an emergency state (emergecy loop / emergency mode
77
+ * on newer players)
78
+ */
79
+ isEmergencyMode: boolean;
80
+ /**
81
+ * The BPM of the loaded track. null if no track is loaded or the BPM is unknown.
82
+ */
83
+ trackBPM: number | null;
84
+ /**
85
+ * The "effective" pitch of the plyaer. This is reported anytime the jogwheel is
86
+ * nudged, the CDJ spins down by pausing with the vinyl stop knob not at 0, or
87
+ * by holding the platter.
88
+ */
89
+ effectivePitch: number;
90
+ /**
91
+ * The current slider pitch
92
+ */
93
+ sliderPitch: number;
94
+ /**
95
+ * The current beat within the measure. 1-4. 0 when no track is loaded.
96
+ */
97
+ beatInMeasure: number;
98
+ /**
99
+ * Number of beats remaining until the next cue point is reached. Null if there
100
+ * is no next cue point
101
+ */
102
+ beatsUntilCue: number | null;
103
+ /**
104
+ * The beat 'timestamp' of the track. Can be used to compute absolute track time
105
+ * given the slider pitch.
106
+ */
107
+ beat: number | null;
108
+ /**
109
+ * A counter that increments for every status packet sent.
110
+ */
111
+ packetNum: number;
112
+ }
113
+ /**
114
+ * Absolute position information from CDJ-3000+ devices.
115
+ * Sent every 30ms on port 50001 while a track is loaded.
116
+ * Provides precise playhead position independent of beat grid.
117
+ */
118
+ export interface PositionState {
119
+ /**
120
+ * The device ID sending this position update.
121
+ */
122
+ deviceId: number;
123
+ /**
124
+ * Track length in seconds (rounded down to nearest second).
125
+ */
126
+ trackLength: number;
127
+ /**
128
+ * Absolute playhead position in milliseconds.
129
+ */
130
+ playhead: number;
131
+ /**
132
+ * Pitch slider value as shown on screen.
133
+ * For example, 3.26% is represented as 3.26.
134
+ */
135
+ pitch: number;
136
+ /**
137
+ * Effective BPM (track BPM adjusted by pitch) as shown on screen.
138
+ * null if BPM is unknown.
139
+ */
140
+ bpm: number | null;
141
+ }
142
+ /**
143
+ * On-Air status from DJM mixer.
144
+ * Broadcast by the mixer to indicate which channels are currently audible.
145
+ * Supports both 4-channel (DJM-900/1000) and 6-channel (DJM-V10) mixers.
146
+ */
147
+ export interface OnAirStatus {
148
+ /**
149
+ * The mixer device ID (typically 33 / 0x21).
150
+ */
151
+ deviceId: number;
152
+ /**
153
+ * On-air flags for channels 1-4 (always present).
154
+ * 0x00 = channel is off-air (silenced)
155
+ * 0x01 = channel is on-air (audible)
156
+ */
157
+ channels: {
158
+ 1: boolean;
159
+ 2: boolean;
160
+ 3: boolean;
161
+ 4: boolean;
162
+ 5?: boolean;
163
+ 6?: boolean;
164
+ };
165
+ /**
166
+ * Whether this is a 6-channel variant (CDJ-3000 + DJM-V10).
167
+ * Determined by packet subtype (0x00 = 4-channel, 0x03 = 6-channel).
168
+ */
169
+ isSixChannel: boolean;
170
+ }
@@ -0,0 +1,19 @@
1
+ import { CDJStatus, MediaSlotInfo } from "../types";
2
+ export declare function statusFromPacket(packet: Buffer): CDJStatus.State | undefined;
3
+ export declare function mediaSlotFromPacket(packet: Buffer): MediaSlotInfo | undefined;
4
+ /**
5
+ * Parse absolute position packet from CDJ-3000+ devices.
6
+ * These packets are sent every 30ms on port 50001 while a track is loaded.
7
+ * Packet structure: subtype 0x00, lenr varies based on device.
8
+ */
9
+ export declare function positionFromPacket(packet: Buffer): CDJStatus.PositionState | undefined;
10
+ /**
11
+ * Parse on-air status packet from DJM mixer.
12
+ * The mixer broadcasts which channels are currently audible.
13
+ * Supports both 4-channel (subtype 0x00) and 6-channel (subtype 0x03) variants.
14
+ *
15
+ * Packet structure:
16
+ * - 4-channel: subtype 0x00, length 0x0009 (9 data bytes: F1 F2 F3 F4 00 00 00 00 00)
17
+ * - 6-channel: subtype 0x03, length 0x0011 (17 data bytes: F1 F2 F3 F4 00 00 00 00 00 F5 F6 00 30 00 00 00 00 00)
18
+ */
19
+ export declare function onAirFromPacket(packet: Buffer): CDJStatus.OnAirStatus | undefined;