Search in sources :

Example 1 with IAudioSendFactory

use of net.dv8tion.jda.api.audio.factory.IAudioSendFactory in project JDA by DV8FromTheWorld.

the class AudioConnection method setupSendSystem.

/* Internals */
private synchronized void setupSendSystem() {
    if (udpSocket != null && !udpSocket.isClosed() && sendHandler != null && sendSystem == null) {
        IAudioSendFactory factory = getJDA().getAudioSendFactory();
        sendSystem = factory.createSendSystem(new PacketProvider(new TweetNaclFast.SecretBox(webSocket.getSecretKey())));
        sendSystem.setContextMap(getJDA().getContextMap());
        sendSystem.start();
    } else if (sendHandler == null && sendSystem != null) {
        sendSystem.shutdown();
        sendSystem = null;
        if (opusEncoder != null) {
            Opus.INSTANCE.opus_encoder_destroy(opusEncoder);
            opusEncoder = null;
        }
    }
}
Also used : IPacketProvider(net.dv8tion.jda.api.audio.factory.IPacketProvider) TweetNaclFast(com.iwebpp.crypto.TweetNaclFast) IAudioSendFactory(net.dv8tion.jda.api.audio.factory.IAudioSendFactory)

Aggregations

TweetNaclFast (com.iwebpp.crypto.TweetNaclFast)1 IAudioSendFactory (net.dv8tion.jda.api.audio.factory.IAudioSendFactory)1 IPacketProvider (net.dv8tion.jda.api.audio.factory.IPacketProvider)1