当前位置: 首页>>代码示例>>Java>>正文


Java AudioSourceManagers类代码示例

本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers的典型用法代码示例。如果您正苦于以下问题:Java AudioSourceManagers类的具体用法?Java AudioSourceManagers怎么用?Java AudioSourceManagers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AudioSourceManagers类属于com.sedmelluq.discord.lavaplayer.source包,在下文中一共展示了AudioSourceManagers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
    Thread.currentThread().setName("JukeBot-Main");

    ConfigurationFactory.setConfigurationFactory(new Log4JConfig());
    LOG = LogManager.getLogger("JukeBot");

    playerManager = new DefaultAudioPlayerManager();
    defaultPrefix = Database.getPropertyFromConfig("prefix");

    String colour = Database.getPropertyFromConfig("color");
    if (colour.equalsIgnoreCase("")) {
        LOG.error("Missing property 'color' in the database.");
        return;
    }

    embedColour = Color.decode(colour);

    playerManager.setPlayerCleanupThreshold(30000);
    playerManager.getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality.LOW);
    playerManager.getConfiguration().setOpusEncodingQuality(9);
    YoutubeAudioSourceManager yt = new YoutubeAudioSourceManager();
    yt.setPlaylistPageCount(Integer.MAX_VALUE);
    playerManager.registerSourceManager(yt);
    AudioSourceManagers.registerRemoteSources(playerManager);

    printBanner();

    shardManager = new DefaultShardManagerBuilder()
            .setToken(Database.getPropertyFromConfig("token"))
            .setShardsTotal(-1)
            .addEventListeners(new EventListener(), waiter)
            .setAudioSendFactory(new NativeAudioSendFactory())
            .setGame(Game.of(Game.GameType.LISTENING, defaultPrefix + "help | jukebot.xyz"))
            .build();
}
 
开发者ID:Devoxin,项目名称:JukeBot,代码行数:36,代码来源:JukeBot.java

示例2: loadDiscord

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public void loadDiscord() {
	try {
		jda = new JDABuilder(AccountType.BOT)
				.setToken(DiscordBot.getInstance().getConfig().getToken())
				.addEventListener(new DiscordListener())
				.setAudioEnabled(true)
				.setBulkDeleteSplittingEnabled(false)
				.buildAsync();
		
		AudioSourceManagers.registerRemoteSources(getAudioPlayerManager());
		audioPlayer = getAudioPlayerManager().createPlayer();
		getAudioPlayer().setVolume(DiscordBot.getInstance().getConfig().getDefaultVolume());
		getAudioPlayer().addListener(new AudioListener());
		getDiscordThread().start();
		getCommand().registerCommands();
		LogHelper.info("Successfully loaded Discord.");
	} catch (LoginException | RateLimitedException | RuntimeException ex) {
		LogHelper.error("Exception loading Discord!");
		ex.printStackTrace();
	}
}
 
开发者ID:LXGaming,项目名称:DiscordBot,代码行数:22,代码来源:Discord.java

示例3: main

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的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);
  }
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:27,代码来源:LocalPlayerDemo.java

示例4: init

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
static void init() {
	playerManager = new DefaultAudioPlayerManager();
	AudioSourceManagers.registerRemoteSources(playerManager);
	AudioSourceManagers.registerLocalSource(playerManager);

	initGuildAudioPlayer(Bot.getGuild());

	Log.debug("Initialized audio player.");
}
 
开发者ID:Bleuzen,项目名称:Blizcord,代码行数:10,代码来源:AudioPlayerThread.java

示例5: main

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public static void main(String[] args) {
    /* Set up the player manager */
    PLAYER_MANAGER.enableGcMonitoring();
    PLAYER_MANAGER.setItemLoaderThreadPoolSize(100);
    PLAYER_MANAGER.getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality.LOW);
    AudioSourceManagers.registerRemoteSources(PLAYER_MANAGER);

    log.info("Loading AudioTracks");

    String identifier;
    if (args.length >= 1 && args[0].equals("opus")) {
        identifier = DEFAULT_OPUS;
    } else {
        identifier = DEFAULT_PLAYLIST;
    }

    tracks = new PlaylistLoader().loadTracksSync(identifier);
    log.info(tracks.size() + " tracks loaded. Beginning benchmark...");

    try {
        doLoop();
    } catch (Exception e) {
        log.error("Benchmark ended due to exception!");
        throw new RuntimeException(e);
    }

    System.exit(0);
}
 
开发者ID:FredBoat,项目名称:Lavamark,代码行数:29,代码来源:Lavamark.java

示例6: Bot

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public Bot(EventWaiter waiter, Config config)
{
    this.config = config;
    this.waiter = waiter;
    this.settings = new HashMap<>();
    this.lastNP = new HashMap<>();
    manager = new DefaultAudioPlayerManager();
    threadpool = Executors.newSingleThreadScheduledExecutor();
    AudioSourceManagers.registerRemoteSources(manager);
    AudioSourceManagers.registerLocalSource(manager);
    manager.source(YoutubeAudioSourceManager.class).setPlaylistPageCount(10);
    try {
        JSONObject loadedSettings = new JSONObject(new String(Files.readAllBytes(Paths.get("serversettings.json"))));
        loadedSettings.keySet().forEach((id) -> {
            JSONObject o = loadedSettings.getJSONObject(id);
            
            settings.put(id, new Settings(
                    o.has("text_channel_id") ? o.getString("text_channel_id") : null,
                    o.has("voice_channel_id")? o.getString("voice_channel_id"): null,
                    o.has("dj_role_id")      ? o.getString("dj_role_id")      : null,
                    o.has("volume")          ? o.getInt("volume")             : 100,
                    o.has("default_playlist")? o.getString("default_playlist"): null,
                    o.has("repeat")          ? o.getBoolean("repeat")         : false));
        });
    } catch(IOException | JSONException e) {
        LoggerFactory.getLogger("Settings").warn("Failed to load server settings (this is normal if no settings have been set yet): "+e);
    }
}
 
开发者ID:jagrosh,项目名称:MusicBot,代码行数:29,代码来源:Bot.java

示例7: Main

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
private Main() {
  this.musicManagers = new HashMap<>();

  this.playerManager = new DefaultAudioPlayerManager();
  AudioSourceManagers.registerRemoteSources(playerManager);
  AudioSourceManagers.registerLocalSource(playerManager);
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:8,代码来源:Main.java

示例8: PlayingTrackManager

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
@Autowired
public PlayingTrackManager(StatisticsManager statisticsManager) {
  this.statisticsManager = statisticsManager;
  manager = new DefaultAudioPlayerManager();
  tracks = new ConcurrentHashMap<>();

  manager.setUseSeekGhosting(false);
  AudioSourceManagers.registerRemoteSources(manager);
}
 
开发者ID:sedmelluq,项目名称:lavaplayer,代码行数:10,代码来源:PlayingTrackManager.java

示例9: MusicPlayer

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public MusicPlayer() {
    this.musicManagers = new HashMap<>();

    this.playerManager = new DefaultAudioPlayerManager();
    AudioSourceManagers.registerRemoteSources(playerManager);
    AudioSourceManagers.registerLocalSource(playerManager);
}
 
开发者ID:Godson777,项目名称:KekBot,代码行数:8,代码来源:MusicPlayer.java

示例10: initDiscord

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public void initDiscord(){
    //Init lavaplayer
    Karren.log.info("Starting up Lavaplayer...");
    gms = new HashMap<>();
    AudioSourceManagers.registerRemoteSources(pm);
    AudioSourceManagers.registerLocalSource(pm);
    //Continue connecting to discord
    if(Karren.conf.getConnectToDiscord()) {
        EventDispatcher ed = client.getDispatcher();
        ed.registerListener(new ConnectCommand());
        try {
            client.login();
        } catch (DiscordException | RateLimitException e) {
            e.printStackTrace();
        }
        ed.registerListener(new HelpCommand());
        ed.registerListener(interactionListener);
        ed.registerListener(new KillCommand());
        ed.registerListener(new GuildCreateListener());
        ed.registerListener(new ShutdownListener());
        ed.registerListener(new ReconnectListener());
        ed.registerListener(new StatCommand());
        initExtras();
    } else {
        Karren.log.info("Running in test mode, not connected to Discord.");
        initExtras();
        //Init interaction processor

    }
}
 
开发者ID:ripxfrostbite,项目名称:karren-sama,代码行数:31,代码来源:KarrenBot.java

示例11: MusicCommand

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public MusicCommand() {
    AudioSourceManagers.registerRemoteSources(manager);
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:4,代码来源:MusicCommand.java

示例12: Music

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public Music() {
    AudioSourceManagers.registerRemoteSources(myManager);
}
 
开发者ID:LeeDJD,项目名称:Amme,代码行数:4,代码来源:Music.java

示例13: Bot

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
Bot(EventWaiter waiter) {
	this.waiter = waiter;
	this.manager = new DefaultAudioPlayerManager();
	AudioSourceManagers.registerRemoteSources(manager);
}
 
开发者ID:JessWalters,项目名称:Vinny-Redux,代码行数:6,代码来源:Bot.java

示例14: Music

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
public Music() {
    this.musicManagers = new HashMap<>();
    this.playerManager = new DefaultAudioPlayerManager();
    AudioSourceManagers.registerRemoteSources(playerManager);
    AudioSourceManagers.registerLocalSource(playerManager);
}
 
开发者ID:elgoupil,项目名称:GoupilBot,代码行数:7,代码来源:Music.java

示例15: onReadyEvent

import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers; //导入依赖的package包/类
@EventSubscriber
public void onReadyEvent(ReadyEvent event) { // This method is called when the ReadyEvent is dispatched
    Console.println("Bot login success");
    Console.println("Shards: " + INIT.BOT.getShardCount());
    StringBuilder serverstr = new StringBuilder();
    int count = 1;
    for (IGuild server : INIT.BOT.getGuilds()) {
        serverstr.append("\n")
                .append(count)
                .append(". [")
                .append(server.getName())
                .append("   ")
                .append(server.getStringID())
                .append("]");
        count++;
    }
    Console.println("Servers: " + serverstr);
    RegisterCommands.registerAll();
    Console.println("Loading Permissions from SaveFile");
    PERM.loadPermissions(INIT.BOT.getGuilds());
    PERM.setDefaultPermissions(INIT.BOT.getGuilds(), false);
    INIT.BOT.changePlayingText(DRIVER.getPropertyOnly(DRIVER.CONFIG, "defaultplaying").toString());
    INIT.BOT.changeUsername(DRIVER.getPropertyOnly(DRIVER.CONFIG, "defaultUsername").toString());
    Console.println("Loading Command Descriptions");
    for (Command command : COMMAND.getAllCommands()) {
        LANG.getMethodDescription(command);
    }
    Console.println("Register Audioprovider");
    AudioSourceManagers.registerRemoteSources(MainMusic.playerManager);
    AudioSourceManagers.registerLocalSource(MainMusic.playerManager);

    RoleManagement.loadGenders();

    saveGuilds();
    Console.println("====================================Bot Status========================================");
    INIT.BOT.getShards().forEach(iShard -> {
        Console.println("Shard "+iShard.getInfo()[0]+": "+iShard.isReady()+" Servers: "+iShard.getGuilds().size()+"  Ping: "+iShard.getResponseTime());
    });
    Optional stream = INIT.BOT.getOurUser().getPresence().getStreamingUrl();
    Optional playtext = INIT.BOT.getOurUser().getPresence().getPlayingText();
    Console.println("Username: "+INIT.BOT.getOurUser().getName());
    Console.println("Status: "+INIT.BOT.getOurUser().getPresence().getStatus());
    if (stream.isPresent()) {
        Console.println("Streaming: "+stream.get());
    } else {
        Console.println("Streaming: OFFLINE");
    }
    if (playtext.isPresent()) {
        Console.println("Playing: "+playtext.get());
    } else {
        Console.println("Playing: NOTHING");
    }

    SystemInfo info = new SystemInfo();
    Console.println("SystemInfo: "+info.Info()+"\n");
    Command helpcommand = COMMAND.getCommandByName("help");
    Console.println("Type "+ DRIVER.getPropertyOnly(DRIVER.CONFIG, "botprefix").toString()+helpcommand.prefix()+helpcommand.command()+" for getting help.");
    Console.println("====================================Bot Start completed===============================");
    running = true;
}
 
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:61,代码来源:ServerListener.java


注:本文中的com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。