improve sound compatibility for linux

This commit is contained in:
woodser 2024-10-14 09:44:03 -04:00
parent a00930aa9e
commit 072401386e

View file

@ -575,14 +575,14 @@ public class HavenoUtils {
// get original format
AudioFormat baseFormat = audioInputStream.getFormat();
// set target format: PCM_SIGNED, 16-bit
// set target format: PCM_SIGNED, 16-bit, 44100 Hz
AudioFormat targetFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
baseFormat.getSampleRate(),
44100.0f,
16, // 16-bit instead of 32-bit float
baseFormat.getChannels(),
baseFormat.getChannels() * 2, // Frame size: 2 bytes per channel (16-bit)
baseFormat.getSampleRate(),
44100.0f,
false // Little-endian
);