Package org.prithvidiamond1.AudioPlayer
Class PlayerAudioSource
java.lang.Object
org.javacord.api.audio.AudioSourceBase
org.prithvidiamond1.AudioPlayer.PlayerAudioSource
- All Implemented Interfaces:
org.javacord.api.audio.AudioSource
,org.javacord.api.listener.audio.AudioSourceAttachableListenerManager
,org.javacord.api.util.Specializable<org.javacord.api.audio.AudioSource>
public class PlayerAudioSource
extends org.javacord.api.audio.AudioSourceBase
This class holds functions related to a player's audio source
-
Field Summary
Modifier and TypeFieldDescriptionfinal com.sedmelluq.discord.lavaplayer.player.AudioPlayer
The audio player instancefinal TrackScheduler
The track scheduler instance that connects to theAudioPlayer
-
Constructor Summary
ConstructorDescriptionPlayerAudioSource
(org.javacord.api.DiscordApi api, org.javacord.api.entity.channel.TextChannel textChannel, org.javacord.api.entity.channel.ServerVoiceChannel serverVoiceChannel, com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager audioPlayerManager) Creates a new audio source base. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlayerControlsHandler
(PlayerControlsHandler playerControlsHandler) Method to link a player controls handler to this player audio source's track schedulerorg.javacord.api.audio.AudioSource
copy()
Method that returns a copy of the current audio sourcebyte[]
Method that gets the next frame in the audio sourceboolean
Method that checks if an audio source has finishedboolean
Method that checks if an audio source has another frame aheadMethods inherited from class org.javacord.api.audio.AudioSourceBase
addAudioSourceAttachableListener, addAudioSourceFinishedListener, addTransformer, applyTransformers, getApi, getAudioSourceAttachableListeners, getAudioSourceFinishedListeners, getDelegate, getTransformers, isMuted, removeAudioSourceAttachableListener, removeListener, removeTransformer, removeTransformers, setMuted
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.javacord.api.audio.AudioSource
asBufferableAudioSource, asDownloadableAudioSource, asPauseableAudioSource, asSeekableAudioSource, mute, unmute
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Field Details
-
audioPlayer
public final com.sedmelluq.discord.lavaplayer.player.AudioPlayer audioPlayerThe audio player instance -
trackScheduler
The track scheduler instance that connects to theAudioPlayer
-
-
Constructor Details
-
PlayerAudioSource
public PlayerAudioSource(org.javacord.api.DiscordApi api, org.javacord.api.entity.channel.TextChannel textChannel, org.javacord.api.entity.channel.ServerVoiceChannel serverVoiceChannel, com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager audioPlayerManager) Creates a new audio source base.- Parameters:
api
- The discord api instance.audioPlayerManager
- the audio player managerserverVoiceChannel
- the server voice channel to which the bot connected totextChannel
- the text channel in which the play command was invoked
-
-
Method Details
-
addPlayerControlsHandler
Method to link a player controls handler to this player audio source's track scheduler- Parameters:
playerControlsHandler
- the player control handler
-
getNextFrame
public byte[] getNextFrame()Method that gets the next frame in the audio source- Returns:
- a byte array
-
hasFinished
public boolean hasFinished()Method that checks if an audio source has finished- Specified by:
hasFinished
in interfaceorg.javacord.api.audio.AudioSource
- Overrides:
hasFinished
in classorg.javacord.api.audio.AudioSourceBase
- Returns:
- a boolean (although this implementation defaults to false all the time)
-
hasNextFrame
public boolean hasNextFrame()Method that checks if an audio source has another frame ahead- Returns:
- a boolean
-
copy
public org.javacord.api.audio.AudioSource copy()Method that returns a copy of the current audio source- Returns:
- an audio source copy
-