本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager类的典型用法代码示例。如果您正苦于以下问题:Java AudioPlayerManager类的具体用法?Java AudioPlayerManager怎么用?Java AudioPlayerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioPlayerManager类属于com.sedmelluq.discord.lavaplayer.player包,在下文中一共展示了AudioPlayerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public static void main(String[] args) throws LineUnavailableException, IOException {
AudioPlayerManager manager = new DefaultAudioPlayerManager();
AudioSourceManagers.registerRemoteSources(manager);
manager.getConfiguration().setOutputFormat(new AudioDataFormat(2, 44100, 960, AudioDataFormat.Codec.PCM_S16_BE));
AudioPlayer player = manager.createPlayer();
manager.loadItem("ytsearch: epic soundtracks", new FunctionalResultHandler(null, playlist -> {
player.playTrack(playlist.getTracks().get(0));
}, null, null));
AudioDataFormat format = manager.getConfiguration().getOutputFormat();
AudioInputStream stream = AudioPlayerInputStream.createStream(player, format, 10000L, false);
SourceDataLine.Info info = new DataLine.Info(SourceDataLine.class, stream.getFormat());
SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
line.open(stream.getFormat());
line.start();
byte[] buffer = new byte[format.bufferSize(2)];
int chunkSize;
while ((chunkSize = stream.read(buffer)) >= 0) {
line.write(buffer, 0, chunkSize);
}
}
示例2: initAudioPlayerManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
private static AudioPlayerManager initAudioPlayerManager() {
AudioPlayerManager apm = new DefaultAudioPlayerManager();
apm.registerSourceManager(new YoutubeAudioSourceManager());
apm.registerSourceManager(new TwitchStreamAudioSourceManager());
apm.registerSourceManager(new BeamAudioSourceManager());
apm.registerSourceManager(new HttpAudioSourceManager());
return apm;
}
示例3: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
/**
* 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);
sendHandler = new AudioPlayerSendHandler(player);
player.addListener(scheduler);
}
示例4: GuildMusic
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public GuildMusic(IGuild guild, AudioPlayerManager audioPlayerManager) {
this.guild = guild;
this.audioPlayer = audioPlayerManager.createPlayer();
this.audioProvider = new AudioProvider(audioPlayer);
this.trackScheduler = new TrackScheduler(audioPlayer, Database.getDBGuild(guild).getDefaultVol());
this.audioPlayer.addListener(new AudioEventListener(this));
}
示例5: registerRemoteSources
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
/**
* Registers all built-in remote audio sources to the specified player manager. Local file audio source must be
* registered separately.
*
* @param playerManager Player manager to register the source managers to
*/
public static void registerRemoteSources(AudioPlayerManager playerManager) {
playerManager.registerSourceManager(new YoutubeAudioSourceManager(true));
playerManager.registerSourceManager(new SoundCloudAudioSourceManager());
playerManager.registerSourceManager(new BandcampAudioSourceManager());
playerManager.registerSourceManager(new VimeoAudioSourceManager());
playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
playerManager.registerSourceManager(new BeamAudioSourceManager());
playerManager.registerSourceManager(new HttpAudioSourceManager());
}
示例6: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
/**
* Creates a player and a track scheduler.
* @param manager Audio player manager to use for creating the player.
*/
public GuildMusicManager(AudioPlayerManager manager, CommandContext context, boolean meme) {
player = manager.createPlayer();
scheduler = new TrackScheduler(player, context);
memeScheduler = new MemeScheduler(player, context.getGuild());
channel = context.getTextChannel();
this.meme = meme;
if (meme) {
player.addListener(memeScheduler);
} else {
player.addListener(scheduler);
}
}
示例7: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public GuildMusicManager(AudioPlayerManager manager, String guildId) {
this.audioPlayer = manager.createPlayer();
this.trackManager = new GuildTrackManager(audioPlayer, guildId);
this.audioPlayer.addListener(trackManager);
this.skipVoters = new HashSet<String>();
this.audioProvider = new AudioProvider(this.audioPlayer);
}
示例8: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public GuildMusicManager(AudioPlayerManager manager) {
player = manager.createPlayer();
scheduler = new TrackScheduler(player);
sendHandler = new AudioPlayerSendHandler(player);
player.addListener(scheduler);
}
示例9: getManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public AudioPlayerManager getManager() {
return manager;
}
示例10: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
/**
* 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);
}
示例11: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
/**
* Creates a player and a track scheduler.
* @param manager Audio player manager to use for creating the player.
* @param guild The Guild this Music Manager is linked to.
*/
public GuildMusicManager(AudioPlayerManager manager, Guild guild) {
player = manager.createPlayer();
scheduler = new TrackScheduler(player, guild);
player.addListener(scheduler);
}
示例12: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public GuildMusicManager(AudioPlayerManager manager) {
player = manager.createPlayer();
scheduler = new TrackScheduler(this, player);
player.addListener(scheduler);
}
示例13: GuildMusicManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public GuildMusicManager(AudioPlayerManager manager, String guildId) {
this.audioPlayer = manager.createPlayer();
this.trackManager = new GuildTrackManager(audioPlayer, guildId);
this.audioPlayer.addListener(trackManager);
this.skipVoters = new HashSet<String>();
}
示例14: getMasterManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public static AudioPlayerManager getMasterManager() {
return playerManager;
}
示例15: getAudioPlayerManager
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; //导入依赖的package包/类
public AudioPlayerManager getAudioPlayerManager() {
return audioPlayerManager;
}