lavalink-client 2.6.2 → 2.6.3
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/index.d.mts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +145 -178
- package/dist/index.mjs +145 -178
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2689,6 +2689,88 @@ var bandCampSearch = async (player, query, requestUser) => {
|
|
|
2689
2689
|
};
|
|
2690
2690
|
|
|
2691
2691
|
// src/structures/Filters.ts
|
|
2692
|
+
var DEFAULT_FILTER_DATAS = {
|
|
2693
|
+
volume: 1,
|
|
2694
|
+
lowPass: {
|
|
2695
|
+
smoothing: 0
|
|
2696
|
+
},
|
|
2697
|
+
karaoke: {
|
|
2698
|
+
level: 0,
|
|
2699
|
+
monoLevel: 0,
|
|
2700
|
+
filterBand: 0,
|
|
2701
|
+
filterWidth: 0
|
|
2702
|
+
},
|
|
2703
|
+
timescale: {
|
|
2704
|
+
speed: 1,
|
|
2705
|
+
// 0 = x
|
|
2706
|
+
pitch: 1,
|
|
2707
|
+
// 0 = x
|
|
2708
|
+
rate: 1
|
|
2709
|
+
// 0 = x
|
|
2710
|
+
},
|
|
2711
|
+
rotation: {
|
|
2712
|
+
rotationHz: 0
|
|
2713
|
+
},
|
|
2714
|
+
tremolo: {
|
|
2715
|
+
frequency: 0,
|
|
2716
|
+
// 0 < x
|
|
2717
|
+
depth: 0
|
|
2718
|
+
// 0 < x = 1
|
|
2719
|
+
},
|
|
2720
|
+
vibrato: {
|
|
2721
|
+
frequency: 0,
|
|
2722
|
+
// 0 < x <= 14
|
|
2723
|
+
depth: 0
|
|
2724
|
+
// 0 < x <= 1
|
|
2725
|
+
},
|
|
2726
|
+
channelMix: audioOutputsData.stereo,
|
|
2727
|
+
pluginFilters: {
|
|
2728
|
+
"lavalink-filter-plugin": {
|
|
2729
|
+
echo: {
|
|
2730
|
+
delay: 0,
|
|
2731
|
+
// in seconds
|
|
2732
|
+
decay: 0
|
|
2733
|
+
// 0 < 1
|
|
2734
|
+
},
|
|
2735
|
+
reverb: {
|
|
2736
|
+
delays: [],
|
|
2737
|
+
// [0.037, 0.042, 0.048, 0.053]
|
|
2738
|
+
gains: []
|
|
2739
|
+
// [0.84, 0.83, 0.82, 0.81]
|
|
2740
|
+
}
|
|
2741
|
+
},
|
|
2742
|
+
"high-pass": {
|
|
2743
|
+
// Cuts off frequencies lower than the specified {cutoffFrequency}.
|
|
2744
|
+
// "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
|
|
2745
|
+
// "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2746
|
+
},
|
|
2747
|
+
"low-pass": {
|
|
2748
|
+
// Cuts off frequencies higher than the specified {cutoffFrequency}.
|
|
2749
|
+
// "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
|
|
2750
|
+
// "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2751
|
+
},
|
|
2752
|
+
"normalization": {
|
|
2753
|
+
// Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
|
|
2754
|
+
// "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
|
|
2755
|
+
// "adaptive": true // false
|
|
2756
|
+
},
|
|
2757
|
+
"echo": {
|
|
2758
|
+
// Self-explanatory; provides an echo effect.
|
|
2759
|
+
// "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
|
|
2760
|
+
// "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
/*distortion: {
|
|
2764
|
+
sinOffset: 0,
|
|
2765
|
+
sinScale: 1,
|
|
2766
|
+
cosOffset: 0,
|
|
2767
|
+
cosScale: 1,
|
|
2768
|
+
tanOffset: 0,
|
|
2769
|
+
tanScale: 1,
|
|
2770
|
+
offset: 0,
|
|
2771
|
+
scale: 1
|
|
2772
|
+
}*/
|
|
2773
|
+
};
|
|
2692
2774
|
var FilterManager = class {
|
|
2693
2775
|
/** The Equalizer bands currently applied to the Lavalink Server */
|
|
2694
2776
|
equalizerBands = [];
|
|
@@ -2718,88 +2800,7 @@ var FilterManager = class {
|
|
|
2718
2800
|
audioOutput: "stereo"
|
|
2719
2801
|
};
|
|
2720
2802
|
/** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
|
|
2721
|
-
data =
|
|
2722
|
-
volume: 1,
|
|
2723
|
-
lowPass: {
|
|
2724
|
-
smoothing: 0
|
|
2725
|
-
},
|
|
2726
|
-
karaoke: {
|
|
2727
|
-
level: 0,
|
|
2728
|
-
monoLevel: 0,
|
|
2729
|
-
filterBand: 0,
|
|
2730
|
-
filterWidth: 0
|
|
2731
|
-
},
|
|
2732
|
-
timescale: {
|
|
2733
|
-
speed: 1,
|
|
2734
|
-
// 0 = x
|
|
2735
|
-
pitch: 1,
|
|
2736
|
-
// 0 = x
|
|
2737
|
-
rate: 1
|
|
2738
|
-
// 0 = x
|
|
2739
|
-
},
|
|
2740
|
-
rotation: {
|
|
2741
|
-
rotationHz: 0
|
|
2742
|
-
},
|
|
2743
|
-
tremolo: {
|
|
2744
|
-
frequency: 0,
|
|
2745
|
-
// 0 < x
|
|
2746
|
-
depth: 0
|
|
2747
|
-
// 0 < x = 1
|
|
2748
|
-
},
|
|
2749
|
-
vibrato: {
|
|
2750
|
-
frequency: 0,
|
|
2751
|
-
// 0 < x <= 14
|
|
2752
|
-
depth: 0
|
|
2753
|
-
// 0 < x <= 1
|
|
2754
|
-
},
|
|
2755
|
-
pluginFilters: {
|
|
2756
|
-
"lavalink-filter-plugin": {
|
|
2757
|
-
echo: {
|
|
2758
|
-
delay: 0,
|
|
2759
|
-
// in seconds
|
|
2760
|
-
decay: 0
|
|
2761
|
-
// 0 < 1
|
|
2762
|
-
},
|
|
2763
|
-
reverb: {
|
|
2764
|
-
delays: [],
|
|
2765
|
-
// [0.037, 0.042, 0.048, 0.053]
|
|
2766
|
-
gains: []
|
|
2767
|
-
// [0.84, 0.83, 0.82, 0.81]
|
|
2768
|
-
}
|
|
2769
|
-
},
|
|
2770
|
-
"high-pass": {
|
|
2771
|
-
// Cuts off frequencies lower than the specified {cutoffFrequency}.
|
|
2772
|
-
// "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
|
|
2773
|
-
// "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2774
|
-
},
|
|
2775
|
-
"low-pass": {
|
|
2776
|
-
// Cuts off frequencies higher than the specified {cutoffFrequency}.
|
|
2777
|
-
// "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
|
|
2778
|
-
// "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2779
|
-
},
|
|
2780
|
-
"normalization": {
|
|
2781
|
-
// Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
|
|
2782
|
-
// "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
|
|
2783
|
-
// "adaptive": true // false
|
|
2784
|
-
},
|
|
2785
|
-
"echo": {
|
|
2786
|
-
// Self-explanatory; provides an echo effect.
|
|
2787
|
-
// "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
|
|
2788
|
-
// "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
|
|
2789
|
-
}
|
|
2790
|
-
},
|
|
2791
|
-
channelMix: audioOutputsData.stereo
|
|
2792
|
-
/*distortion: {
|
|
2793
|
-
sinOffset: 0,
|
|
2794
|
-
sinScale: 1,
|
|
2795
|
-
cosOffset: 0,
|
|
2796
|
-
cosScale: 1,
|
|
2797
|
-
tanOffset: 0,
|
|
2798
|
-
tanScale: 1,
|
|
2799
|
-
offset: 0,
|
|
2800
|
-
scale: 1
|
|
2801
|
-
}*/
|
|
2802
|
-
};
|
|
2803
|
+
data = structuredClone(DEFAULT_FILTER_DATAS);
|
|
2803
2804
|
/** The Player assigned to this Filter Manager */
|
|
2804
2805
|
player;
|
|
2805
2806
|
/** The Constructor for the FilterManager */
|
|
@@ -2972,6 +2973,7 @@ var FilterManager = class {
|
|
|
2972
2973
|
*/
|
|
2973
2974
|
async setVolume(volume) {
|
|
2974
2975
|
if (volume < 0 || volume > 5) throw new SyntaxError("Volume-Filter must be between 0 and 5");
|
|
2976
|
+
this.data = this.data ?? {};
|
|
2975
2977
|
this.data.volume = volume;
|
|
2976
2978
|
this.filters.volume = volume !== 1;
|
|
2977
2979
|
await this.applyPlayerFilters();
|
|
@@ -2985,6 +2987,7 @@ var FilterManager = class {
|
|
|
2985
2987
|
async setAudioOutput(type) {
|
|
2986
2988
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix")) throw new Error("Node#Info#filters does not include the 'channelMix' Filter (Node has it not enable)");
|
|
2987
2989
|
if (!type || !audioOutputsData[type]) throw "Invalid audio type added, must be 'mono' / 'stereo' / 'left' / 'right'";
|
|
2990
|
+
this.data = this.data ?? {};
|
|
2988
2991
|
this.data.channelMix = audioOutputsData[type];
|
|
2989
2992
|
this.filters.audioOutput = type;
|
|
2990
2993
|
await this.applyPlayerFilters();
|
|
@@ -2997,14 +3000,10 @@ var FilterManager = class {
|
|
|
2997
3000
|
*/
|
|
2998
3001
|
async setSpeed(speed = 1) {
|
|
2999
3002
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
this.filters.nightcore = false;
|
|
3005
|
-
this.filters.vaporwave = false;
|
|
3006
|
-
}
|
|
3007
|
-
this.data.timescale.speed = speed;
|
|
3003
|
+
this.data = this.data ?? {};
|
|
3004
|
+
this.filters.nightcore = false;
|
|
3005
|
+
this.filters.vaporwave = false;
|
|
3006
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, speed };
|
|
3008
3007
|
this.isCustomFilterActive();
|
|
3009
3008
|
await this.applyPlayerFilters();
|
|
3010
3009
|
return this.filters.custom;
|
|
@@ -3016,14 +3015,10 @@ var FilterManager = class {
|
|
|
3016
3015
|
*/
|
|
3017
3016
|
async setPitch(pitch = 1) {
|
|
3018
3017
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
this.filters.nightcore = false;
|
|
3024
|
-
this.filters.vaporwave = false;
|
|
3025
|
-
}
|
|
3026
|
-
this.data.timescale.pitch = pitch;
|
|
3018
|
+
this.data = this.data ?? {};
|
|
3019
|
+
this.filters.nightcore = false;
|
|
3020
|
+
this.filters.vaporwave = false;
|
|
3021
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, pitch };
|
|
3027
3022
|
this.isCustomFilterActive();
|
|
3028
3023
|
await this.applyPlayerFilters();
|
|
3029
3024
|
return this.filters.custom;
|
|
@@ -3035,14 +3030,10 @@ var FilterManager = class {
|
|
|
3035
3030
|
*/
|
|
3036
3031
|
async setRate(rate = 1) {
|
|
3037
3032
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
this.filters.nightcore = false;
|
|
3043
|
-
this.filters.vaporwave = false;
|
|
3044
|
-
}
|
|
3045
|
-
this.data.timescale.rate = rate;
|
|
3033
|
+
this.data = this.data ?? {};
|
|
3034
|
+
this.filters.nightcore = false;
|
|
3035
|
+
this.filters.vaporwave = false;
|
|
3036
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, rate };
|
|
3046
3037
|
this.isCustomFilterActive();
|
|
3047
3038
|
await this.applyPlayerFilters();
|
|
3048
3039
|
return this.filters.custom;
|
|
@@ -3054,7 +3045,8 @@ var FilterManager = class {
|
|
|
3054
3045
|
*/
|
|
3055
3046
|
async toggleRotation(rotationHz = 0.2) {
|
|
3056
3047
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("rotation")) throw new Error("Node#Info#filters does not include the 'rotation' Filter (Node has it not enable)");
|
|
3057
|
-
this.data
|
|
3048
|
+
this.data = this.data ?? {};
|
|
3049
|
+
this.data.rotation = this.filters.rotation ? DEFAULT_FILTER_DATAS.rotation : { rotationHz };
|
|
3058
3050
|
this.filters.rotation = !this.filters.rotation;
|
|
3059
3051
|
await this.applyPlayerFilters();
|
|
3060
3052
|
return this.filters.rotation;
|
|
@@ -3067,8 +3059,8 @@ var FilterManager = class {
|
|
|
3067
3059
|
*/
|
|
3068
3060
|
async toggleVibrato(frequency = 10, depth = 1) {
|
|
3069
3061
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("vibrato")) throw new Error("Node#Info#filters does not include the 'vibrato' Filter (Node has it not enable)");
|
|
3070
|
-
this.data
|
|
3071
|
-
this.data.vibrato
|
|
3062
|
+
this.data = this.data ?? {};
|
|
3063
|
+
this.data.vibrato = this.filters.vibrato ? DEFAULT_FILTER_DATAS.vibrato : { depth, frequency };
|
|
3072
3064
|
this.filters.vibrato = !this.filters.vibrato;
|
|
3073
3065
|
await this.applyPlayerFilters();
|
|
3074
3066
|
return this.filters.vibrato;
|
|
@@ -3081,8 +3073,8 @@ var FilterManager = class {
|
|
|
3081
3073
|
*/
|
|
3082
3074
|
async toggleTremolo(frequency = 4, depth = 0.8) {
|
|
3083
3075
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("tremolo")) throw new Error("Node#Info#filters does not include the 'tremolo' Filter (Node has it not enable)");
|
|
3084
|
-
this.data
|
|
3085
|
-
this.data.tremolo
|
|
3076
|
+
this.data = this.data ?? {};
|
|
3077
|
+
this.data.tremolo = this.filters.tremolo ? DEFAULT_FILTER_DATAS.tremolo : { depth, frequency };
|
|
3086
3078
|
this.filters.tremolo = !this.filters.tremolo;
|
|
3087
3079
|
await this.applyPlayerFilters();
|
|
3088
3080
|
return this.filters.tremolo;
|
|
@@ -3094,7 +3086,8 @@ var FilterManager = class {
|
|
|
3094
3086
|
*/
|
|
3095
3087
|
async toggleLowPass(smoothing = 20) {
|
|
3096
3088
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("lowPass")) throw new Error("Node#Info#filters does not include the 'lowPass' Filter (Node has it not enable)");
|
|
3097
|
-
this.data
|
|
3089
|
+
this.data = this.data ?? {};
|
|
3090
|
+
this.data.lowPass = this.filters.lowPass ? DEFAULT_FILTER_DATAS.lowPass : { smoothing };
|
|
3098
3091
|
this.filters.lowPass = !this.filters.lowPass;
|
|
3099
3092
|
await this.applyPlayerFilters();
|
|
3100
3093
|
return this.filters.lowPass;
|
|
@@ -3109,17 +3102,10 @@ var FilterManager = class {
|
|
|
3109
3102
|
toggleLowPass: async (boostFactor = 1, cutoffFrequency = 80) => {
|
|
3110
3103
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3111
3104
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("low-pass")) throw new Error("Node#Info#filters does not include the 'low-pass' Filter (Node has it not enable)");
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
if (
|
|
3115
|
-
|
|
3116
|
-
delete this.data.pluginFilters["low-pass"];
|
|
3117
|
-
} else {
|
|
3118
|
-
this.data.pluginFilters["low-pass"] = {
|
|
3119
|
-
boostFactor,
|
|
3120
|
-
cutoffFrequency
|
|
3121
|
-
};
|
|
3122
|
-
}
|
|
3105
|
+
this.data = this.data ?? {};
|
|
3106
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3107
|
+
if (this.filters.lavalinkLavaDspxPlugin.lowPass) delete this.data.pluginFilters["low-pass"];
|
|
3108
|
+
else this.data.pluginFilters["low-pass"] = { boostFactor, cutoffFrequency };
|
|
3123
3109
|
this.filters.lavalinkLavaDspxPlugin.lowPass = !this.filters.lavalinkLavaDspxPlugin.lowPass;
|
|
3124
3110
|
await this.applyPlayerFilters();
|
|
3125
3111
|
return this.filters.lavalinkLavaDspxPlugin.lowPass;
|
|
@@ -3133,17 +3119,10 @@ var FilterManager = class {
|
|
|
3133
3119
|
toggleHighPass: async (boostFactor = 1, cutoffFrequency = 80) => {
|
|
3134
3120
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3135
3121
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("high-pass")) throw new Error("Node#Info#filters does not include the 'high-pass' Filter (Node has it not enable)");
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
if (
|
|
3139
|
-
|
|
3140
|
-
delete this.data.pluginFilters["high-pass"];
|
|
3141
|
-
} else {
|
|
3142
|
-
this.data.pluginFilters["high-pass"] = {
|
|
3143
|
-
boostFactor,
|
|
3144
|
-
cutoffFrequency
|
|
3145
|
-
};
|
|
3146
|
-
}
|
|
3122
|
+
this.data = this.data ?? {};
|
|
3123
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3124
|
+
if (this.filters.lavalinkLavaDspxPlugin.highPass) delete this.data.pluginFilters["high-pass"];
|
|
3125
|
+
else this.data.pluginFilters["high-pass"] = { boostFactor, cutoffFrequency };
|
|
3147
3126
|
this.filters.lavalinkLavaDspxPlugin.highPass = !this.filters.lavalinkLavaDspxPlugin.highPass;
|
|
3148
3127
|
await this.applyPlayerFilters();
|
|
3149
3128
|
return this.filters.lavalinkLavaDspxPlugin.highPass;
|
|
@@ -3157,17 +3136,10 @@ var FilterManager = class {
|
|
|
3157
3136
|
toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
|
|
3158
3137
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3159
3138
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("normalization")) throw new Error("Node#Info#filters does not include the 'normalization' Filter (Node has it not enable)");
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
if (
|
|
3163
|
-
|
|
3164
|
-
delete this.data.pluginFilters.normalization;
|
|
3165
|
-
} else {
|
|
3166
|
-
this.data.pluginFilters.normalization = {
|
|
3167
|
-
adaptive,
|
|
3168
|
-
maxAmplitude
|
|
3169
|
-
};
|
|
3170
|
-
}
|
|
3139
|
+
this.data = this.data ?? {};
|
|
3140
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3141
|
+
if (this.filters.lavalinkLavaDspxPlugin.normalization) delete this.data.pluginFilters.normalization;
|
|
3142
|
+
else this.data.pluginFilters.normalization = { adaptive, maxAmplitude };
|
|
3171
3143
|
this.filters.lavalinkLavaDspxPlugin.normalization = !this.filters.lavalinkLavaDspxPlugin.normalization;
|
|
3172
3144
|
await this.applyPlayerFilters();
|
|
3173
3145
|
return this.filters.lavalinkLavaDspxPlugin.normalization;
|
|
@@ -3181,17 +3153,10 @@ var FilterManager = class {
|
|
|
3181
3153
|
toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
|
|
3182
3154
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3183
3155
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable)");
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
if (
|
|
3187
|
-
|
|
3188
|
-
delete this.data.pluginFilters.echo;
|
|
3189
|
-
} else {
|
|
3190
|
-
this.data.pluginFilters.echo = {
|
|
3191
|
-
decay,
|
|
3192
|
-
echoLength
|
|
3193
|
-
};
|
|
3194
|
-
}
|
|
3156
|
+
this.data = this.data ?? {};
|
|
3157
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3158
|
+
if (this.filters.lavalinkLavaDspxPlugin.echo) delete this.data.pluginFilters.echo;
|
|
3159
|
+
else this.data.pluginFilters.echo = { decay, echoLength };
|
|
3195
3160
|
this.filters.lavalinkLavaDspxPlugin.echo = !this.filters.lavalinkLavaDspxPlugin.echo;
|
|
3196
3161
|
await this.applyPlayerFilters();
|
|
3197
3162
|
return this.filters.lavalinkLavaDspxPlugin.echo;
|
|
@@ -3207,12 +3172,15 @@ var FilterManager = class {
|
|
|
3207
3172
|
toggleEcho: async (delay = 4, decay = 0.8) => {
|
|
3208
3173
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
|
|
3209
3174
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3175
|
+
this.data = this.data ?? {};
|
|
3176
|
+
const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
|
|
3177
|
+
this.data.pluginFilters = {
|
|
3178
|
+
...this.data.pluginFilters,
|
|
3179
|
+
["lavalink-filter-plugin"]: {
|
|
3180
|
+
reverb: this.data.pluginFilters?.["lavalink-filter-plugin"]?.reverb ?? reverb,
|
|
3181
|
+
echo: this.filters.lavalinkFilterPlugin.echo ? echo : { delay, decay }
|
|
3182
|
+
}
|
|
3183
|
+
};
|
|
3216
3184
|
this.filters.lavalinkFilterPlugin.echo = !this.filters.lavalinkFilterPlugin.echo;
|
|
3217
3185
|
await this.applyPlayerFilters();
|
|
3218
3186
|
return this.filters.lavalinkFilterPlugin.echo;
|
|
@@ -3226,12 +3194,15 @@ var FilterManager = class {
|
|
|
3226
3194
|
toggleReverb: async (delays = [0.037, 0.042, 0.048, 0.053], gains = [0.84, 0.83, 0.82, 0.81]) => {
|
|
3227
3195
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
|
|
3228
3196
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("reverb")) throw new Error("Node#Info#filters does not include the 'reverb' Filter (Node has it not enable aka not installed!)");
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3197
|
+
this.data = this.data ?? {};
|
|
3198
|
+
const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
|
|
3199
|
+
this.data.pluginFilters = {
|
|
3200
|
+
...this.data.pluginFilters,
|
|
3201
|
+
["lavalink-filter-plugin"]: {
|
|
3202
|
+
echo: this.data.pluginFilters?.["lavalink-filter-plugin"]?.echo ?? echo,
|
|
3203
|
+
reverb: this.filters.lavalinkFilterPlugin.reverb ? reverb : { delays, gains }
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3235
3206
|
this.filters.lavalinkFilterPlugin.reverb = !this.filters.lavalinkFilterPlugin.reverb;
|
|
3236
3207
|
await this.applyPlayerFilters();
|
|
3237
3208
|
return this.filters.lavalinkFilterPlugin.reverb;
|
|
@@ -3246,9 +3217,8 @@ var FilterManager = class {
|
|
|
3246
3217
|
*/
|
|
3247
3218
|
async toggleNightcore(speed = 1.289999523162842, pitch = 1.289999523162842, rate = 0.9365999523162842) {
|
|
3248
3219
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3249
|
-
this.data
|
|
3250
|
-
this.data.timescale
|
|
3251
|
-
this.data.timescale.rate = this.filters.nightcore ? 1 : rate;
|
|
3220
|
+
this.data = this.data ?? {};
|
|
3221
|
+
this.data.timescale = this.filters.nightcore ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
|
|
3252
3222
|
this.filters.nightcore = !this.filters.nightcore;
|
|
3253
3223
|
this.filters.vaporwave = false;
|
|
3254
3224
|
this.filters.custom = false;
|
|
@@ -3264,9 +3234,8 @@ var FilterManager = class {
|
|
|
3264
3234
|
*/
|
|
3265
3235
|
async toggleVaporwave(speed = 0.8500000238418579, pitch = 0.800000011920929, rate = 1) {
|
|
3266
3236
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3267
|
-
this.data
|
|
3268
|
-
this.data.timescale
|
|
3269
|
-
this.data.timescale.rate = this.filters.vaporwave ? 1 : rate;
|
|
3237
|
+
this.data = this.data ?? {};
|
|
3238
|
+
this.data.timescale = this.filters.vaporwave ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
|
|
3270
3239
|
this.filters.vaporwave = !this.filters.vaporwave;
|
|
3271
3240
|
this.filters.nightcore = false;
|
|
3272
3241
|
this.filters.custom = false;
|
|
@@ -3283,10 +3252,8 @@ var FilterManager = class {
|
|
|
3283
3252
|
*/
|
|
3284
3253
|
async toggleKaraoke(level = 1, monoLevel = 1, filterBand = 220, filterWidth = 100) {
|
|
3285
3254
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("karaoke")) throw new Error("Node#Info#filters does not include the 'karaoke' Filter (Node has it not enable)");
|
|
3286
|
-
this.data
|
|
3287
|
-
this.data.karaoke
|
|
3288
|
-
this.data.karaoke.filterBand = this.filters.karaoke ? 0 : filterBand;
|
|
3289
|
-
this.data.karaoke.filterWidth = this.filters.karaoke ? 0 : filterWidth;
|
|
3255
|
+
this.data = this.data ?? {};
|
|
3256
|
+
this.data.karaoke = this.filters.karaoke ? DEFAULT_FILTER_DATAS.karaoke : { level, monoLevel, filterBand, filterWidth };
|
|
3290
3257
|
this.filters.karaoke = !this.filters.karaoke;
|
|
3291
3258
|
await this.applyPlayerFilters();
|
|
3292
3259
|
return this.filters.karaoke;
|
package/dist/index.mjs
CHANGED
|
@@ -2629,6 +2629,88 @@ var bandCampSearch = async (player, query, requestUser) => {
|
|
|
2629
2629
|
};
|
|
2630
2630
|
|
|
2631
2631
|
// src/structures/Filters.ts
|
|
2632
|
+
var DEFAULT_FILTER_DATAS = {
|
|
2633
|
+
volume: 1,
|
|
2634
|
+
lowPass: {
|
|
2635
|
+
smoothing: 0
|
|
2636
|
+
},
|
|
2637
|
+
karaoke: {
|
|
2638
|
+
level: 0,
|
|
2639
|
+
monoLevel: 0,
|
|
2640
|
+
filterBand: 0,
|
|
2641
|
+
filterWidth: 0
|
|
2642
|
+
},
|
|
2643
|
+
timescale: {
|
|
2644
|
+
speed: 1,
|
|
2645
|
+
// 0 = x
|
|
2646
|
+
pitch: 1,
|
|
2647
|
+
// 0 = x
|
|
2648
|
+
rate: 1
|
|
2649
|
+
// 0 = x
|
|
2650
|
+
},
|
|
2651
|
+
rotation: {
|
|
2652
|
+
rotationHz: 0
|
|
2653
|
+
},
|
|
2654
|
+
tremolo: {
|
|
2655
|
+
frequency: 0,
|
|
2656
|
+
// 0 < x
|
|
2657
|
+
depth: 0
|
|
2658
|
+
// 0 < x = 1
|
|
2659
|
+
},
|
|
2660
|
+
vibrato: {
|
|
2661
|
+
frequency: 0,
|
|
2662
|
+
// 0 < x <= 14
|
|
2663
|
+
depth: 0
|
|
2664
|
+
// 0 < x <= 1
|
|
2665
|
+
},
|
|
2666
|
+
channelMix: audioOutputsData.stereo,
|
|
2667
|
+
pluginFilters: {
|
|
2668
|
+
"lavalink-filter-plugin": {
|
|
2669
|
+
echo: {
|
|
2670
|
+
delay: 0,
|
|
2671
|
+
// in seconds
|
|
2672
|
+
decay: 0
|
|
2673
|
+
// 0 < 1
|
|
2674
|
+
},
|
|
2675
|
+
reverb: {
|
|
2676
|
+
delays: [],
|
|
2677
|
+
// [0.037, 0.042, 0.048, 0.053]
|
|
2678
|
+
gains: []
|
|
2679
|
+
// [0.84, 0.83, 0.82, 0.81]
|
|
2680
|
+
}
|
|
2681
|
+
},
|
|
2682
|
+
"high-pass": {
|
|
2683
|
+
// Cuts off frequencies lower than the specified {cutoffFrequency}.
|
|
2684
|
+
// "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
|
|
2685
|
+
// "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2686
|
+
},
|
|
2687
|
+
"low-pass": {
|
|
2688
|
+
// Cuts off frequencies higher than the specified {cutoffFrequency}.
|
|
2689
|
+
// "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
|
|
2690
|
+
// "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2691
|
+
},
|
|
2692
|
+
"normalization": {
|
|
2693
|
+
// Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
|
|
2694
|
+
// "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
|
|
2695
|
+
// "adaptive": true // false
|
|
2696
|
+
},
|
|
2697
|
+
"echo": {
|
|
2698
|
+
// Self-explanatory; provides an echo effect.
|
|
2699
|
+
// "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
|
|
2700
|
+
// "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
/*distortion: {
|
|
2704
|
+
sinOffset: 0,
|
|
2705
|
+
sinScale: 1,
|
|
2706
|
+
cosOffset: 0,
|
|
2707
|
+
cosScale: 1,
|
|
2708
|
+
tanOffset: 0,
|
|
2709
|
+
tanScale: 1,
|
|
2710
|
+
offset: 0,
|
|
2711
|
+
scale: 1
|
|
2712
|
+
}*/
|
|
2713
|
+
};
|
|
2632
2714
|
var FilterManager = class {
|
|
2633
2715
|
/** The Equalizer bands currently applied to the Lavalink Server */
|
|
2634
2716
|
equalizerBands = [];
|
|
@@ -2658,88 +2740,7 @@ var FilterManager = class {
|
|
|
2658
2740
|
audioOutput: "stereo"
|
|
2659
2741
|
};
|
|
2660
2742
|
/** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
|
|
2661
|
-
data =
|
|
2662
|
-
volume: 1,
|
|
2663
|
-
lowPass: {
|
|
2664
|
-
smoothing: 0
|
|
2665
|
-
},
|
|
2666
|
-
karaoke: {
|
|
2667
|
-
level: 0,
|
|
2668
|
-
monoLevel: 0,
|
|
2669
|
-
filterBand: 0,
|
|
2670
|
-
filterWidth: 0
|
|
2671
|
-
},
|
|
2672
|
-
timescale: {
|
|
2673
|
-
speed: 1,
|
|
2674
|
-
// 0 = x
|
|
2675
|
-
pitch: 1,
|
|
2676
|
-
// 0 = x
|
|
2677
|
-
rate: 1
|
|
2678
|
-
// 0 = x
|
|
2679
|
-
},
|
|
2680
|
-
rotation: {
|
|
2681
|
-
rotationHz: 0
|
|
2682
|
-
},
|
|
2683
|
-
tremolo: {
|
|
2684
|
-
frequency: 0,
|
|
2685
|
-
// 0 < x
|
|
2686
|
-
depth: 0
|
|
2687
|
-
// 0 < x = 1
|
|
2688
|
-
},
|
|
2689
|
-
vibrato: {
|
|
2690
|
-
frequency: 0,
|
|
2691
|
-
// 0 < x <= 14
|
|
2692
|
-
depth: 0
|
|
2693
|
-
// 0 < x <= 1
|
|
2694
|
-
},
|
|
2695
|
-
pluginFilters: {
|
|
2696
|
-
"lavalink-filter-plugin": {
|
|
2697
|
-
echo: {
|
|
2698
|
-
delay: 0,
|
|
2699
|
-
// in seconds
|
|
2700
|
-
decay: 0
|
|
2701
|
-
// 0 < 1
|
|
2702
|
-
},
|
|
2703
|
-
reverb: {
|
|
2704
|
-
delays: [],
|
|
2705
|
-
// [0.037, 0.042, 0.048, 0.053]
|
|
2706
|
-
gains: []
|
|
2707
|
-
// [0.84, 0.83, 0.82, 0.81]
|
|
2708
|
-
}
|
|
2709
|
-
},
|
|
2710
|
-
"high-pass": {
|
|
2711
|
-
// Cuts off frequencies lower than the specified {cutoffFrequency}.
|
|
2712
|
-
// "cutoffFrequency": 1475, // Integer, higher than zero, in Hz.
|
|
2713
|
-
// "boostFactor": 1.0 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2714
|
-
},
|
|
2715
|
-
"low-pass": {
|
|
2716
|
-
// Cuts off frequencies higher than the specified {cutoffFrequency}.
|
|
2717
|
-
// "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
|
|
2718
|
-
// "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
|
|
2719
|
-
},
|
|
2720
|
-
"normalization": {
|
|
2721
|
-
// Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
|
|
2722
|
-
// "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
|
|
2723
|
-
// "adaptive": true // false
|
|
2724
|
-
},
|
|
2725
|
-
"echo": {
|
|
2726
|
-
// Self-explanatory; provides an echo effect.
|
|
2727
|
-
// "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
|
|
2728
|
-
// "decay": 0.4649 // Float, within the range of 0.0 - 1.0. A value of 1.0 means no decay, and a value of 0.0 means
|
|
2729
|
-
}
|
|
2730
|
-
},
|
|
2731
|
-
channelMix: audioOutputsData.stereo
|
|
2732
|
-
/*distortion: {
|
|
2733
|
-
sinOffset: 0,
|
|
2734
|
-
sinScale: 1,
|
|
2735
|
-
cosOffset: 0,
|
|
2736
|
-
cosScale: 1,
|
|
2737
|
-
tanOffset: 0,
|
|
2738
|
-
tanScale: 1,
|
|
2739
|
-
offset: 0,
|
|
2740
|
-
scale: 1
|
|
2741
|
-
}*/
|
|
2742
|
-
};
|
|
2743
|
+
data = structuredClone(DEFAULT_FILTER_DATAS);
|
|
2743
2744
|
/** The Player assigned to this Filter Manager */
|
|
2744
2745
|
player;
|
|
2745
2746
|
/** The Constructor for the FilterManager */
|
|
@@ -2912,6 +2913,7 @@ var FilterManager = class {
|
|
|
2912
2913
|
*/
|
|
2913
2914
|
async setVolume(volume) {
|
|
2914
2915
|
if (volume < 0 || volume > 5) throw new SyntaxError("Volume-Filter must be between 0 and 5");
|
|
2916
|
+
this.data = this.data ?? {};
|
|
2915
2917
|
this.data.volume = volume;
|
|
2916
2918
|
this.filters.volume = volume !== 1;
|
|
2917
2919
|
await this.applyPlayerFilters();
|
|
@@ -2925,6 +2927,7 @@ var FilterManager = class {
|
|
|
2925
2927
|
async setAudioOutput(type) {
|
|
2926
2928
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("channelMix")) throw new Error("Node#Info#filters does not include the 'channelMix' Filter (Node has it not enable)");
|
|
2927
2929
|
if (!type || !audioOutputsData[type]) throw "Invalid audio type added, must be 'mono' / 'stereo' / 'left' / 'right'";
|
|
2930
|
+
this.data = this.data ?? {};
|
|
2928
2931
|
this.data.channelMix = audioOutputsData[type];
|
|
2929
2932
|
this.filters.audioOutput = type;
|
|
2930
2933
|
await this.applyPlayerFilters();
|
|
@@ -2937,14 +2940,10 @@ var FilterManager = class {
|
|
|
2937
2940
|
*/
|
|
2938
2941
|
async setSpeed(speed = 1) {
|
|
2939
2942
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
this.filters.nightcore = false;
|
|
2945
|
-
this.filters.vaporwave = false;
|
|
2946
|
-
}
|
|
2947
|
-
this.data.timescale.speed = speed;
|
|
2943
|
+
this.data = this.data ?? {};
|
|
2944
|
+
this.filters.nightcore = false;
|
|
2945
|
+
this.filters.vaporwave = false;
|
|
2946
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, speed };
|
|
2948
2947
|
this.isCustomFilterActive();
|
|
2949
2948
|
await this.applyPlayerFilters();
|
|
2950
2949
|
return this.filters.custom;
|
|
@@ -2956,14 +2955,10 @@ var FilterManager = class {
|
|
|
2956
2955
|
*/
|
|
2957
2956
|
async setPitch(pitch = 1) {
|
|
2958
2957
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
this.filters.nightcore = false;
|
|
2964
|
-
this.filters.vaporwave = false;
|
|
2965
|
-
}
|
|
2966
|
-
this.data.timescale.pitch = pitch;
|
|
2958
|
+
this.data = this.data ?? {};
|
|
2959
|
+
this.filters.nightcore = false;
|
|
2960
|
+
this.filters.vaporwave = false;
|
|
2961
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, pitch };
|
|
2967
2962
|
this.isCustomFilterActive();
|
|
2968
2963
|
await this.applyPlayerFilters();
|
|
2969
2964
|
return this.filters.custom;
|
|
@@ -2975,14 +2970,10 @@ var FilterManager = class {
|
|
|
2975
2970
|
*/
|
|
2976
2971
|
async setRate(rate = 1) {
|
|
2977
2972
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
this.filters.nightcore = false;
|
|
2983
|
-
this.filters.vaporwave = false;
|
|
2984
|
-
}
|
|
2985
|
-
this.data.timescale.rate = rate;
|
|
2973
|
+
this.data = this.data ?? {};
|
|
2974
|
+
this.filters.nightcore = false;
|
|
2975
|
+
this.filters.vaporwave = false;
|
|
2976
|
+
this.data.timescale = { ...DEFAULT_FILTER_DATAS.timescale, rate };
|
|
2986
2977
|
this.isCustomFilterActive();
|
|
2987
2978
|
await this.applyPlayerFilters();
|
|
2988
2979
|
return this.filters.custom;
|
|
@@ -2994,7 +2985,8 @@ var FilterManager = class {
|
|
|
2994
2985
|
*/
|
|
2995
2986
|
async toggleRotation(rotationHz = 0.2) {
|
|
2996
2987
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("rotation")) throw new Error("Node#Info#filters does not include the 'rotation' Filter (Node has it not enable)");
|
|
2997
|
-
this.data
|
|
2988
|
+
this.data = this.data ?? {};
|
|
2989
|
+
this.data.rotation = this.filters.rotation ? DEFAULT_FILTER_DATAS.rotation : { rotationHz };
|
|
2998
2990
|
this.filters.rotation = !this.filters.rotation;
|
|
2999
2991
|
await this.applyPlayerFilters();
|
|
3000
2992
|
return this.filters.rotation;
|
|
@@ -3007,8 +2999,8 @@ var FilterManager = class {
|
|
|
3007
2999
|
*/
|
|
3008
3000
|
async toggleVibrato(frequency = 10, depth = 1) {
|
|
3009
3001
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("vibrato")) throw new Error("Node#Info#filters does not include the 'vibrato' Filter (Node has it not enable)");
|
|
3010
|
-
this.data
|
|
3011
|
-
this.data.vibrato
|
|
3002
|
+
this.data = this.data ?? {};
|
|
3003
|
+
this.data.vibrato = this.filters.vibrato ? DEFAULT_FILTER_DATAS.vibrato : { depth, frequency };
|
|
3012
3004
|
this.filters.vibrato = !this.filters.vibrato;
|
|
3013
3005
|
await this.applyPlayerFilters();
|
|
3014
3006
|
return this.filters.vibrato;
|
|
@@ -3021,8 +3013,8 @@ var FilterManager = class {
|
|
|
3021
3013
|
*/
|
|
3022
3014
|
async toggleTremolo(frequency = 4, depth = 0.8) {
|
|
3023
3015
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("tremolo")) throw new Error("Node#Info#filters does not include the 'tremolo' Filter (Node has it not enable)");
|
|
3024
|
-
this.data
|
|
3025
|
-
this.data.tremolo
|
|
3016
|
+
this.data = this.data ?? {};
|
|
3017
|
+
this.data.tremolo = this.filters.tremolo ? DEFAULT_FILTER_DATAS.tremolo : { depth, frequency };
|
|
3026
3018
|
this.filters.tremolo = !this.filters.tremolo;
|
|
3027
3019
|
await this.applyPlayerFilters();
|
|
3028
3020
|
return this.filters.tremolo;
|
|
@@ -3034,7 +3026,8 @@ var FilterManager = class {
|
|
|
3034
3026
|
*/
|
|
3035
3027
|
async toggleLowPass(smoothing = 20) {
|
|
3036
3028
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("lowPass")) throw new Error("Node#Info#filters does not include the 'lowPass' Filter (Node has it not enable)");
|
|
3037
|
-
this.data
|
|
3029
|
+
this.data = this.data ?? {};
|
|
3030
|
+
this.data.lowPass = this.filters.lowPass ? DEFAULT_FILTER_DATAS.lowPass : { smoothing };
|
|
3038
3031
|
this.filters.lowPass = !this.filters.lowPass;
|
|
3039
3032
|
await this.applyPlayerFilters();
|
|
3040
3033
|
return this.filters.lowPass;
|
|
@@ -3049,17 +3042,10 @@ var FilterManager = class {
|
|
|
3049
3042
|
toggleLowPass: async (boostFactor = 1, cutoffFrequency = 80) => {
|
|
3050
3043
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3051
3044
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("low-pass")) throw new Error("Node#Info#filters does not include the 'low-pass' Filter (Node has it not enable)");
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
if (
|
|
3055
|
-
|
|
3056
|
-
delete this.data.pluginFilters["low-pass"];
|
|
3057
|
-
} else {
|
|
3058
|
-
this.data.pluginFilters["low-pass"] = {
|
|
3059
|
-
boostFactor,
|
|
3060
|
-
cutoffFrequency
|
|
3061
|
-
};
|
|
3062
|
-
}
|
|
3045
|
+
this.data = this.data ?? {};
|
|
3046
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3047
|
+
if (this.filters.lavalinkLavaDspxPlugin.lowPass) delete this.data.pluginFilters["low-pass"];
|
|
3048
|
+
else this.data.pluginFilters["low-pass"] = { boostFactor, cutoffFrequency };
|
|
3063
3049
|
this.filters.lavalinkLavaDspxPlugin.lowPass = !this.filters.lavalinkLavaDspxPlugin.lowPass;
|
|
3064
3050
|
await this.applyPlayerFilters();
|
|
3065
3051
|
return this.filters.lavalinkLavaDspxPlugin.lowPass;
|
|
@@ -3073,17 +3059,10 @@ var FilterManager = class {
|
|
|
3073
3059
|
toggleHighPass: async (boostFactor = 1, cutoffFrequency = 80) => {
|
|
3074
3060
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3075
3061
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("high-pass")) throw new Error("Node#Info#filters does not include the 'high-pass' Filter (Node has it not enable)");
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
if (
|
|
3079
|
-
|
|
3080
|
-
delete this.data.pluginFilters["high-pass"];
|
|
3081
|
-
} else {
|
|
3082
|
-
this.data.pluginFilters["high-pass"] = {
|
|
3083
|
-
boostFactor,
|
|
3084
|
-
cutoffFrequency
|
|
3085
|
-
};
|
|
3086
|
-
}
|
|
3062
|
+
this.data = this.data ?? {};
|
|
3063
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3064
|
+
if (this.filters.lavalinkLavaDspxPlugin.highPass) delete this.data.pluginFilters["high-pass"];
|
|
3065
|
+
else this.data.pluginFilters["high-pass"] = { boostFactor, cutoffFrequency };
|
|
3087
3066
|
this.filters.lavalinkLavaDspxPlugin.highPass = !this.filters.lavalinkLavaDspxPlugin.highPass;
|
|
3088
3067
|
await this.applyPlayerFilters();
|
|
3089
3068
|
return this.filters.lavalinkLavaDspxPlugin.highPass;
|
|
@@ -3097,17 +3076,10 @@ var FilterManager = class {
|
|
|
3097
3076
|
toggleNormalization: async (maxAmplitude = 0.75, adaptive = true) => {
|
|
3098
3077
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3099
3078
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("normalization")) throw new Error("Node#Info#filters does not include the 'normalization' Filter (Node has it not enable)");
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
if (
|
|
3103
|
-
|
|
3104
|
-
delete this.data.pluginFilters.normalization;
|
|
3105
|
-
} else {
|
|
3106
|
-
this.data.pluginFilters.normalization = {
|
|
3107
|
-
adaptive,
|
|
3108
|
-
maxAmplitude
|
|
3109
|
-
};
|
|
3110
|
-
}
|
|
3079
|
+
this.data = this.data ?? {};
|
|
3080
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3081
|
+
if (this.filters.lavalinkLavaDspxPlugin.normalization) delete this.data.pluginFilters.normalization;
|
|
3082
|
+
else this.data.pluginFilters.normalization = { adaptive, maxAmplitude };
|
|
3111
3083
|
this.filters.lavalinkLavaDspxPlugin.normalization = !this.filters.lavalinkLavaDspxPlugin.normalization;
|
|
3112
3084
|
await this.applyPlayerFilters();
|
|
3113
3085
|
return this.filters.lavalinkLavaDspxPlugin.normalization;
|
|
@@ -3121,17 +3093,10 @@ var FilterManager = class {
|
|
|
3121
3093
|
toggleEcho: async (decay = 0.5, echoLength = 0.5) => {
|
|
3122
3094
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavadspx-plugin")) throw new Error("Node#Info#plugins does not include the lavadspx plugin");
|
|
3123
3095
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable)");
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
if (
|
|
3127
|
-
|
|
3128
|
-
delete this.data.pluginFilters.echo;
|
|
3129
|
-
} else {
|
|
3130
|
-
this.data.pluginFilters.echo = {
|
|
3131
|
-
decay,
|
|
3132
|
-
echoLength
|
|
3133
|
-
};
|
|
3134
|
-
}
|
|
3096
|
+
this.data = this.data ?? {};
|
|
3097
|
+
this.data.pluginFilters = this.data.pluginFilters ?? {};
|
|
3098
|
+
if (this.filters.lavalinkLavaDspxPlugin.echo) delete this.data.pluginFilters.echo;
|
|
3099
|
+
else this.data.pluginFilters.echo = { decay, echoLength };
|
|
3135
3100
|
this.filters.lavalinkLavaDspxPlugin.echo = !this.filters.lavalinkLavaDspxPlugin.echo;
|
|
3136
3101
|
await this.applyPlayerFilters();
|
|
3137
3102
|
return this.filters.lavalinkLavaDspxPlugin.echo;
|
|
@@ -3147,12 +3112,15 @@ var FilterManager = class {
|
|
|
3147
3112
|
toggleEcho: async (delay = 4, decay = 0.8) => {
|
|
3148
3113
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
|
|
3149
3114
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("echo")) throw new Error("Node#Info#filters does not include the 'echo' Filter (Node has it not enable aka not installed!)");
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3115
|
+
this.data = this.data ?? {};
|
|
3116
|
+
const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
|
|
3117
|
+
this.data.pluginFilters = {
|
|
3118
|
+
...this.data.pluginFilters,
|
|
3119
|
+
["lavalink-filter-plugin"]: {
|
|
3120
|
+
reverb: this.data.pluginFilters?.["lavalink-filter-plugin"]?.reverb ?? reverb,
|
|
3121
|
+
echo: this.filters.lavalinkFilterPlugin.echo ? echo : { delay, decay }
|
|
3122
|
+
}
|
|
3123
|
+
};
|
|
3156
3124
|
this.filters.lavalinkFilterPlugin.echo = !this.filters.lavalinkFilterPlugin.echo;
|
|
3157
3125
|
await this.applyPlayerFilters();
|
|
3158
3126
|
return this.filters.lavalinkFilterPlugin.echo;
|
|
@@ -3166,12 +3134,15 @@ var FilterManager = class {
|
|
|
3166
3134
|
toggleReverb: async (delays = [0.037, 0.042, 0.048, 0.053], gains = [0.84, 0.83, 0.82, 0.81]) => {
|
|
3167
3135
|
if (this.player.node.info && !this.player.node.info?.plugins?.find((v) => v.name === "lavalink-filter-plugin")) throw new Error("Node#Info#plugins does not include the lavalink-filter-plugin plugin");
|
|
3168
3136
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("reverb")) throw new Error("Node#Info#filters does not include the 'reverb' Filter (Node has it not enable aka not installed!)");
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3137
|
+
this.data = this.data ?? {};
|
|
3138
|
+
const { echo, reverb } = DEFAULT_FILTER_DATAS.pluginFilters["lavalink-filter-plugin"];
|
|
3139
|
+
this.data.pluginFilters = {
|
|
3140
|
+
...this.data.pluginFilters,
|
|
3141
|
+
["lavalink-filter-plugin"]: {
|
|
3142
|
+
echo: this.data.pluginFilters?.["lavalink-filter-plugin"]?.echo ?? echo,
|
|
3143
|
+
reverb: this.filters.lavalinkFilterPlugin.reverb ? reverb : { delays, gains }
|
|
3144
|
+
}
|
|
3145
|
+
};
|
|
3175
3146
|
this.filters.lavalinkFilterPlugin.reverb = !this.filters.lavalinkFilterPlugin.reverb;
|
|
3176
3147
|
await this.applyPlayerFilters();
|
|
3177
3148
|
return this.filters.lavalinkFilterPlugin.reverb;
|
|
@@ -3186,9 +3157,8 @@ var FilterManager = class {
|
|
|
3186
3157
|
*/
|
|
3187
3158
|
async toggleNightcore(speed = 1.289999523162842, pitch = 1.289999523162842, rate = 0.9365999523162842) {
|
|
3188
3159
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3189
|
-
this.data
|
|
3190
|
-
this.data.timescale
|
|
3191
|
-
this.data.timescale.rate = this.filters.nightcore ? 1 : rate;
|
|
3160
|
+
this.data = this.data ?? {};
|
|
3161
|
+
this.data.timescale = this.filters.nightcore ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
|
|
3192
3162
|
this.filters.nightcore = !this.filters.nightcore;
|
|
3193
3163
|
this.filters.vaporwave = false;
|
|
3194
3164
|
this.filters.custom = false;
|
|
@@ -3204,9 +3174,8 @@ var FilterManager = class {
|
|
|
3204
3174
|
*/
|
|
3205
3175
|
async toggleVaporwave(speed = 0.8500000238418579, pitch = 0.800000011920929, rate = 1) {
|
|
3206
3176
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("timescale")) throw new Error("Node#Info#filters does not include the 'timescale' Filter (Node has it not enable)");
|
|
3207
|
-
this.data
|
|
3208
|
-
this.data.timescale
|
|
3209
|
-
this.data.timescale.rate = this.filters.vaporwave ? 1 : rate;
|
|
3177
|
+
this.data = this.data ?? {};
|
|
3178
|
+
this.data.timescale = this.filters.vaporwave ? DEFAULT_FILTER_DATAS.timescale : { speed, pitch, rate };
|
|
3210
3179
|
this.filters.vaporwave = !this.filters.vaporwave;
|
|
3211
3180
|
this.filters.nightcore = false;
|
|
3212
3181
|
this.filters.custom = false;
|
|
@@ -3223,10 +3192,8 @@ var FilterManager = class {
|
|
|
3223
3192
|
*/
|
|
3224
3193
|
async toggleKaraoke(level = 1, monoLevel = 1, filterBand = 220, filterWidth = 100) {
|
|
3225
3194
|
if (this.player.node.info && !this.player.node.info?.filters?.includes("karaoke")) throw new Error("Node#Info#filters does not include the 'karaoke' Filter (Node has it not enable)");
|
|
3226
|
-
this.data
|
|
3227
|
-
this.data.karaoke
|
|
3228
|
-
this.data.karaoke.filterBand = this.filters.karaoke ? 0 : filterBand;
|
|
3229
|
-
this.data.karaoke.filterWidth = this.filters.karaoke ? 0 : filterWidth;
|
|
3195
|
+
this.data = this.data ?? {};
|
|
3196
|
+
this.data.karaoke = this.filters.karaoke ? DEFAULT_FILTER_DATAS.karaoke : { level, monoLevel, filterBand, filterWidth };
|
|
3230
3197
|
this.filters.karaoke = !this.filters.karaoke;
|
|
3231
3198
|
await this.applyPlayerFilters();
|
|
3232
3199
|
return this.filters.karaoke;
|
package/package.json
CHANGED