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

    Fields
    Modifier and Type
    Field
    Description
    final com.sedmelluq.discord.lavaplayer.player.AudioPlayer
    The audio player instance
    The track scheduler instance that connects to the AudioPlayer
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method to link a player controls handler to this player audio source's track scheduler
    org.javacord.api.audio.AudioSource
    Method that returns a copy of the current audio source
    byte[]
    Method that gets the next frame in the audio source
    boolean
    Method that checks if an audio source has finished
    boolean
    Method that checks if an audio source has another frame ahead

    Methods 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 audioPlayer
      The audio player instance
    • trackScheduler

      public final TrackScheduler trackScheduler
      The track scheduler instance that connects to the AudioPlayer
  • 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 manager
      serverVoiceChannel - the server voice channel to which the bot connected to
      textChannel - the text channel in which the play command was invoked
  • Method Details

    • addPlayerControlsHandler

      public void addPlayerControlsHandler(PlayerControlsHandler playerControlsHandler)
      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 interface org.javacord.api.audio.AudioSource
      Overrides:
      hasFinished in class org.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