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 Type
    Method
    Description
    de.maxhenkel.voicechat.api.VoicechatServerApi
    Gets the underlying VoicechatServerApi instance.
    @Nullable Speaker
    getSpeaker(@NotNull String name)
    Retrieves a speaker by its unique name.
    @Nullable Speaker
    getSpeaker(@NotNull UUID uuid)
    Retrieves a speaker by its UUID.
    Returns all active 3D speakers.
    de.maxhenkel.voicechat.api.VolumeCategory
    Retrieves the VolumeCategory used for speaker audio channels.
    void
    init(@NotNull de.maxhenkel.voicechat.api.VoicechatServerApi api)
    Initializes the speaker service with the Simple Voice Chat server API.
    void
    Reloads saved speakers from disk.
    default void
    playRecording(@NotNull Speaker speaker, @NotNull VoiceRecording recording)
    Plays a recorded voice session through a speaker.
    void
    playRecording(@NotNull Speaker speaker, @NotNull VoiceRecording recording, boolean loop)
    Plays a recorded voice session through a speaker with optional looping.
    default void
    playRecording(@NotNull Collection<Speaker> speakers, @NotNull VoiceRecording recording)
    Plays a recorded voice session through multiple speakers simultaneously.
    default void
    playRecording(@NotNull Collection<Speaker> speakers, @NotNull VoiceRecording recording, boolean loop)
    Plays a recorded voice session through multiple speakers simultaneously with optional looping.
    void
    playSound(@NotNull Speaker speaker, @NotNull short[] pcm)
    Plays raw PCM audio samples through a speaker.
    void
    playSound(@NotNull Speaker speaker, @NotNull short[] pcm, boolean loop)
    Plays raw PCM audio samples through a speaker with optional looping.
    void
    playSoundFile(@NotNull Speaker speaker, @NotNull String fileName, boolean loop)
    Plays an audio file from the `sounds/` directory through a speaker.
    default void
    playSoundFile(@NotNull Collection<Speaker> speakers, @NotNull String fileName, boolean loop)
    Plays an audio file from the `sounds/` directory through multiple speakers simultaneously.
    void
    playSoundUrl(@NotNull Speaker speaker, @NotNull String url, boolean loop)
    Streams a web audio URL through a speaker.
    default void
    playSoundUrl(@NotNull Collection<Speaker> speakers, @NotNull String url, boolean loop)
    Streams a web audio URL through multiple speakers simultaneously.
    void
    register(@NotNull Speaker speaker)
    Registers a speaker into the service registry.
    void
    Saves all active speakers to disk.
    void
    save(@NotNull UUID uuid)
    Saves a specific speaker to disk.
    void
    stopSound(@NotNull Speaker speaker)
    Stops any active sound playback on a speaker.
    void
    unregister(@NotNull Speaker speaker)
    Unregisters a speaker instance.
    void
    unregister(@NotNull UUID uuid)
    Unregisters a speaker by its UUID.
    void
    Clears 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 Speaker instances
    • getSpeaker

      @Nullable @Nullable Speaker getSpeaker(@NotNull @NotNull UUID uuid)
      Retrieves a speaker by its UUID.
      Parameters:
      uuid - the speaker UUID
      Returns:
      the Speaker, or null if not found
    • getSpeaker

      @Nullable @Nullable Speaker getSpeaker(@NotNull @NotNull String name)
      Retrieves a speaker by its unique name.
      Parameters:
      name - the speaker name
      Returns:
      the Speaker, or null if not found
    • register

      void register(@NotNull @NotNull Speaker speaker)
      Registers a speaker into the service registry.
      Parameters:
      speaker - the speaker instance
    • unregister

      void unregister(@NotNull @NotNull UUID uuid)
      Unregisters a speaker by its UUID.
      Parameters:
      uuid - the speaker UUID
    • unregister

      void unregister(@NotNull @NotNull Speaker speaker)
      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 speaker
      recording - 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 speaker
      recording - the voice recording to play
      loop - 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 speakers
      recording - 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 speakers
      recording - the voice recording to play
      loop - whether playback should loop
    • playSound

      void playSound(@NotNull @NotNull Speaker speaker, @NotNull @NotNull short[] pcm)
      Plays raw PCM audio samples through a speaker.
      Parameters:
      speaker - the target speaker
      pcm - raw 16-bit 48kHz audio samples
    • playSound

      void playSound(@NotNull @NotNull Speaker speaker, @NotNull @NotNull short[] pcm, boolean loop)
      Plays raw PCM audio samples through a speaker with optional looping.
      Parameters:
      speaker - the target speaker
      pcm - raw 16-bit 48kHz audio samples
      loop - whether playback should loop
    • playSoundFile

      void playSoundFile(@NotNull @NotNull Speaker speaker, @NotNull @NotNull String fileName, boolean loop)
      Plays an audio file from the `sounds/` directory through a speaker.
      Parameters:
      speaker - the target speaker
      fileName - file name relative to sounds folder
      loop - whether playback should loop
    • 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 speakers
      fileName - file name relative to sounds folder
      loop - whether playback should loop
    • playSoundUrl

      void playSoundUrl(@NotNull @NotNull Speaker speaker, @NotNull @NotNull String url, boolean loop)
      Streams a web audio URL through a speaker.
      Parameters:
      speaker - the target speaker
      url - the audio stream URL
      loop - whether playback should loop
    • 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 speakers
      url - the audio stream URL
      loop - whether playback should loop
    • stopSound

      void stopSound(@NotNull @NotNull Speaker speaker)
      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

      void save(@NotNull @NotNull UUID uuid)
      Saves a specific speaker to disk.
      Parameters:
      uuid - the speaker UUID