No audio on self-built jar file (NixOS)

Having issues? Ask here!
Forum rules
- Search for existing answers before creating a new topic
- Topic titles must be descriptive and searchable
- Duplicate questions will be redirected to the existing answer(s) and locked.
Post Reply
User avatar
Soupstraw
Noob
Posts: 1
Joined: Thu Sep 21, 2023 8:00 pm
Been thanked: 1 time

No audio on self-built jar file (NixOS)

Post by Soupstraw »

I'm building 2009scape client from source and it seems to work more or less fine, but there's no sound whatsoever. This is what the client outputs in the terminal:

Code: Select all

[nix-shell:~/Projects/rt4-client]$ ./gradlew run
Picked up _JAVA_OPTIONS: -Dsun.java2d.uiScale=2
> Task :deob-annotations:compileJava UP-TO-DATE
> Task :signlink:compileJava UP-TO-DATE
> Task :client:compileKotlin UP-TO-DATE
> Task :client:compileJava UP-TO-DATE
> Task :client:processResources UP-TO-DATE
> Task :client:classes UP-TO-DATE
> Task :signlink:processResources NO-SOURCE
> Task :signlink:classes UP-TO-DATE
> Task :signlink:jar UP-TO-DATE

> Task :client:run
Picked up _JAVA_OPTIONS: -Dsun.java2d.uiScale=2
Successfully loaded plugin BetterShiftDrop, version 2.0
Successfully loaded plugin XPDropPlugin, version 1.2
Successfully loaded plugin BasicInputQOL, version 1.0
Successfully loaded plugin TabReply, version 1.0
Successfully loaded plugin ValUAdd, version 1.0
Successfully loaded plugin AudioQOL, version 1.0
Successfully loaded plugin OverheadDebugPlugin, version 1.3
Successfully loaded plugin IfView, version 0.0
Successfully loaded plugin Craftify, version 1.0
Successfully loaded plugin LeftClickAttack, version 1.0
Successfully loaded plugin RememberMyLogin, version 1.1
Successfully loaded plugin MiniMenuQOL, version 1.0
Successfully loaded plugin InterfaceDebugPlugin, version 1.2
Successfully loaded plugin LoginTimer, version 1.2
Successfully loaded plugin GroundItems, version 1.0
Unable to load plugin .git because plugin.class is absent!
Successfully loaded plugin VarpLogPlugin, version 1.0
Successfully loaded plugin SlayerTrackerPlugin, version 1.0
Successfully loaded plugin EscClose, version 1.0
Successfully loaded plugin IdentifyClueScrolls, version 1.0
openSocket(test.2009scape.org:43595)
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
        at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:484)
        at java.desktop/com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:115)
        at java.desktop/com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:357)
        at rt4.JavaAudioChannel.open(JavaAudioChannel.java:67)
        at rt4.JavaAudioChannel.open(JavaAudioChannel.java:75)
        at rt4.AudioChannel.create(AudioChannel.java:91)
        at rt4.client.mainLoad(client.java:1370)
        at rt4.client.mainLoop(client.java:1610)
        at rt4.GameShell.mainLoopWrapper(GameShell.java:472)
        at rt4.GameShell.run(GameShell.java:627)
        at java.base/java.lang.Thread.run(Thread.java:833)
java.lang.NullPointerException: Cannot invoke "rt4.AudioSource.init(int, java.awt.Component, boolean)" because "rt4.SignLinkAudioChannel.audioSource" is null
        at rt4.SignLinkAudioChannel.init(SignLinkAudioChannel.java:39)
        at rt4.AudioChannel.create(AudioChannel.java:110)
        at rt4.client.mainLoad(client.java:1370)
        at rt4.client.mainLoop(client.java:1610)
        at rt4.GameShell.mainLoopWrapper(GameShell.java:472)
        at rt4.GameShell.run(GameShell.java:627)
        at java.base/java.lang.Thread.run(Thread.java:833)
I'm using PipeWire as my audio middleware, also I tried building it with both openjdk-8 and openjdk-11.
User avatar
Ceikry
Site Admin
Posts: 587
Joined: Wed Aug 10, 2022 11:48 pm
Location: Draynor Village
Has thanked: 82 times
Been thanked: 105 times

Post by Ceikry »

Inaccurate title, most of us developers use linux and have no issues.

I have changed the title of your post from "No audio on Linux (NixOS)" to "No Audio on Self-Built Jar file (NixOS)"
Nerds
User avatar
aweinstock
Developer
Posts: 31
Joined: Thu Aug 11, 2022 1:17 am
Been thanked: 14 times

Re: No audio on self-built jar file (NixOS)

Post by aweinstock »

I'm not that familiar with NixOS, but I did have to add the `alsa` use flag for `dev-java/openjdk-jre-bin` and `dev-java/openjdk-bin` to get audio working for java applications on gentoo. Do NixOS packages have a similar mechanism to use flags for enabling optional features of packages?
User avatar
Red Bracket
Retired Staff
Posts: 321
Joined: Thu Aug 11, 2022 7:18 am
Location: Varrock West Bank
Has thanked: 307 times
Been thanked: 76 times
Contact:

Re: No audio on self-built jar file (NixOS)

Post by Red Bracket »

Which Pipewire version are you using? Client works fine compiled on Arch against 0.3.74, OpenJDK 11.0.19

Edit: For reference, here's my output. I'm not using any plugins as this is a fresh repo clone:

Code: Select all

~/Projects/RT4-Client (master) » ./gradlew run                                                                                                                                                  xacket@archlinux
Downloading https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%

Welcome to Gradle 7.4.2!

Here are the highlights of this release:
 - Aggregated test and JaCoCo reports
 - Marking additional test source directories as tests in IntelliJ
 - Support for Adoptium JDKs in Java toolchains

For more details see https://docs.gradle.org/7.4.2/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :signlink:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/xacket/Projects/RT4-Client/signlink/src/main/java/rt4/SignLink.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :client:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :client:run

(process:253272): Gtk-WARNING **: 15:24:41.796: Locale not supported by C library.
        Using the fallback 'C' locale.
Skipping plugin initialization - /home/xacket/Projects/RT4-Client/client/plugins does not exist.
openSocket(test.2009scape.org:43595)
openSocket(test.2009scape.org:43595)
Skipping plugin initialization - /home/xacket/Projects/RT4-Client/client/plugins does not exist.
Post Reply