com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioSourceManager Java Examples

The following examples show how to use com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioSourceManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Module.java    From kyoko with MIT License 6 votes vote down vote up
private void setupSourceManagers() {
    var youtubeAudioSourceManager = new YoutubeAudioSourceManager();
    musicManager.registerSourceManager(youtubeAudioSourceManager);
    musicManager.registerSourceManager(new SoundCloudAudioSourceManager());
    musicManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    musicManager.registerSourceManager(new VimeoAudioSourceManager());
    musicManager.registerSourceManager(new BandcampAudioSourceManager());
    musicManager.registerSourceManager(new BeamAudioSourceManager());
    if (musicSettings.nico != null && musicSettings.nico.email != null && !musicSettings.nico.email.isEmpty()) {
        musicManager.registerSourceManager(new NicoAudioSourceManager(musicSettings.nico.email, musicSettings.nico.password));
    }

    if (musicSettings.spotify != null && musicSettings.spotify.id != null && musicSettings.spotify.secret != null) {
        musicManager.registerSourceManager(new SpotifyAudioSourceManager(musicSettings.spotify, youtubeAudioSourceManager));
    }

    if (musicSettings.httpWhitelist) {
        musicManager.registerSourceManager(new SafeHttpAudioSourceManager(registry));
    } else {
        musicManager.registerSourceManager(new HttpAudioSourceManager(registry));
    }
}
 
Example #2
Source File: AudioUtils.java    From SkyBot with GNU Affero General Public License v3.0 6 votes vote down vote up
public AudioUtils(DunctebotConfig.Apis config, Variables variables) {
    this.variables = variables;
    musicManagers = MapUtils.newLongObjectMap();

    playerManager = new UserContextAudioPlayerManager();
    //playerManager.enableGcMonitoring();

    final YoutubeAudioSourceManagerOverride youtubeAudioSourceManager = new YoutubeAudioSourceManagerOverride(
        variables.getYoutubeCache(),
        config.googl
    );

    playerManager.registerSourceManager(new SpotifyAudioSourceManager(youtubeAudioSourceManager, config));

    playerManager.registerSourceManager(youtubeAudioSourceManager);

    setCustomSourcesOn(playerManager, false);
    setCustomSourcesOn(LavalinkUtil.getPlayerManager(), true);

    playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
    playerManager.registerSourceManager(new BandcampAudioSourceManager());
    playerManager.registerSourceManager(new VimeoAudioSourceManager());
    playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    playerManager.registerSourceManager(new BeamAudioSourceManager());
    playerManager.registerSourceManager(new HttpAudioSourceManager());
}
 
Example #3
Source File: JbAudioPlayerManagerImpl.java    From JuniperBot with GNU General Public License v3.0 6 votes vote down vote up
@PostConstruct
public void init() {
    WorkerProperties.Audio configuration = workerProperties.getAudio();
    getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality
            .valueOf(configuration.getResamplingQuality()));
    setFrameBufferDuration(configuration.getFrameBufferDuration());
    setItemLoaderThreadPoolSize(configuration.getItemLoaderThreadPoolSize());
    registerSourceManager(new YoutubeAudioSourceManager(true));
    registerSourceManager(new SoundCloudAudioSourceManager());
    registerSourceManager(new BandcampAudioSourceManager());
    registerSourceManager(new VimeoAudioSourceManager());
    registerSourceManager(new TwitchStreamAudioSourceManager());
    registerSourceManager(new BeamAudioSourceManager());
    if (CollectionUtils.isNotEmpty(audioSourceManagers)) {
        audioSourceManagers.forEach(this::registerSourceManager);
    }
}
 
Example #4
Source File: BotApplicationManager.java    From lavaplayer with Apache License 2.0 6 votes vote down vote up
public BotApplicationManager() {
  guildContexts = new HashMap<>();
  controllerManager = new BotControllerManager();

  controllerManager.registerController(new MusicController.Factory());

  playerManager = new DefaultAudioPlayerManager();
  //playerManager.useRemoteNodes("localhost:8080");
  playerManager.getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality.LOW);
  playerManager.registerSourceManager(new YoutubeAudioSourceManager());
  playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
  playerManager.registerSourceManager(new BandcampAudioSourceManager());
  playerManager.registerSourceManager(new VimeoAudioSourceManager());
  playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
  playerManager.registerSourceManager(new BeamAudioSourceManager());
  playerManager.registerSourceManager(new HttpAudioSourceManager());
  playerManager.registerSourceManager(new LocalAudioSourceManager());

  executorService = Executors.newScheduledThreadPool(1, new DaemonThreadFactory("bot"));
}
 
Example #5
Source File: AudioSourceManagers.java    From lavaplayer with Apache License 2.0 5 votes vote down vote up
/**
 * 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
 * @param containerRegistry Media container registry to be used by any probing sources.
 */
public static void registerRemoteSources(AudioPlayerManager playerManager, MediaContainerRegistry containerRegistry) {
  playerManager.registerSourceManager(new YoutubeAudioSourceManager(true));
  playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
  playerManager.registerSourceManager(new BandcampAudioSourceManager());
  playerManager.registerSourceManager(new VimeoAudioSourceManager());
  playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
  playerManager.registerSourceManager(new BeamAudioSourceManager());
  playerManager.registerSourceManager(new GetyarnAudioSourceManager());
  playerManager.registerSourceManager(new HttpAudioSourceManager(containerRegistry));
}
 
Example #6
Source File: MantaroAudioManager.java    From MantaroBot with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public MantaroAudioManager() {
    this.musicManagers = new ConcurrentHashMap<>();
    this.playerManager = new DefaultAudioPlayerManager();

    //Youtube is special because rotation stuff.
    YoutubeAudioSourceManager youtubeAudioSourceManager = new YoutubeAudioSourceManager(true);

    //IPv6 rotation config start
    Config config = MantaroData.config().get();
    if (!config.getIpv6Block().isEmpty()) {
        AbstractRoutePlanner planner;
        String block = config.getIpv6Block();
        List<IpBlock> blocks = Collections.singletonList(new Ipv6Block(block));

        //Damn you, YouTube.
        if (config.getExcludeAddress().isEmpty())
            planner = new RotatingNanoIpRoutePlanner(blocks);
        else {
            try {
                InetAddress blacklistedGW = InetAddress.getByName(config.getExcludeAddress());
                planner = new RotatingNanoIpRoutePlanner(blocks, inetAddress -> !inetAddress.equals(blacklistedGW));
            } catch (Exception e) {
                //Fallback: did I screw up putting the IP in? lmao
                planner = new RotatingNanoIpRoutePlanner(blocks);
                e.printStackTrace();
            }
        }

        new YoutubeIpRotatorSetup(planner)
                .forSource(youtubeAudioSourceManager)
                .setup();
    }
    //IPv6 rotation config end

    //Register source manager and configure the Player
    playerManager.registerSourceManager(youtubeAudioSourceManager);
    playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
    playerManager.registerSourceManager(new BandcampAudioSourceManager());
    playerManager.registerSourceManager(new VimeoAudioSourceManager());
    playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    playerManager.registerSourceManager(new BeamAudioSourceManager());
    if (!ExtraRuntimeOptions.DISABLE_NON_ALLOCATING_BUFFER) {
        log.info("Enabled non-allocating audio buffer.");
        playerManager.getConfiguration().setFrameBufferFactory(NonAllocatingAudioFrameBuffer::new);
    }
}