Package de.maxhenkel.voicechat.api
Interface VoicechatApi
- All Known Subinterfaces:
VoicechatClientApi
,VoicechatServerApi
public interface VoicechatApi
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new opus decoder.Creates a new opus encoder.createEncoder
(OpusEncoderMode mode) Creates a new opus encoder.createMp3Decoder
(InputStream inputStream) NOTE: This is not available for Bukkit! It will always return null.createMp3Encoder
(AudioFormat audioFormat, int bitrate, int quality, OutputStream outputStream) NOTE: This is not available for Bukkit! It will always return null.createPosition
(double x, double y, double z) Creates a new position object.fromEntity
(Object entity) Creates an entity object from an actual entity.fromServerLevel
(Object serverLevel) Creates a level object from an actual level.fromServerPlayer
(Object serverPlayer) Creates a player object from an actual player.double
NOTE: Voice chat plugins can change this.Don't forget to register your category withVoicechatServerApi.registerVolumeCategory(VolumeCategory)
orVoicechatClientApi.registerClientVolumeCategory(VolumeCategory)
-
Method Details
-
createEncoder
OpusEncoder createEncoder()Creates a new opus encoder. Note that the encoder needs to be closed after you are finished using it. -
createEncoder
Creates a new opus encoder. Note that the encoder needs to be closed after you are finished using it.- Parameters:
mode
- the opus encoder mode- Returns:
- the opus encoder
-
createDecoder
OpusDecoder createDecoder()Creates a new opus decoder. Note that the decoder needs to be closed after you are finished using it.- Returns:
- the opus decoder
-
createMp3Encoder
@Nullable Mp3Encoder createMp3Encoder(AudioFormat audioFormat, int bitrate, int quality, OutputStream outputStream) NOTE: This is not available for Bukkit! It will always return null.- Parameters:
audioFormat
- the audio formatbitrate
- the bitrate in kbpsquality
- the quality from 0 (highest) to 9 (lowest)outputStream
- the output stream to write the mp3 to- Returns:
- the mp3 encoder or null if the encoder could not be initialized or is not available
-
createMp3Decoder
NOTE: This is not available for Bukkit! It will always return null.- Parameters:
inputStream
- the input stream to read the mp3 from- Returns:
- the mp3 decoder or null if the decoder could not be initialized or is not available
-
getAudioConverter
AudioConverter getAudioConverter()- Returns:
- the audio converter
-
fromEntity
Creates an entity object from an actual entity.- Parameters:
entity
- the entity implementation of your mod/plugin loader- Returns:
- the entity object
-
fromServerLevel
Creates a level object from an actual level.- Parameters:
serverLevel
- the level implementation of your mod/plugin loader- Returns:
- the level
-
fromServerPlayer
Creates a player object from an actual player.- Parameters:
serverPlayer
- the player implementation of your mod/plugin loader- Returns:
- the player
-
createPosition
Creates a new position object.- Parameters:
x
- the X positiony
- the Y positionz
- the Z position- Returns:
- the position with the provided coordinates
-
volumeCategoryBuilder
VolumeCategory.Builder volumeCategoryBuilder()Don't forget to register your category withVoicechatServerApi.registerVolumeCategory(VolumeCategory)
orVoicechatClientApi.registerClientVolumeCategory(VolumeCategory)
- Returns:
- a builder to build a category
-
getVoiceChatDistance
double getVoiceChatDistance()NOTE: Voice chat plugins can change this. This is only the default value. This value might not be correct if you are not connected to a server.- Returns:
- the default distance, audio from voice chat is heard from
-