Closed chrislo27 closed 2 years ago
The scope of this "bugfix" is much larger than I initially thought and I'd like to do it right. This fix is planned for the v1.2 feature version release and will have a significant internal audio overhaul to improve audio interfacing and to ensure only one line is used at a time by the entire game.
The audio refactor is on branch audio_refactor
and has already been merged into the v1.2
branch. The new default audio system will be "OpenAL", since that has the most compatibility. The legacy sound system (JavaSound-based) will still be available in v1.2, but will not be enabled by default and may be fully removed in a future release.
As an added bonus, the OpenAL audio system has less internal latency -- around 24ms (9 buffers of 128 samples each at 48kHz) down from 43ms (2 buffers of 1024 samples each, also at 48kHz). It also uses less CPU time processing (around 25% less).
The audio is still mixed as usual, but is output via OpenAL (libGDX's AudioDevice
) instead of through JavaSound mixers.
The switch to OpenAL fixes my issue #41 Though the main menu music and in-game music/audio is choppy, but I assume it's because this branch is probably still in development (or my game for some reason being laggy)
Question, will you also move RHRE3 to OpenAL?
Though the main menu music and in-game music/audio is choppy
Thank you for testing; I would like to resolve this before the official release. Would you mind making a video demonstrating the problem? You can also try the launch parameter --audio-device-buffer-count
and increasing from 9 to, say, 18, and see if that resolves your problem. Try finding the smallest value that produces the correct audio. Example of usage: java -jar PolyrhythmMania.jar --audio-device-buffer-count 18
Question, will you also move RHRE3 to OpenAL?
No, RHRE3 has not been in development since Oct 25, 2020 and will not receive future updates. Source
here's a vid: https://cdn.discordapp.com/attachments/862760859318485032/929912149185265724/2022-01-10_03-35-11.mp4
for my RHRE3 question, yeah i know that the development stopped, i meant the next major revision or whatever you called it (if there's going to be one anyways), but thanks :D
btw, i don't seem to be able to compile the game, i tried what i usually do with gradle projects and use gradlew build
but that just doesn't work
[e404nnf@ryzengf PolyrhythmMania-audio_refactor]$ ./gradlew :desktop:build
Configuration on demand is an incubating feature.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/e404nnf/PolyrhythmMania-audio_refactor/desktop/build.gradle' line: 40
* What went wrong:
Could not determine the dependencies of task ':desktop:jar'.
> Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'implementation' should be resolved.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 610ms```
Please use the v1.2
branch since the audio refactor branch has already been merged into it, I won't update the audio_refactor
branch again. As for the Gradle compilation: try running ./gradlew :desktop:shadowJar
instead since it packs all the dependencies into one jar file; this is the same as how I compile the release builds. I also pushed a commit to the v1.2
branch that should fix the :desktop:jar
task not working -- but as I previously mentioned you should use the shadowJar
task instead. You can find the fat-jar file in the desktop/build/libs/
directory and run it using java -jar
.
tried --audio-device-buffer-count
, the smallest i could get to is 18 without audio sounding choppy or glitchy
You can also tweak --audio-device-buffer-size
. It starts at 512 and should be a power of two. I would recommend trying a buffer size of 1024
and keeping the buffer count at 9
, then slowly decrementing the buffer count while keeping the 1024 buffer size. In this case the goal is to reduce audio latency while not having it be distorted.
I would like to try to find a decent set of parameters that works with the most people. The default values for the buffer size and count may be too small (they are libGDX defaults).
the numbers you suggested 1024
and 9
give distorted audio, increasing buffer count to 10
with the buffer size staying at 1024
gives normal audio
i tried decreasing the buffer size to 768
, 13
buffer count was the lowest i could go to with that buffer size
I've pushed some commits to the v1.2 branch that has improved advanced audio settings for tweaking the buffer count in-game. The default buffer count on Windows will be 6 and on other platforms it is 10. The default buffer size has also been raised to 1024 bytes. I opted not to add buffer size changes in the settings since that gets more complicated with respect to the sound system mixer.
As an aside, I tried tweaking the buffer settings on a Ubuntu 20.04 VM and found that a buffer count of 9 was the minimum for it to work stably -- note that it was on a VM so I would take its results with a grain of salt.
Version
v1.1.1
Operating System
Linux
Problem Description
Unable to hear in-game (Polyrhythm gameplay) sounds when playing. A LineUnavailableException occurs while loading.
Steps to Reproduce Problem
Relevant log output
(Optional) Other useful information
This issue was split off from #41 created by @E404NNF.
From preliminary investigation, this is an edge case where exactly one line is permitted to be opened on the sound system. Most systems will allow more than one line to be open at a time. In certain cases in Polyrhythm Mania, more than one line is open at a time, such as during the loading transition from the main menu to gameplay, or in the editor when loading a project.