Class GuildFilters
- Namespace
- Nyra
- Assembly
- Nyra.dll
The audio filters of a guild connection.
public sealed class GuildFilters
- Inheritance
-
GuildFilters
- Inherited Members
Properties
Applied
The filter chain as last written or refreshed.
public FilterChain Applied { get; }
Property Value
Remarks
An out-of-band change by a co-client only reaches this surface through the next refresh, the server confirms those through the websocket event, which this surface does not ingest. A filter write does not pick the change up either, it re-sends from Nyra's own view and replaces the co-client's change.
Methods
AddAsync(IFilter, CancellationToken)
Applies an audio filter, replacing the previous filter of the same kind.
public Task AddAsync(IFilter filter, CancellationToken cancellationToken = default)
Parameters
filterIFilterThe filter to apply.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the filter was applied.
Exceptions
- ArgumentNullException
filteris null.- ArgumentException
filteris a user-defined implementation of IFilter, the supported set is limited to this library's sealed filter records.- ArgumentOutOfRangeException
A member of the filter is outside the bounds the record documents, is not a finite number, or a no-op form (every gating member null) of the rate-guarded filters (echo, chorus, phaser, flanger) was sent.
- NotSupportedException
The node is not NodeLink, for the filter kinds and transitions it alone supports, or the filter is disabled in the server's config.
ApplyAsync(FilterChain, CancellationToken)
Applies a complete filter chain, replacing everything applied so far, filters left null are cleared.
public Task ApplyAsync(FilterChain filters, CancellationToken cancellationToken = default)
Parameters
filtersFilterChainThe full chain of filters to apply.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the chain was applied.
Exceptions
- ArgumentNullException
filtersis null.- ArgumentOutOfRangeException
A member of the chain is outside the bounds the record documents, is not a finite number, or a no-op form (every gating member null) was sent.
- NotSupportedException
The node is not NodeLink, for the filter kinds and transitions it alone supports, or a member of the chain is disabled in the server's config.
ClearAsync(CancellationToken)
Removes all audio filters, including the volume filter, the equalizer and plugin filters.
public Task ClearAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the chain was cleared.
RemoveAsync(IFilter, CancellationToken)
Removes the audio filter of the same kind as the given one, matching is by filter type, not by value.
public Task RemoveAsync(IFilter filter, CancellationToken cancellationToken = default)
Parameters
filterIFilterThe filter of the chain to remove.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the filter was removed.
Exceptions
- ArgumentNullException
filteris null.- ArgumentException
filteris a user-defined implementation of IFilter.
RemoveAsync<TFilter>(CancellationToken)
Removes the filter of the given kind from the chain, keeping the rest.
public Task RemoveAsync<TFilter>(CancellationToken cancellationToken = default) where TFilter : IFilter
Parameters
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the filter was removed.
Type Parameters
TFilterThe kind of filter to remove.
Exceptions
- ArgumentException
TFilteris a user-defined implementation of IFilter.
SetEqualizerAsync(IReadOnlyList<EqualizerBand>?, CancellationToken)
Sets the equalizer bands, replacing the previous ones, an empty list clears the equalizer.
public Task SetEqualizerAsync(IReadOnlyList<EqualizerBand>? bands = null, CancellationToken cancellationToken = default)
Parameters
bandsIReadOnlyList<EqualizerBand>The bands to apply, null clears the equalizer. Band ids are map keys, a list carrying the same id twice sends both entries, the server collapses them, the last one wins.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the equalizer was applied.
Exceptions
- ArgumentOutOfRangeException
A band is outside the bounds EqualizerBand documents.
- NotSupportedException
The node is not NodeLink, for the transitions it alone supports, or the equalizer is disabled in the server's config.
SetVolumeFilterAsync(float, CancellationToken)
Sets the volume filter (0.0-5.0, 1.0 disables it), independent of the player volume, above 1.0 may clip.
public Task SetVolumeFilterAsync(float volume, CancellationToken cancellationToken = default)
Parameters
volumefloatHow loud the filter plays the track, 1.0 leaves it unchanged.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the volume filter was set.
Remarks
Lavalink only.
Exceptions
- NotSupportedException
The node is a NodeLink server, or the volume filter is disabled in the server's config.