magmastream 2.10.3-alpha.5 → 2.10.3-alpha.7
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/dist/structures/Enums.d.ts +52 -0
- package/dist/structures/Enums.js +54 -1
- package/dist/structures/Filters.d.ts +85 -2
- package/dist/structures/Filters.js +254 -15
- package/dist/structures/Manager.d.ts +6 -0
- package/dist/structures/Manager.js +95 -7
- package/dist/structures/Node.d.ts +74 -1
- package/dist/structures/Node.js +268 -25
- package/dist/structures/Player.d.ts +69 -2
- package/dist/structures/Player.js +210 -12
- package/dist/structures/Rest.d.ts +1 -0
- package/dist/structures/Rest.js +47 -2
- package/dist/structures/Types.d.ts +282 -19
- package/dist/structures/Utils.d.ts +1 -1
- package/dist/structures/Utils.js +42 -9
- package/dist/utils/managerCheck.js +3 -2
- package/package.json +1 -1
|
@@ -43,6 +43,8 @@ export declare enum LoadTypes {
|
|
|
43
43
|
/** Nodelink */
|
|
44
44
|
Artist = "artist",
|
|
45
45
|
/** Nodelink */
|
|
46
|
+
Episode = "episode",
|
|
47
|
+
/** Nodelink */
|
|
46
48
|
Station = "station",
|
|
47
49
|
/** Nodelink */
|
|
48
50
|
Podcast = "podcast",
|
|
@@ -70,6 +72,42 @@ export declare enum SearchPlatform {
|
|
|
70
72
|
YouTube = "ytsearch",
|
|
71
73
|
YouTubeMusic = "ytmsearch"
|
|
72
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* NodeLink-only Search Platform Enum
|
|
77
|
+
*/
|
|
78
|
+
export declare enum NodeLinkSearchPlatform {
|
|
79
|
+
AmazonMusic = "amazonmusic",
|
|
80
|
+
AmazonMusicSearch = "azsearch",
|
|
81
|
+
Anghami = "agsearch",
|
|
82
|
+
Audiomack = "audiomack",
|
|
83
|
+
AudiomackSearch = "admsearch",
|
|
84
|
+
Audius = "ausearch",
|
|
85
|
+
Bilibili = "bilibili",
|
|
86
|
+
BilibiliSearch = "bilisearch",
|
|
87
|
+
Bluesky = "bksearch",
|
|
88
|
+
Flowery = "flowery",
|
|
89
|
+
FloweryTTS = "ftts",
|
|
90
|
+
Gaana = "gaanasearch",
|
|
91
|
+
GaanaSearch = "gnsearch",
|
|
92
|
+
GoogleDrive = "gdsearch",
|
|
93
|
+
GoogleTTS = "gtts",
|
|
94
|
+
IHeartRadio = "iheartradio",
|
|
95
|
+
IHeartRadioSearch = "ihsearch",
|
|
96
|
+
LastFM = "lfsearch",
|
|
97
|
+
LazyTTS = "lazypytts",
|
|
98
|
+
LazyTTSAlt = "lazytts",
|
|
99
|
+
LetrasMus = "lmsearch",
|
|
100
|
+
Mixcloud = "mixcloud",
|
|
101
|
+
MixcloudSearch = "mcsearch",
|
|
102
|
+
Netease = "ntsearch",
|
|
103
|
+
NicoVideo = "nicovideo",
|
|
104
|
+
NicoVideoSearch = "ncsearch",
|
|
105
|
+
Pandora = "pdsearch",
|
|
106
|
+
PiperTTS = "pipertts",
|
|
107
|
+
Shazam = "shsearch",
|
|
108
|
+
ShazamAlt = "szsearch",
|
|
109
|
+
SongLink = "slsearch"
|
|
110
|
+
}
|
|
73
111
|
/**
|
|
74
112
|
* Player State Event Types Enum
|
|
75
113
|
*/
|
|
@@ -190,6 +228,10 @@ export declare enum ManagerEventTypes {
|
|
|
190
228
|
TrackStart = "trackStart",
|
|
191
229
|
TrackStuck = "trackStuck",
|
|
192
230
|
/** Nodelink */
|
|
231
|
+
MixStarted = "mixStarted",
|
|
232
|
+
/** Nodelink */
|
|
233
|
+
MixEnded = "mixEnded",
|
|
234
|
+
/** Nodelink */
|
|
193
235
|
VoiceReceiverDisconnect = "voiceReceiverDisconnect",
|
|
194
236
|
/** Nodelink */
|
|
195
237
|
VoiceReceiverConnect = "voiceReceiverConnect",
|
|
@@ -251,11 +293,21 @@ export declare enum AvailableFilters {
|
|
|
251
293
|
Pop = "pop",
|
|
252
294
|
Radio = "radio",
|
|
253
295
|
PluginFilters = "pluginFilters",
|
|
296
|
+
SetChorus = "setChorus",
|
|
254
297
|
SetChannelMix = "setChannelMix",
|
|
298
|
+
SetCompressor = "setCompressor",
|
|
255
299
|
SetDistortion = "setDistortion",
|
|
300
|
+
SetEcho = "setEcho",
|
|
301
|
+
SetFlanger = "setFlanger",
|
|
302
|
+
SetHighPass = "setHighPass",
|
|
256
303
|
SetKaraoke = "setKaraoke",
|
|
257
304
|
SetLowPass = "setLowPass",
|
|
305
|
+
SetPhaser = "setPhaser",
|
|
306
|
+
SetPhonograph = "setPhonograph",
|
|
307
|
+
SetReverb = "setReverb",
|
|
258
308
|
SetRotation = "setRotation",
|
|
309
|
+
SetSpatial = "setSpatial",
|
|
310
|
+
SetTape = "setTape",
|
|
259
311
|
SetTimescale = "setTimescale",
|
|
260
312
|
SetTremolo = "setTremolo",
|
|
261
313
|
Slowmo = "slowmo",
|
package/dist/structures/Enums.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MagmaStreamErrorNumbers = exports.MagmaStreamErrorCode = exports.AvailableFilters = exports.SponsorBlockSegment = exports.SeverityTypes = exports.TrackEndReasonTypes = exports.ManagerEventTypes = exports.TrackPartial = exports.UseNodeOptions = exports.TrackSourceTypes = exports.PlayerStateEventTypes = exports.SearchPlatform = exports.LoadTypes = exports.StateTypes = exports.AutoPlayPlatform = exports.StateStorageType = void 0;
|
|
3
|
+
exports.MagmaStreamErrorNumbers = exports.MagmaStreamErrorCode = exports.AvailableFilters = exports.SponsorBlockSegment = exports.SeverityTypes = exports.TrackEndReasonTypes = exports.ManagerEventTypes = exports.TrackPartial = exports.UseNodeOptions = exports.TrackSourceTypes = exports.PlayerStateEventTypes = exports.NodeLinkSearchPlatform = exports.SearchPlatform = exports.LoadTypes = exports.StateTypes = exports.AutoPlayPlatform = exports.StateStorageType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* State Storage Enum
|
|
6
6
|
*/
|
|
@@ -50,6 +50,8 @@ var LoadTypes;
|
|
|
50
50
|
/** Nodelink */
|
|
51
51
|
LoadTypes["Artist"] = "artist";
|
|
52
52
|
/** Nodelink */
|
|
53
|
+
LoadTypes["Episode"] = "episode";
|
|
54
|
+
/** Nodelink */
|
|
53
55
|
LoadTypes["Station"] = "station";
|
|
54
56
|
/** Nodelink */
|
|
55
57
|
LoadTypes["Podcast"] = "podcast";
|
|
@@ -78,6 +80,43 @@ var SearchPlatform;
|
|
|
78
80
|
SearchPlatform["YouTube"] = "ytsearch";
|
|
79
81
|
SearchPlatform["YouTubeMusic"] = "ytmsearch";
|
|
80
82
|
})(SearchPlatform || (exports.SearchPlatform = SearchPlatform = {}));
|
|
83
|
+
/**
|
|
84
|
+
* NodeLink-only Search Platform Enum
|
|
85
|
+
*/
|
|
86
|
+
var NodeLinkSearchPlatform;
|
|
87
|
+
(function (NodeLinkSearchPlatform) {
|
|
88
|
+
NodeLinkSearchPlatform["AmazonMusic"] = "amazonmusic";
|
|
89
|
+
NodeLinkSearchPlatform["AmazonMusicSearch"] = "azsearch";
|
|
90
|
+
NodeLinkSearchPlatform["Anghami"] = "agsearch";
|
|
91
|
+
NodeLinkSearchPlatform["Audiomack"] = "audiomack";
|
|
92
|
+
NodeLinkSearchPlatform["AudiomackSearch"] = "admsearch";
|
|
93
|
+
NodeLinkSearchPlatform["Audius"] = "ausearch";
|
|
94
|
+
NodeLinkSearchPlatform["Bilibili"] = "bilibili";
|
|
95
|
+
NodeLinkSearchPlatform["BilibiliSearch"] = "bilisearch";
|
|
96
|
+
NodeLinkSearchPlatform["Bluesky"] = "bksearch";
|
|
97
|
+
NodeLinkSearchPlatform["Flowery"] = "flowery";
|
|
98
|
+
NodeLinkSearchPlatform["FloweryTTS"] = "ftts";
|
|
99
|
+
NodeLinkSearchPlatform["Gaana"] = "gaanasearch";
|
|
100
|
+
NodeLinkSearchPlatform["GaanaSearch"] = "gnsearch";
|
|
101
|
+
NodeLinkSearchPlatform["GoogleDrive"] = "gdsearch";
|
|
102
|
+
NodeLinkSearchPlatform["GoogleTTS"] = "gtts";
|
|
103
|
+
NodeLinkSearchPlatform["IHeartRadio"] = "iheartradio";
|
|
104
|
+
NodeLinkSearchPlatform["IHeartRadioSearch"] = "ihsearch";
|
|
105
|
+
NodeLinkSearchPlatform["LastFM"] = "lfsearch";
|
|
106
|
+
NodeLinkSearchPlatform["LazyTTS"] = "lazypytts";
|
|
107
|
+
NodeLinkSearchPlatform["LazyTTSAlt"] = "lazytts";
|
|
108
|
+
NodeLinkSearchPlatform["LetrasMus"] = "lmsearch";
|
|
109
|
+
NodeLinkSearchPlatform["Mixcloud"] = "mixcloud";
|
|
110
|
+
NodeLinkSearchPlatform["MixcloudSearch"] = "mcsearch";
|
|
111
|
+
NodeLinkSearchPlatform["Netease"] = "ntsearch";
|
|
112
|
+
NodeLinkSearchPlatform["NicoVideo"] = "nicovideo";
|
|
113
|
+
NodeLinkSearchPlatform["NicoVideoSearch"] = "ncsearch";
|
|
114
|
+
NodeLinkSearchPlatform["Pandora"] = "pdsearch";
|
|
115
|
+
NodeLinkSearchPlatform["PiperTTS"] = "pipertts";
|
|
116
|
+
NodeLinkSearchPlatform["Shazam"] = "shsearch";
|
|
117
|
+
NodeLinkSearchPlatform["ShazamAlt"] = "szsearch";
|
|
118
|
+
NodeLinkSearchPlatform["SongLink"] = "slsearch";
|
|
119
|
+
})(NodeLinkSearchPlatform || (exports.NodeLinkSearchPlatform = NodeLinkSearchPlatform = {}));
|
|
81
120
|
/**
|
|
82
121
|
* Player State Event Types Enum
|
|
83
122
|
*/
|
|
@@ -203,6 +242,10 @@ var ManagerEventTypes;
|
|
|
203
242
|
ManagerEventTypes["TrackStart"] = "trackStart";
|
|
204
243
|
ManagerEventTypes["TrackStuck"] = "trackStuck";
|
|
205
244
|
/** Nodelink */
|
|
245
|
+
ManagerEventTypes["MixStarted"] = "mixStarted";
|
|
246
|
+
/** Nodelink */
|
|
247
|
+
ManagerEventTypes["MixEnded"] = "mixEnded";
|
|
248
|
+
/** Nodelink */
|
|
206
249
|
ManagerEventTypes["VoiceReceiverDisconnect"] = "voiceReceiverDisconnect";
|
|
207
250
|
/** Nodelink */
|
|
208
251
|
ManagerEventTypes["VoiceReceiverConnect"] = "voiceReceiverConnect";
|
|
@@ -268,11 +311,21 @@ var AvailableFilters;
|
|
|
268
311
|
AvailableFilters["Pop"] = "pop";
|
|
269
312
|
AvailableFilters["Radio"] = "radio";
|
|
270
313
|
AvailableFilters["PluginFilters"] = "pluginFilters";
|
|
314
|
+
AvailableFilters["SetChorus"] = "setChorus";
|
|
271
315
|
AvailableFilters["SetChannelMix"] = "setChannelMix";
|
|
316
|
+
AvailableFilters["SetCompressor"] = "setCompressor";
|
|
272
317
|
AvailableFilters["SetDistortion"] = "setDistortion";
|
|
318
|
+
AvailableFilters["SetEcho"] = "setEcho";
|
|
319
|
+
AvailableFilters["SetFlanger"] = "setFlanger";
|
|
320
|
+
AvailableFilters["SetHighPass"] = "setHighPass";
|
|
273
321
|
AvailableFilters["SetKaraoke"] = "setKaraoke";
|
|
274
322
|
AvailableFilters["SetLowPass"] = "setLowPass";
|
|
323
|
+
AvailableFilters["SetPhaser"] = "setPhaser";
|
|
324
|
+
AvailableFilters["SetPhonograph"] = "setPhonograph";
|
|
325
|
+
AvailableFilters["SetReverb"] = "setReverb";
|
|
275
326
|
AvailableFilters["SetRotation"] = "setRotation";
|
|
327
|
+
AvailableFilters["SetSpatial"] = "setSpatial";
|
|
328
|
+
AvailableFilters["SetTape"] = "setTape";
|
|
276
329
|
AvailableFilters["SetTimescale"] = "setTimescale";
|
|
277
330
|
AvailableFilters["SetTremolo"] = "setTremolo";
|
|
278
331
|
AvailableFilters["Slowmo"] = "slowmo";
|
|
@@ -2,8 +2,9 @@ import { Band } from "../utils/filtersEqualizers";
|
|
|
2
2
|
import { AvailableFilters } from "./Enums";
|
|
3
3
|
import { Manager } from "./Manager";
|
|
4
4
|
import { Player } from "./Player";
|
|
5
|
-
import { ChannelMixOptions, DistortionOptions, KaraokeOptions, LowPassOptions, ReverbOptions, RotationOptions, TimescaleOptions, TremoloOptions, VibratoOptions } from "./Types";
|
|
5
|
+
import { ChannelMixOptions, ChorusOptions, CompressorOptions, DistortionOptions, EchoOptions, FlangerOptions, HighPassOptions, KaraokeOptions, LowPassOptions, PhaserOptions, PhonographOptions, ReverbOptions, RotationOptions, SpatialOptions, TapeOptions, TimescaleOptions, TremoloOptions, VibratoOptions } from "./Types";
|
|
6
6
|
export declare class Filters {
|
|
7
|
+
private static readonly defaultPluginFilterPlugins;
|
|
7
8
|
distortion: DistortionOptions | null;
|
|
8
9
|
equalizer: Band[];
|
|
9
10
|
karaoke: KaraokeOptions | null;
|
|
@@ -13,6 +14,15 @@ export declare class Filters {
|
|
|
13
14
|
vibrato: VibratoOptions | null;
|
|
14
15
|
channelMix: ChannelMixOptions | null;
|
|
15
16
|
lowPass: LowPassOptions | null;
|
|
17
|
+
highpass: HighPassOptions | null;
|
|
18
|
+
echo: EchoOptions | null;
|
|
19
|
+
chorus: ChorusOptions | null;
|
|
20
|
+
compressor: CompressorOptions | null;
|
|
21
|
+
flanger: FlangerOptions | null;
|
|
22
|
+
phaser: PhaserOptions | null;
|
|
23
|
+
phonograph: PhonographOptions | null;
|
|
24
|
+
spatial: SpatialOptions | null;
|
|
25
|
+
tape: TapeOptions | null;
|
|
16
26
|
pluginFilters: Record<string, unknown>;
|
|
17
27
|
reverb: ReverbOptions | null;
|
|
18
28
|
volume: number;
|
|
@@ -46,6 +56,8 @@ export declare class Filters {
|
|
|
46
56
|
*/
|
|
47
57
|
private applyFilter;
|
|
48
58
|
private emitPlayersTasteUpdate;
|
|
59
|
+
private assertPluginFiltersSupported;
|
|
60
|
+
private assertNodeLinkExtraFilterSupported;
|
|
49
61
|
/**
|
|
50
62
|
* Sets the status of a specific filter.
|
|
51
63
|
*
|
|
@@ -137,13 +149,84 @@ export declare class Filters {
|
|
|
137
149
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
138
150
|
*/
|
|
139
151
|
setLowPass(lowPass?: LowPassOptions): Promise<this>;
|
|
152
|
+
/**
|
|
153
|
+
* Sets the NodeLink high pass filter options on the audio.
|
|
154
|
+
* @param {HighPassOptions} [highpass] - The high pass settings to apply.
|
|
155
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
156
|
+
*/
|
|
157
|
+
setHighPass(highpass?: HighPassOptions): Promise<this>;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the NodeLink echo filter options on the audio.
|
|
160
|
+
* @param {EchoOptions} [echo] - The echo settings to apply.
|
|
161
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
162
|
+
*/
|
|
163
|
+
setEcho(echo?: EchoOptions): Promise<this>;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the NodeLink reverb filter options on the audio.
|
|
166
|
+
* @param {ReverbOptions} [reverb] - The reverb settings to apply.
|
|
167
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
168
|
+
*/
|
|
169
|
+
setReverb(reverb?: ReverbOptions): Promise<this>;
|
|
170
|
+
/**
|
|
171
|
+
* Sets the NodeLink chorus filter options on the audio.
|
|
172
|
+
* @param {ChorusOptions} [chorus] - The chorus settings to apply.
|
|
173
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
174
|
+
*/
|
|
175
|
+
setChorus(chorus?: ChorusOptions): Promise<this>;
|
|
176
|
+
/**
|
|
177
|
+
* Sets the NodeLink compressor filter options on the audio.
|
|
178
|
+
* @param {CompressorOptions} [compressor] - The compressor settings to apply.
|
|
179
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
180
|
+
*/
|
|
181
|
+
setCompressor(compressor?: CompressorOptions): Promise<this>;
|
|
182
|
+
/**
|
|
183
|
+
* Sets the NodeLink flanger filter options on the audio.
|
|
184
|
+
* @param {FlangerOptions} [flanger] - The flanger settings to apply.
|
|
185
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
186
|
+
*/
|
|
187
|
+
setFlanger(flanger?: FlangerOptions): Promise<this>;
|
|
188
|
+
/**
|
|
189
|
+
* Sets the NodeLink phaser filter options on the audio.
|
|
190
|
+
* @param {PhaserOptions} [phaser] - The phaser settings to apply.
|
|
191
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
192
|
+
*/
|
|
193
|
+
setPhaser(phaser?: PhaserOptions): Promise<this>;
|
|
194
|
+
/**
|
|
195
|
+
* Sets the NodeLink phonograph filter options on the audio.
|
|
196
|
+
* @param {PhonographOptions} [phonograph] - The phonograph settings to apply.
|
|
197
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
198
|
+
*/
|
|
199
|
+
setPhonograph(phonograph?: PhonographOptions): Promise<this>;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the NodeLink spatial filter options on the audio.
|
|
202
|
+
* @param {SpatialOptions} [spatial] - The spatial settings to apply.
|
|
203
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
204
|
+
*/
|
|
205
|
+
setSpatial(spatial?: SpatialOptions): Promise<this>;
|
|
206
|
+
/**
|
|
207
|
+
* Sets the NodeLink tape filter options on the audio.
|
|
208
|
+
* @param {TapeOptions} [tape] - The tape settings to apply.
|
|
209
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
210
|
+
*/
|
|
211
|
+
setTape(tape?: TapeOptions): Promise<this>;
|
|
212
|
+
setNodeLinkHighPass(highpass?: HighPassOptions): Promise<this>;
|
|
213
|
+
setNodeLinkEcho(echo?: EchoOptions): Promise<this>;
|
|
214
|
+
setNodeLinkReverb(reverb?: ReverbOptions): Promise<this>;
|
|
215
|
+
setNodeLinkChorus(chorus?: ChorusOptions): Promise<this>;
|
|
216
|
+
setNodeLinkCompressor(compressor?: CompressorOptions): Promise<this>;
|
|
217
|
+
setNodeLinkFlanger(flanger?: FlangerOptions): Promise<this>;
|
|
218
|
+
setNodeLinkPhaser(phaser?: PhaserOptions): Promise<this>;
|
|
219
|
+
setNodeLinkPhonograph(phonograph?: PhonographOptions): Promise<this>;
|
|
220
|
+
setNodeLinkSpatial(spatial?: SpatialOptions): Promise<this>;
|
|
221
|
+
setNodeLinkTape(tape?: TapeOptions): Promise<this>;
|
|
140
222
|
/**
|
|
141
223
|
* Sets plugin-provided filter options on the audio.
|
|
142
224
|
*
|
|
143
225
|
* @param {Record<string, unknown>} [pluginFilters] - Plugin filter settings keyed by plugin filter name.
|
|
226
|
+
* @param {string | string[]} [requiredPluginNames] - The plugin name(s) that can handle the provided filters. Defaults to LavaDSPX.
|
|
144
227
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
145
228
|
*/
|
|
146
|
-
setPluginFilters(pluginFilters?: Record<string, unknown
|
|
229
|
+
setPluginFilters(pluginFilters?: Record<string, unknown>, requiredPluginNames?: string | string[]): Promise<this>;
|
|
147
230
|
/**
|
|
148
231
|
* Sets the own rotation options effect to the audio.
|
|
149
232
|
*
|
|
@@ -5,6 +5,7 @@ const filtersEqualizers_1 = require("../utils/filtersEqualizers");
|
|
|
5
5
|
const Enums_1 = require("./Enums");
|
|
6
6
|
const MagmastreamError_1 = require("./MagmastreamError");
|
|
7
7
|
class Filters {
|
|
8
|
+
static defaultPluginFilterPlugins = ["lavadspx-plugin", "LavaDSPX-Plugin"];
|
|
8
9
|
distortion;
|
|
9
10
|
equalizer;
|
|
10
11
|
karaoke;
|
|
@@ -14,6 +15,15 @@ class Filters {
|
|
|
14
15
|
vibrato;
|
|
15
16
|
channelMix;
|
|
16
17
|
lowPass;
|
|
18
|
+
highpass;
|
|
19
|
+
echo;
|
|
20
|
+
chorus;
|
|
21
|
+
compressor;
|
|
22
|
+
flanger;
|
|
23
|
+
phaser;
|
|
24
|
+
phonograph;
|
|
25
|
+
spatial;
|
|
26
|
+
tape;
|
|
17
27
|
pluginFilters;
|
|
18
28
|
reverb;
|
|
19
29
|
volume;
|
|
@@ -31,6 +41,15 @@ class Filters {
|
|
|
31
41
|
this.vibrato = null;
|
|
32
42
|
this.channelMix = null;
|
|
33
43
|
this.lowPass = null;
|
|
44
|
+
this.highpass = null;
|
|
45
|
+
this.echo = null;
|
|
46
|
+
this.chorus = null;
|
|
47
|
+
this.compressor = null;
|
|
48
|
+
this.flanger = null;
|
|
49
|
+
this.phaser = null;
|
|
50
|
+
this.phonograph = null;
|
|
51
|
+
this.spatial = null;
|
|
52
|
+
this.tape = null;
|
|
34
53
|
this.pluginFilters = {};
|
|
35
54
|
this.reverb = null;
|
|
36
55
|
this.volume = 1.0;
|
|
@@ -56,23 +75,38 @@ class Filters {
|
|
|
56
75
|
* of the Filters class for method chaining.
|
|
57
76
|
*/
|
|
58
77
|
async updateFilters() {
|
|
59
|
-
const { channelMix, distortion, equalizer, karaoke, lowPass, pluginFilters, rotation, timescale, tremoloOptions, vibrato, volume } = this;
|
|
78
|
+
const { channelMix, chorus, compressor, distortion, echo, equalizer, flanger, highpass, karaoke, lowPass, phaser, phonograph, pluginFilters, reverb, rotation, spatial, tape, timescale, tremoloOptions, vibrato, volume, } = this;
|
|
79
|
+
const filters = {
|
|
80
|
+
distortion,
|
|
81
|
+
equalizer,
|
|
82
|
+
karaoke,
|
|
83
|
+
lowPass,
|
|
84
|
+
pluginFilters,
|
|
85
|
+
rotation,
|
|
86
|
+
timescale,
|
|
87
|
+
tremolo: tremoloOptions,
|
|
88
|
+
vibrato,
|
|
89
|
+
volume,
|
|
90
|
+
channelMix,
|
|
91
|
+
...(this.player.node.isNodeLink
|
|
92
|
+
? {
|
|
93
|
+
chorus,
|
|
94
|
+
compressor,
|
|
95
|
+
echo,
|
|
96
|
+
flanger,
|
|
97
|
+
highpass,
|
|
98
|
+
phaser,
|
|
99
|
+
phonograph,
|
|
100
|
+
reverb,
|
|
101
|
+
spatial,
|
|
102
|
+
tape,
|
|
103
|
+
}
|
|
104
|
+
: {}),
|
|
105
|
+
};
|
|
60
106
|
try {
|
|
61
107
|
await this.player.node.rest.updatePlayer({
|
|
62
108
|
data: {
|
|
63
|
-
filters
|
|
64
|
-
distortion,
|
|
65
|
-
equalizer,
|
|
66
|
-
karaoke,
|
|
67
|
-
lowPass,
|
|
68
|
-
pluginFilters,
|
|
69
|
-
rotation,
|
|
70
|
-
timescale,
|
|
71
|
-
tremolo: tremoloOptions,
|
|
72
|
-
vibrato,
|
|
73
|
-
volume,
|
|
74
|
-
channelMix,
|
|
75
|
-
},
|
|
109
|
+
filters,
|
|
76
110
|
},
|
|
77
111
|
guildId: this.player.guildId,
|
|
78
112
|
});
|
|
@@ -113,6 +147,27 @@ class Filters {
|
|
|
113
147
|
details: { action: "change" },
|
|
114
148
|
});
|
|
115
149
|
}
|
|
150
|
+
assertPluginFiltersSupported(pluginNames) {
|
|
151
|
+
const requiredPlugins = Array.isArray(pluginNames) ? pluginNames : [pluginNames];
|
|
152
|
+
const availablePlugins = this.player.node.info?.plugins ?? [];
|
|
153
|
+
const hasRequiredPlugin = requiredPlugins.some((name) => availablePlugins.some((plugin) => plugin.name.toLowerCase() === name.toLowerCase()));
|
|
154
|
+
if (!hasRequiredPlugin) {
|
|
155
|
+
throw new MagmastreamError_1.MagmaStreamError({
|
|
156
|
+
code: Enums_1.MagmaStreamErrorCode.NODE_PLUGIN_ERROR,
|
|
157
|
+
message: `One of the following plugins must be present in the lavalink node: ${requiredPlugins.map((name) => `"${name}"`).join(" or ")}.`,
|
|
158
|
+
context: { identifier: this.player.node.options.identifier },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
assertNodeLinkExtraFilterSupported(filterName) {
|
|
163
|
+
if (this.player.node.isNodeLink)
|
|
164
|
+
return;
|
|
165
|
+
throw new MagmastreamError_1.MagmaStreamError({
|
|
166
|
+
code: Enums_1.MagmaStreamErrorCode.NODE_PROTOCOL_ERROR,
|
|
167
|
+
message: `The "${filterName}" filter is only supported on NodeLink nodes.`,
|
|
168
|
+
context: { identifier: this.player.node.options.identifier },
|
|
169
|
+
});
|
|
170
|
+
}
|
|
116
171
|
/**
|
|
117
172
|
* Sets the status of a specific filter.
|
|
118
173
|
*
|
|
@@ -162,6 +217,16 @@ class Filters {
|
|
|
162
217
|
await this.setVibrato(null);
|
|
163
218
|
await this.setChannelMix(null);
|
|
164
219
|
await this.setLowPass(null);
|
|
220
|
+
await this.setHighPass(null);
|
|
221
|
+
await this.setEcho(null);
|
|
222
|
+
await this.setReverb(null);
|
|
223
|
+
await this.setChorus(null);
|
|
224
|
+
await this.setCompressor(null);
|
|
225
|
+
await this.setFlanger(null);
|
|
226
|
+
await this.setPhaser(null);
|
|
227
|
+
await this.setPhonograph(null);
|
|
228
|
+
await this.setSpatial(null);
|
|
229
|
+
await this.setTape(null);
|
|
165
230
|
await this.setPluginFilters({});
|
|
166
231
|
await this.updateFilters();
|
|
167
232
|
this.emitPlayersTasteUpdate(oldPlayer);
|
|
@@ -270,15 +335,189 @@ class Filters {
|
|
|
270
335
|
this.emitPlayersTasteUpdate(oldPlayer);
|
|
271
336
|
return this;
|
|
272
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Sets the NodeLink high pass filter options on the audio.
|
|
340
|
+
* @param {HighPassOptions} [highpass] - The high pass settings to apply.
|
|
341
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
342
|
+
*/
|
|
343
|
+
async setHighPass(highpass) {
|
|
344
|
+
const oldPlayer = { ...this };
|
|
345
|
+
if (highpass)
|
|
346
|
+
this.assertNodeLinkExtraFilterSupported("highpass");
|
|
347
|
+
await this.applyFilter({ property: "highpass", value: highpass ?? null });
|
|
348
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetHighPass, !!highpass);
|
|
349
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
350
|
+
return this;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Sets the NodeLink echo filter options on the audio.
|
|
354
|
+
* @param {EchoOptions} [echo] - The echo settings to apply.
|
|
355
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
356
|
+
*/
|
|
357
|
+
async setEcho(echo) {
|
|
358
|
+
const oldPlayer = { ...this };
|
|
359
|
+
if (echo)
|
|
360
|
+
this.assertNodeLinkExtraFilterSupported("echo");
|
|
361
|
+
await this.applyFilter({ property: "echo", value: echo ?? null });
|
|
362
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetEcho, !!echo);
|
|
363
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Sets the NodeLink reverb filter options on the audio.
|
|
368
|
+
* @param {ReverbOptions} [reverb] - The reverb settings to apply.
|
|
369
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
370
|
+
*/
|
|
371
|
+
async setReverb(reverb) {
|
|
372
|
+
const oldPlayer = { ...this };
|
|
373
|
+
if (reverb)
|
|
374
|
+
this.assertNodeLinkExtraFilterSupported("reverb");
|
|
375
|
+
await this.applyFilter({ property: "reverb", value: reverb ?? null });
|
|
376
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetReverb, !!reverb);
|
|
377
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
378
|
+
return this;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Sets the NodeLink chorus filter options on the audio.
|
|
382
|
+
* @param {ChorusOptions} [chorus] - The chorus settings to apply.
|
|
383
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
384
|
+
*/
|
|
385
|
+
async setChorus(chorus) {
|
|
386
|
+
const oldPlayer = { ...this };
|
|
387
|
+
if (chorus)
|
|
388
|
+
this.assertNodeLinkExtraFilterSupported("chorus");
|
|
389
|
+
await this.applyFilter({ property: "chorus", value: chorus ?? null });
|
|
390
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetChorus, !!chorus);
|
|
391
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
392
|
+
return this;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Sets the NodeLink compressor filter options on the audio.
|
|
396
|
+
* @param {CompressorOptions} [compressor] - The compressor settings to apply.
|
|
397
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
398
|
+
*/
|
|
399
|
+
async setCompressor(compressor) {
|
|
400
|
+
const oldPlayer = { ...this };
|
|
401
|
+
if (compressor)
|
|
402
|
+
this.assertNodeLinkExtraFilterSupported("compressor");
|
|
403
|
+
await this.applyFilter({ property: "compressor", value: compressor ?? null });
|
|
404
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetCompressor, !!compressor);
|
|
405
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Sets the NodeLink flanger filter options on the audio.
|
|
410
|
+
* @param {FlangerOptions} [flanger] - The flanger settings to apply.
|
|
411
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
412
|
+
*/
|
|
413
|
+
async setFlanger(flanger) {
|
|
414
|
+
const oldPlayer = { ...this };
|
|
415
|
+
if (flanger)
|
|
416
|
+
this.assertNodeLinkExtraFilterSupported("flanger");
|
|
417
|
+
await this.applyFilter({ property: "flanger", value: flanger ?? null });
|
|
418
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetFlanger, !!flanger);
|
|
419
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Sets the NodeLink phaser filter options on the audio.
|
|
424
|
+
* @param {PhaserOptions} [phaser] - The phaser settings to apply.
|
|
425
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
426
|
+
*/
|
|
427
|
+
async setPhaser(phaser) {
|
|
428
|
+
const oldPlayer = { ...this };
|
|
429
|
+
if (phaser)
|
|
430
|
+
this.assertNodeLinkExtraFilterSupported("phaser");
|
|
431
|
+
await this.applyFilter({ property: "phaser", value: phaser ?? null });
|
|
432
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetPhaser, !!phaser);
|
|
433
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
434
|
+
return this;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Sets the NodeLink phonograph filter options on the audio.
|
|
438
|
+
* @param {PhonographOptions} [phonograph] - The phonograph settings to apply.
|
|
439
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
440
|
+
*/
|
|
441
|
+
async setPhonograph(phonograph) {
|
|
442
|
+
const oldPlayer = { ...this };
|
|
443
|
+
if (phonograph)
|
|
444
|
+
this.assertNodeLinkExtraFilterSupported("phonograph");
|
|
445
|
+
await this.applyFilter({ property: "phonograph", value: phonograph ?? null });
|
|
446
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetPhonograph, !!phonograph);
|
|
447
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
448
|
+
return this;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Sets the NodeLink spatial filter options on the audio.
|
|
452
|
+
* @param {SpatialOptions} [spatial] - The spatial settings to apply.
|
|
453
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
454
|
+
*/
|
|
455
|
+
async setSpatial(spatial) {
|
|
456
|
+
const oldPlayer = { ...this };
|
|
457
|
+
if (spatial)
|
|
458
|
+
this.assertNodeLinkExtraFilterSupported("spatial");
|
|
459
|
+
await this.applyFilter({ property: "spatial", value: spatial ?? null });
|
|
460
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetSpatial, !!spatial);
|
|
461
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
462
|
+
return this;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Sets the NodeLink tape filter options on the audio.
|
|
466
|
+
* @param {TapeOptions} [tape] - The tape settings to apply.
|
|
467
|
+
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
468
|
+
*/
|
|
469
|
+
async setTape(tape) {
|
|
470
|
+
const oldPlayer = { ...this };
|
|
471
|
+
if (tape)
|
|
472
|
+
this.assertNodeLinkExtraFilterSupported("tape");
|
|
473
|
+
await this.applyFilter({ property: "tape", value: tape ?? null });
|
|
474
|
+
this.setFilterStatus(Enums_1.AvailableFilters.SetTape, !!tape);
|
|
475
|
+
this.emitPlayersTasteUpdate(oldPlayer);
|
|
476
|
+
return this;
|
|
477
|
+
}
|
|
478
|
+
async setNodeLinkHighPass(highpass) {
|
|
479
|
+
return this.setHighPass(highpass);
|
|
480
|
+
}
|
|
481
|
+
async setNodeLinkEcho(echo) {
|
|
482
|
+
return this.setEcho(echo);
|
|
483
|
+
}
|
|
484
|
+
async setNodeLinkReverb(reverb) {
|
|
485
|
+
return this.setReverb(reverb);
|
|
486
|
+
}
|
|
487
|
+
async setNodeLinkChorus(chorus) {
|
|
488
|
+
return this.setChorus(chorus);
|
|
489
|
+
}
|
|
490
|
+
async setNodeLinkCompressor(compressor) {
|
|
491
|
+
return this.setCompressor(compressor);
|
|
492
|
+
}
|
|
493
|
+
async setNodeLinkFlanger(flanger) {
|
|
494
|
+
return this.setFlanger(flanger);
|
|
495
|
+
}
|
|
496
|
+
async setNodeLinkPhaser(phaser) {
|
|
497
|
+
return this.setPhaser(phaser);
|
|
498
|
+
}
|
|
499
|
+
async setNodeLinkPhonograph(phonograph) {
|
|
500
|
+
return this.setPhonograph(phonograph);
|
|
501
|
+
}
|
|
502
|
+
async setNodeLinkSpatial(spatial) {
|
|
503
|
+
return this.setSpatial(spatial);
|
|
504
|
+
}
|
|
505
|
+
async setNodeLinkTape(tape) {
|
|
506
|
+
return this.setTape(tape);
|
|
507
|
+
}
|
|
273
508
|
/**
|
|
274
509
|
* Sets plugin-provided filter options on the audio.
|
|
275
510
|
*
|
|
276
511
|
* @param {Record<string, unknown>} [pluginFilters] - Plugin filter settings keyed by plugin filter name.
|
|
512
|
+
* @param {string | string[]} [requiredPluginNames] - The plugin name(s) that can handle the provided filters. Defaults to LavaDSPX.
|
|
277
513
|
* @returns {Promise<this>} - Returns the current instance of the Filters class for method chaining.
|
|
278
514
|
*/
|
|
279
|
-
async setPluginFilters(pluginFilters) {
|
|
515
|
+
async setPluginFilters(pluginFilters, requiredPluginNames = Filters.defaultPluginFilterPlugins) {
|
|
280
516
|
const oldPlayer = { ...this };
|
|
281
517
|
const nextPluginFilters = pluginFilters ?? {};
|
|
518
|
+
if (Object.keys(nextPluginFilters).length > 0) {
|
|
519
|
+
this.assertPluginFiltersSupported(requiredPluginNames);
|
|
520
|
+
}
|
|
282
521
|
await this.applyFilter({ property: "pluginFilters", value: nextPluginFilters });
|
|
283
522
|
this.setFilterStatus(Enums_1.AvailableFilters.PluginFilters, Object.keys(nextPluginFilters).length > 0);
|
|
284
523
|
this.emitPlayersTasteUpdate(oldPlayer);
|
|
@@ -135,6 +135,12 @@ export declare class Manager extends EventEmitter {
|
|
|
135
135
|
* @returns A promise that resolves when the player states have been loaded.
|
|
136
136
|
*/
|
|
137
137
|
loadPlayerStates(nodeId: string): Promise<void>;
|
|
138
|
+
private isNodeLinkSearchSource;
|
|
139
|
+
private isPrefixedLoadTracksIdentifier;
|
|
140
|
+
private requiresNodeLinkSearchNode;
|
|
141
|
+
private requiresLavalinkSearchNode;
|
|
142
|
+
private getSearchNode;
|
|
143
|
+
private getPreferredNode;
|
|
138
144
|
/**
|
|
139
145
|
* Returns the node to use based on the configured `useNode` and `enablePriorityMode` options.
|
|
140
146
|
* If `enablePriorityMode` is true, the node is chosen based on priority, otherwise it is chosen based on the `useNode` option.
|