Interface VoiceSpeakerService
public interface VoiceSpeakerService
Service managing 3D locational speakers, dual-channel playback (voice + background audio),
entity tracking, and access restrictions.
-
Method Summary
Modifier and TypeMethodDescriptionde.maxhenkel.voicechat.api.VoicechatServerApigetAPI()Gets the underlying VoicechatServerApi instance.@Nullable SpeakergetSpeaker(@NotNull String name) Retrieves a speaker by its unique name.@Nullable SpeakergetSpeaker(@NotNull UUID uuid) Retrieves a speaker by its UUID.Returns all active 3D speakers.de.maxhenkel.voicechat.api.VolumeCategoryRetrieves the VolumeCategory used for speaker audio channels.voidinit(@NotNull de.maxhenkel.voicechat.api.VoicechatServerApi api) Initializes the speaker service with the Simple Voice Chat server API.voidload()Reloads saved speakers from disk.default voidplayRecording(@NotNull Speaker speaker, @NotNull VoiceRecording recording) Plays a recorded voice session through a speaker.voidplayRecording(@NotNull Speaker speaker, @NotNull VoiceRecording recording, boolean loop) Plays a recorded voice session through a speaker with optional looping.default voidplayRecording(@NotNull Collection<Speaker> speakers, @NotNull VoiceRecording recording) Plays a recorded voice session through multiple speakers simultaneously.default voidplayRecording(@NotNull Collection<Speaker> speakers, @NotNull VoiceRecording recording, boolean loop) Plays a recorded voice session through multiple speakers simultaneously with optional looping.voidPlays raw PCM audio samples through a speaker.voidPlays raw PCM audio samples through a speaker with optional looping.voidplaySoundFile(@NotNull Speaker speaker, @NotNull String fileName, boolean loop) Plays an audio file from the `sounds/` directory through a speaker.default voidplaySoundFile(@NotNull Collection<Speaker> speakers, @NotNull String fileName, boolean loop) Plays an audio file from the `sounds/` directory through multiple speakers simultaneously.voidplaySoundUrl(@NotNull Speaker speaker, @NotNull String url, boolean loop) Streams a web audio URL through a speaker.default voidplaySoundUrl(@NotNull Collection<Speaker> speakers, @NotNull String url, boolean loop) Streams a web audio URL through multiple speakers simultaneously.voidRegisters a speaker into the service registry.voidsave()Saves all active speakers to disk.voidSaves a specific speaker to disk.voidStops any active sound playback on a speaker.voidunregister(@NotNull Speaker speaker) Unregisters a speaker instance.voidunregister(@NotNull UUID uuid) Unregisters a speaker by its UUID.voidClears and unregisters all active speakers.
-
Method Details
-
getAPI
de.maxhenkel.voicechat.api.VoicechatServerApi getAPI()Gets the underlying VoicechatServerApi instance.- Returns:
- the active API instance
-
init
void init(@NotNull @NotNull de.maxhenkel.voicechat.api.VoicechatServerApi api) Initializes the speaker service with the Simple Voice Chat server API.- Parameters:
api- the VoicechatServerApi instance
-
getSpeakers
Collection<Speaker> getSpeakers()Returns all active 3D speakers.- Returns:
- collection of
Speakerinstances
-
getSpeaker
-
getSpeaker
-
register
Registers a speaker into the service registry.- Parameters:
speaker- the speaker instance
-
unregister
Unregisters a speaker by its UUID.- Parameters:
uuid- the speaker UUID
-
unregister
Unregisters a speaker instance.- Parameters:
speaker- the speaker instance
-
unregisterAll
void unregisterAll()Clears and unregisters all active speakers. -
getVolumeCategory
de.maxhenkel.voicechat.api.VolumeCategory getVolumeCategory()Retrieves the VolumeCategory used for speaker audio channels.- Returns:
- the
VolumeCategory
-
playRecording
default void playRecording(@NotNull @NotNull Speaker speaker, @NotNull @NotNull VoiceRecording recording) Plays a recorded voice session through a speaker.- Parameters:
speaker- the target speakerrecording- the voice recording to play
-
playRecording
void playRecording(@NotNull @NotNull Speaker speaker, @NotNull @NotNull VoiceRecording recording, boolean loop) Plays a recorded voice session through a speaker with optional looping.- Parameters:
speaker- the target speakerrecording- the voice recording to playloop- whether playback should loop
-
playRecording
default void playRecording(@NotNull @NotNull Collection<Speaker> speakers, @NotNull @NotNull VoiceRecording recording) Plays a recorded voice session through multiple speakers simultaneously.- Parameters:
speakers- the target speakersrecording- the voice recording to play
-
playRecording
default void playRecording(@NotNull @NotNull Collection<Speaker> speakers, @NotNull @NotNull VoiceRecording recording, boolean loop) Plays a recorded voice session through multiple speakers simultaneously with optional looping.- Parameters:
speakers- the target speakersrecording- the voice recording to playloop- whether playback should loop
-
playSound
Plays raw PCM audio samples through a speaker.- Parameters:
speaker- the target speakerpcm- raw 16-bit 48kHz audio samples
-
playSound
Plays raw PCM audio samples through a speaker with optional looping.- Parameters:
speaker- the target speakerpcm- raw 16-bit 48kHz audio samplesloop- whether playback should loop
-
playSoundFile
-
playSoundFile
default void playSoundFile(@NotNull @NotNull Collection<Speaker> speakers, @NotNull @NotNull String fileName, boolean loop) Plays an audio file from the `sounds/` directory through multiple speakers simultaneously.- Parameters:
speakers- the target speakersfileName- file name relative to sounds folderloop- whether playback should loop
-
playSoundUrl
-
playSoundUrl
default void playSoundUrl(@NotNull @NotNull Collection<Speaker> speakers, @NotNull @NotNull String url, boolean loop) Streams a web audio URL through multiple speakers simultaneously.- Parameters:
speakers- the target speakersurl- the audio stream URLloop- whether playback should loop
-
stopSound
Stops any active sound playback on a speaker.- Parameters:
speaker- the target speaker
-
save
void save()Saves all active speakers to disk. -
load
void load()Reloads saved speakers from disk. -
save
Saves a specific speaker to disk.- Parameters:
uuid- the speaker UUID
-