Interface AudioChannel
- All Known Subinterfaces:
EntityAudioChannel
,LocationalAudioChannel
,StaticAudioChannel
public interface AudioChannel
-
Method Summary
Modifier and TypeMethodDescriptionvoid
flush()
Call this if you are finished sending data.getId()
boolean
isClosed()
void
send
(byte[] opusData) Sends the audio data to this audio channel.void
send
(MicrophonePacket packet) Forwards the provided microphone packet to this audio channel.void
setCategory
(String category) Make sure you registered your category before using it.void
setFilter
(Predicate<ServerPlayer> filter) Applies a filter to the audio channel.
-
Method Details
-
send
void send(byte[] opusData) Sends the audio data to this audio channel.- Parameters:
opusData
- Opus encoded audio data
-
send
Forwards the provided microphone packet to this audio channel.- Parameters:
packet
- the microphone packet containing the audio data
-
setFilter
Applies a filter to the audio channel.- Parameters:
filter
- only sends the data to players where the filter applies
-
flush
void flush()Call this if you are finished sending data. You can still use this audio channel after calling this function, just don't call it after every packet, only after you are finished sending data. -
isClosed
boolean isClosed()- Returns:
- if the audio channel is closed
-
getId
UUID getId()- Returns:
- the ID of the audio channel
-
getCategory
- Returns:
- the category ID of the audio channel
-
setCategory
Make sure you registered your category before using it. SeeVoicechatServerApi.registerVolumeCategory(VolumeCategory)
.- Parameters:
category
- the category ID of the audio channel
-