Interface VoiceFilterService
public interface VoiceFilterService
Service managing DSP voice filters, active player filter stacks, and filter chains.
-
Method Summary
Modifier and TypeMethodDescriptionvoidApplies an active filter to a player's outgoing voice stream.short[]applyFilters(@NotNull UUID playerUuid, short @NotNull [] samples) Passes raw PCM samples through the player's active filter chain and returns processed audio.voidclearFilters(@NotNull UUID playerUuid) Clears all active filters from a player.exportFilter(@NotNull String filterId, @NotNull String format) Exports an existing registered filter to disk in the specified format (yml, json, java).@NotNull List<VoiceFilter> getActiveFilters(@NotNull UUID playerUuid) Retrieves all active filters attached to a player, ordered by priority.@NotNull Collection<VoiceFilter> Returns all currently registered voice filters.@Nullable VoiceFilterRetrieves a registered voice filter by its ID.Returns the directory where file-based filters (.yml, .json, .java) are located.booleanhasActiveFilters(@NotNull UUID playerUuid) Checks whether a player has any active filters (including environmental ones).booleanhasExplicitFilters(@NotNull UUID playerUuid) Checks whether a player has any manually configured filters (excluding auto-environmental filters).booleanisAutoEnvironmentEnabled(@NotNull UUID playerUuid) Checks whether auto-environmental filtering (underwater, caves, etc.) is enabled for a player.@Nullable VoiceFilterloadFilterFromFile(File file) Loads or compiles a voice filter from a file (.yml, .json, or .java).@NotNull List<VoiceFilter> registerAnnotatedFilters(@NotNull Collection<Class<?>> classes) Automatically discovers, instantiates, and registers allVoiceFilterclasses annotated withAutoVoiceFilterfrom the given collection.voidregisterFilter(@NotNull VoiceFilter filter) Registers a custom DSP voice filter into the registry.voidReloads all filters from the configuration/file filter directory.voidremoveFilter(@NotNull UUID playerUuid, @NotNull String filterId) Removes an active filter from a player.voidsetAutoEnvironmentEnabled(@NotNull UUID playerUuid, boolean enabled) Toggles auto-environmental filtering for a player.voidunregisterFilter(@NotNull String filterId) Unregisters a DSP voice filter by its ID.
-
Method Details
-
registerFilter
Registers a custom DSP voice filter into the registry.- Parameters:
filter- the filter instance to register
-
unregisterFilter
Unregisters a DSP voice filter by its ID.- Parameters:
filterId- the identifier of the filter
-
getFilter
Retrieves a registered voice filter by its ID.- Parameters:
filterId- the identifier of the filter- Returns:
- the
VoiceFilter, ornullif not found
-
getAvailableFilters
Returns all currently registered voice filters.- Returns:
- collection of available voice filters
-
addFilter
-
removeFilter
-
clearFilters
Clears all active filters from a player.- Parameters:
playerUuid- the UUID of the player
-
getActiveFilters
Retrieves all active filters attached to a player, ordered by priority.- Parameters:
playerUuid- the UUID of the player- Returns:
- list of active
VoiceFilters
-
hasActiveFilters
Checks whether a player has any active filters (including environmental ones).- Parameters:
playerUuid- the UUID of the player- Returns:
trueif at least one filter is active
-
hasExplicitFilters
Checks whether a player has any manually configured filters (excluding auto-environmental filters).- Parameters:
playerUuid- the UUID of the player- Returns:
trueif at least one explicit filter is attached
-
isAutoEnvironmentEnabled
Checks whether auto-environmental filtering (underwater, caves, etc.) is enabled for a player.- Parameters:
playerUuid- the UUID of the player- Returns:
trueif auto-environment is enabled
-
setAutoEnvironmentEnabled
Toggles auto-environmental filtering for a player.- Parameters:
playerUuid- the UUID of the playerenabled- whether auto-environment should be enabled
-
registerAnnotatedFilters
@NotNull @NotNull List<VoiceFilter> registerAnnotatedFilters(@NotNull @NotNull Collection<Class<?>> classes) Automatically discovers, instantiates, and registers allVoiceFilterclasses annotated withAutoVoiceFilterfrom the given collection.- Parameters:
classes- collection of classes to scan- Returns:
- list of successfully instantiated and registered filters
-
reloadFilters
void reloadFilters()Reloads all filters from the configuration/file filter directory. -
getFilterDirectory
Returns the directory where file-based filters (.yml, .json, .java) are located.- Returns:
- directory file
-
loadFilterFromFile
Loads or compiles a voice filter from a file (.yml, .json, or .java).- Parameters:
file- the source file- Returns:
- the loaded voice filter, or null if loading failed
-
exportFilter
Exports an existing registered filter to disk in the specified format (yml, json, java).- Parameters:
filterId- the identifier of the filter to exportformat- target format ("yml", "json", "java")- Returns:
- the exported File on disk, or null if export failed or filter was not found
-
applyFilters
Passes raw PCM samples through the player's active filter chain and returns processed audio.- Parameters:
playerUuid- the UUID of the playersamples- raw 16-bit 48kHz audio samples- Returns:
- processed audio samples
-