package fr.Skydust.JdrBot.audio;

import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;

import fr.Skydust.JdrBot.audio.handler.JdrBotASH;
import net.dv8tion.jda.api.managers.AudioManager;

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, AudioManager am) {
		player = manager.createPlayer();
	    scheduler = new TrackScheduler(player, am);
	    player.addListener(scheduler);
	}

	/**
	* @return Wrapper around AudioPlayer to use it as an AudioSendHandler.
	*/
	public JdrBotASH getSendHandler() {
		return new JdrBotASH(player);
	}
}