FilterManager
Class representing a filter manager for a player. A filter is active when its key is present in the payload, and inactive when it is absent: there is no neutral "off" payload. {@link FilterManager.set} writes a key, {@link FilterManager.clear} removes it, and {@link FilterManager.isEnabled} is presence. {@link FilterRegistry} routes the filters it knows to their envelope (top level, flat `pluginFilters`, or nested under a plugin) and validates them against the node. Filters it does not know can still be set: their envelope comes from {@link SetFilterOptions} instead, so no registration is required. The commit/envelope internals live in {@link FilterPayload } (util/functions/filters), which takes the manager as an argument rather than through `this` — no private members, matching the project convention.
Signature
export declare class FilterManagerJSDoc
Properties
6Methods
28Properties
readonly player: PlayerStructure;The player this filter manager belongs to.
readonly bands: EQBandSettings[];The bands applied to the player. Kept in sync with `data.equalizer`.
data: FilterSettings;The current filter payload (wire-bound). Starts empty: a key is only present while its filter is active. Mutated by {@link FilterManager.set} and {@link FilterManager.clear}.
readonly plugin: LavalinkPluginFilter;Thin facade for filters provided by the `lavalink-filter-plugin`.
readonly dspx: DSPXPluginFilter;Thin facade for filters provided by the `lavadspx-plugin`.
audioOutputGetterget audioOutput(): AudioOutput;The current audio output mode, derived from `data.channelMix`.
Methods
constructorConstructorconstructor(player: PlayerStructure);set<K extends RegistryFilterName>(name: K, payload: PayloadOf<K>, options?: SetFilterOptions): Promise<this>;Set a filter to `payload` and commit. Any filter can be set, registered or not: {@link SetFilterOptions} decides the envelope when the registry does not know the name (or when you want to override what it resolved). Idempotent — calling repeatedly with the same payload yields the same wire state. The payload is checked against {@link FilterPayloads} for the built-ins and against {@link CustomizableFilters} for anything you declared; a name neither knows takes `unknown`.
Parameters
name- The filter name (or alias) to set.
payload- The payload to write.
options- Envelope and validation options.
Returns
A promise that resolves to the filter manager.
Examples
await player.filterManager.set(FilterType.Echo, { decay: 0.5, delay: 200 }); // registry routes it
await player.filterManager.set("myFilter", { gain: 2 }); // pluginFilters.myFilter
await player.filterManager.set("boost", { gain: 2 }, { plugin: "my-plugin" }); // nested
await player.filterManager.set("forkEcho", { decay: 0.5 }, { top: true }); // top levelapply(): Promise<this>;apply<K extends RegistryFilterName>(name: K, payload: PayloadOf<K>): Promise<this>;Commit the current filter payload to the node. Set the given filter to `payload` and commit.
Use {@link FilterManager.set } instead, which also takes {@link SetFilterOptions } .
Parameters
name- The canonical filter name (or alias) to set.
payload- The payload to write into the envelope chosen by the registry.
Returns
A promise that resolves to the filter manager.
A promise that resolves to the filter manager.
clear(name: RegistryFilterName, options?: SetFilterOptions): Promise<this>;Remove the given filter from the payload and commit. Pass the same {@link SetFilterOptions} routing used to set it, so an unregistered filter is cleared from the envelope it was written to.
Parameters
name- The filter name (or alias) to clear.
options- The routing options used when it was set.
Returns
A promise that resolves to the filter manager.
Examples
await player.filterManager.clear(FilterType.Karaoke);
await player.filterManager.clear("boost", { plugin: "my-plugin" });get<K extends RegistryFilterName>(name: K, options?: SetFilterOptions): PayloadOf<K> | undefined;Read the payload a filter is currently set to. Typed the same way {@link FilterManager.set} is, so there is no need to reach into {@link FilterManager.data} and narrow by hand.
Parameters
name- The filter name (or alias).
options- The routing options used when it was set.
Returns
The payload, or `undefined` when the filter is not active.
Examples
const timescale = player.filterManager.get(FilterType.Timescale); // TimescaleSettings | undefined
const boost = player.filterManager.get("boost", { plugin: "my-plugin" });isEnabled(name: RegistryFilterName, options?: SetFilterOptions): boolean;Whether the given filter is currently active, i.e. whether its key is present in the payload.
Parameters
name- The filter name (or alias).
options- The routing options used when it was set.
Returns
True if the filter has a payload, false otherwise.
getEnabled(): string[];Returns every active filter name as derived from the current payload. Only covers registered filters; keys written for unregistered ones are not listed.
Returns
Canonical filter names present in the payload.
has(filter: RegistryFilterName, options?: SetFilterOptions): boolean;Backward-compatible alias for {@link isEnabled}.
Parameters
filter- The filter to check.
options- The routing options used when it was set.
Returns
True if active.
reset(): Promise<this>;Drop every filter and commit an empty payload.
Returns
A promise that resolves to the filter manager.
toJSON(): FilterSettings;Serialise the current filter payload.
Returns
A deep clone of the wire payload (a snapshot; mutating it never touches live state).
setVolume(volume: number): Promise<this>;Set the volume.
Parameters
volume- Volume between 0 and 5.
setEQBand(...bands: RestOrArray<EQBandSettings>): Promise<this>;Set one or more equalizer bands. Keeps `this.bands` and `data.equalizer` in sync.
clearEQBands(): Promise<this>;Clear every equalizer band.
setKaraoke(settings?: Partial<KaraokeSettings>): Promise<this>;Set the karaoke filter.
setTremolo(settings?: Partial<TremoloSettings>): Promise<this>;Set the tremolo filter.
setVibrato(settings?: Partial<TremoloSettings>): Promise<this>;Set the vibrato filter.
setLowPass(settings?: Partial<LowPassSettings>): Promise<this>;Set the low-pass filter.
setDistortion(settings?: Partial<DistortionSettings>): Promise<this>;Set the distortion filter.
setTimescale(settings: Partial<TimescaleSettings>): Promise<this>;Set the timescale filter explicitly.
setSpeed(speed?: number): Promise<this>;Adjust timescale speed only.
setRate(rate?: number): Promise<this>;Adjust timescale rate only.
setPitch(pitch?: number): Promise<this>;Adjust timescale pitch only.
setNightcore(settings?: Partial<TimescaleSettings>): Promise<this>;Apply the Nightcore preset to the timescale filter.
setVaporwave(settings?: Partial<TimescaleSettings>): Promise<this>;Apply the Vaporwave preset to the timescale filter.
isNightcore(): boolean;Whether the timescale currently matches the Nightcore preset exactly.
isVaporwave(): boolean;Whether the timescale currently matches the Vaporwave preset exactly.
setAudioOutput(output: AudioOutput): Promise<this>;Set the audio output. Writes the matching channelMix preset.
isCustomTimescale(): boolean;Whether the timescale represents any non-default playback rate that is neither Nightcore nor Vaporwave.