This repository has been archived by the owner on Apr 3, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
OutgoingPayloads.ts
378 lines (318 loc) · 7.45 KB
/
OutgoingPayloads.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
import type { VoiceServerUpdate } from '../base/BaseNode';
export type OutgoingPayload =
| OutgoingDestroyPayload
| OutgoingEqualizerPayload
| OutgoingPausePayload
| OutgoingPlayPayload
| OutgoingSeekPayload
| OutgoingStopPayload
| OutgoingVoiceUpdatePayload
| OutgoingVolumePayload
| OutgoingConfigureResumingPayload
| OutgoingFilterPayload;
export interface BaseOutgoingPayload {
/**
* The guild's ID to identify the player.
*/
guildId: string;
}
export interface OutgoingDestroyPayload extends BaseOutgoingPayload {
op: 'destroy';
}
export interface OutgoingStopPayload extends BaseOutgoingPayload {
op: 'stop';
}
export interface OutgoingSeekPayload extends BaseOutgoingPayload {
op: 'seek';
/**
* The offset in milliseconds to play the current track from.
*/
position: number;
}
export interface OutgoingPausePayload extends BaseOutgoingPayload {
op: 'pause';
/**
* Whether or not the player should be paused.
*/
pause: boolean;
}
export interface OutgoingPlayPayload extends BaseOutgoingPayload {
op: 'play';
/**
* The track to be played.
*/
track: string;
/**
* If set to true, this operation will be ignored if a track is already playing or paused.
*/
noReplace?: boolean;
/**
* Determines the number of milliseconds to offset the track by. Defaults to 0.
*/
startTime?: number;
/**
* Determines at the number of milliseconds at which point the track should stop playing. Helpful if you only want
* to play a snippet of a bigger track. By default the track plays until it's end as per the encoded data.
*/
endTime?: number;
/**
* If set to true, the playback will be paused.
*/
pause?: boolean;
}
export interface OutgoingVoiceUpdatePayload extends BaseOutgoingPayload {
op: 'voiceUpdate';
/**
* The voice channel's session ID.
*/
sessionId: string;
/**
* The raw event data from Discord.
*/
event: VoiceServerUpdate;
}
export interface OutgoingVolumePayload extends BaseOutgoingPayload {
op: 'volume';
/**
* The volume to be set.
* @default 100
* @range [0, 1000]
*/
volume: number;
}
export interface EqualizerBand {
/**
* The band to be changed, ranges from 0 to 14 inclusive.
* @range [0, 14]
*/
band: number;
/**
* The multiplier of the band. Valid values range from -0.25 to 1.0, where -0.25 means the given band is
* completely muted, and 0.25 means it is doubled. Modifying the gain could also change the volume of the output.
* @default 0
* @range [-0.25, 1]
*/
gain: number;
}
export interface OutgoingEqualizerPayload extends BaseOutgoingPayload {
op: 'equalizer';
/**
* The bands to be set.
*/
bands: readonly EqualizerBand[];
}
export interface OutgoingConfigureResumingPayload {
op: 'configureResuming';
/**
* The string you will need to send when resuming the session. Set to null to disable resuming altogether.
*/
key?: string | null;
/**
* The number of seconds after disconnecting before the session is closed anyways.
* This is useful for avoiding accidental leaks.
*/
timeout?: number;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface OutgoingFilterPayload extends BaseOutgoingPayload {
op: 'filters';
/**
* The volume to set the track. Valid values range from 0 to 5.0, where 0 means the stream is completely muted, and
* 2 means it is doubled.
* @range [0, 5]
*/
volume?: number;
/**
* The equalizer bands, there are 15 bands (0-14) that can be changed.
*/
equalizer?: readonly EqualizerBand[];
/**
* The karaoke options, uses equalization to eliminate a part of a band, usually targeting vocals.
*/
karaoke?: KaraokeOptions;
/**
* The timescale options, used to change the speed, pitch, and rate.
*/
timescale?: TimescaleOptions;
/**
* The tremolo options, uses amplification to create a shuddering effect, where the volume quickly oscillates,
* {@link https://en.wikipedia.org/wiki/File:Fuse_Electronics_Tremolo_MK-III_Quick_Demo.ogv example}.
*/
tremolo?: FrequencyDepthOptions;
/**
* The vibrato options. Similar to tremolo, while tremolo oscillates the volume, vibrato oscillates the pitch.
*/
vibrato?: FrequencyDepthOptions;
/**
* The distortion options.
*/
distortion?: DistortionOptions;
/**
* The rotation options. This rotates the sound around the stereo channels/user headphones, also known as
* {@link https://en.wikipedia.org/wiki/Panning_(audio) Audio Panning}.
*/
rotation?: RotationOptions;
/**
* The channel mix options.
*/
channelMix?: ChannelMixOptions;
/**
* The low pass options.
*/
lowPass?: LowPassOptions;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface KaraokeOptions {
/**
* The level.
* @default 1.0
*/
level?: number;
/**
* The mono level.
* @default 1.0
*/
monoLevel?: number;
/**
* The band to filter.
* @default 220.0
*/
filterBand?: number;
/**
* The width of the frequencies to filter.
* @default 100.0
*/
filterWidth?: number;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface TimescaleOptions {
/**
* The speed of the track. Must be >=0.
* @default 1.0
*/
speed?: number;
/**
* The pitch of the track. Must be >=0.
* @default 1.0
*/
pitch?: number;
/**
* The rate of the track. Must be >=0.
* @default 1.0
*/
rate?: number;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface FrequencyDepthOptions {
/**
* The frequency to edit. Must be >0 and <=14.
* @default 2.0
*/
frequency?: number;
/**
* The depth for the selected frequency. Must be >0 and <=1.
* @default 0.5
*/
depth?: number;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface DistortionOptions {
/**
* The sine's offset.
* @default 0.0
*/
sinOffset?: number;
/**
* The sine's scale.
* @default 1.0
*/
sinScale?: number;
/**
* The cosine's offset.
* @default 0.0
*/
cosOffset?: number;
/**
* The cosine's scale.
* @default 1.0
*/
cosScale?: number;
/**
* The tangent offset.
* @default 0.0
*/
tanOffset?: number;
/**
* The tangent scale.
* @default 1.0
*/
tanScale?: number;
/**
* The overall offset for all waves.
* @default 0.0
*/
offset?: number;
/**
* The overall scale for all waves.
* @default 1.0
*/
scale?: number;
}
/**
* @note This is not available in Lavalink v3.3.
*/
export interface RotationOptions {
/**
* The frequency in Hz to rotate.
* @default 2.0
*/
rotationHz?: number;
}
/**
* Mixes both channels (left and right), with a configurable factor on how much each channel affects the other.
* With the defaults, both channels are kept independent from each other.
* @note Setting all factors to 0.5 means both channels get the same audio.
* @note This is not available in Lavalink v3.3.
*/
export interface ChannelMixOptions {
/**
* The left-to-left mix, modifies the volume in the left channel.
* @default 1.0
*/
leftToLeft: number;
/**
* The left-to-right mix, modifies how much of the left channel goes to the right one.
* @default 0.0
*/
leftToRight: number;
/**
* The right-to-left mix, modifies how much of the right channel goes to the left one.
* @default 0.0
*/
rightToLeft: number;
/**
* The right-to-right mix, modifies the volume in the right channel.
* @default 1.0
*/
rightToRight: number;
}
/**
* Supresses high frequencies given a frequency.
* @note This is not available in Lavalink v3.3.
*/
export interface LowPassOptions {
/**
* The amount of smoothing done.
*/
smoothing: number;
}