Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.FredBoat:jda-nas:1.0.6.2-JDA-Audio'
}
dependencies {
implementation("com.github.FredBoat:jda-nas:1.0.6.2-JDA-Audio")
}
<dependency>
<groupId>com.github.FredBoat</groupId>
<artifactId>jda-nas</artifactId>
<version>1.0.6.2-JDA-Audio</version>
</dependency>
libraryDependencies += "com.github.FredBoat" % "jda-nas" % "1.0.6.2-JDA-Audio"
:dependencies [[com.github.FredBoat/jda-nas "1.0.6.2-JDA-Audio"]]
The FredBoat team uses this fork of jda-nas to try out adjustments before committing them back upstream.
JDA-NAS is an alternative to JDA's built-in audio packet sending system. It keeps a buffer of audio packets in native code and also sends them from there. This way it is unaffected by GC pauses shorter than the duration of the buffer (400ms by default) and gets rid of stuttering caused by those.
Using in Gradle:
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
compile 'com.github.FredBoat:jda-nas:1.0.5.1-JDA'
//or
compile 'com.github.FredBoat:jda-nas:1.0.5.1-JDA-Audio'
}
Using in Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.FredBoat</groupId>
<artifactId>jda-nas</artifactId>
<version>1.0.5.1-JDA</version>
<!-- or -->
<version>1.0.5.1-JDA-Audio</version>
</dependency>
</dependencies>
Using it is as simple as just calling calling this on a JDABuilder:
.setAudioSendFactory(new NativeAudioSendFactory())
For example:
new JDABuilder(AccountType.BOT)
.setToken(System.getProperty("botToken"))
.setAudioSendFactory(new NativeAudioSendFactory())
.buildBlocking()
As it includes a native library, it is only supported on a specific set of platforms currently: