aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/soundbot/GuildMusicManager.java
diff options
context:
space:
mode:
authorBrandon <bwaggone@umich.edu>2018-04-07 15:55:32 -0400
committerBrandon <bwaggone@umich.edu>2018-04-07 15:55:32 -0400
commit3799c7828ad8ef2968f39e4044db36885aec1ab4 (patch)
treea7da8fa945a22f62fc59ef983abced1ce082bb0c /src/main/java/soundbot/GuildMusicManager.java
downloadSoundChan-3799c7828ad8ef2968f39e4044db36885aec1ab4.tar.gz
SoundChan-3799c7828ad8ef2968f39e4044db36885aec1ab4.tar.bz2
SoundChan-3799c7828ad8ef2968f39e4044db36885aec1ab4.zip
Initial commit
Diffstat (limited to 'src/main/java/soundbot/GuildMusicManager.java')
-rw-r--r--src/main/java/soundbot/GuildMusicManager.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/soundbot/GuildMusicManager.java b/src/main/java/soundbot/GuildMusicManager.java
new file mode 100644
index 0000000..fc46756
--- /dev/null
+++ b/src/main/java/soundbot/GuildMusicManager.java
@@ -0,0 +1,35 @@
+package soundbot;
+
+import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
+import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
+
+/**
+ * Holder for both the player and a track scheduler for one guild.
+ */
+public class GuildMusicManager {
+ /**
+ * Audio player for the guild.
+ */
+ public final AudioPlayer player;
+ /**
+ * Track scheduler for the player.
+ */
+ public final TrackScheduler scheduler;
+
+ /**
+ * Creates a player and a track scheduler.
+ * @param manager Audio player manager to use for creating the player.
+ */
+ public GuildMusicManager(AudioPlayerManager manager) {
+ player = manager.createPlayer();
+ scheduler = new TrackScheduler(player);
+ player.addListener(scheduler);
+ }
+
+ /**
+ * @return Wrapper around AudioPlayer to use it as an AudioSendHandler.
+ */
+ public AudioPlayerSendHandler getSendHandler() {
+ return new AudioPlayerSendHandler(player);
+ }
+}