Note
LibSoundPlayer is now part of the Mechtatel project. Check mechtatel-audio module and its test code for usage.
This is a sound player library that can be used in Java. Core part is written in Rust, using rodio.
- Linux x64
- Windows x64
- macOS x64 (not tested)
<dependency>
<groupId>io.github.maeda6uiui</groupId>
<artifactId>lib-sound-player-core</artifactId>
<version>0.0.2</version>
</dependency>Below is a code example for audio playback.
package com.github.maeda6uiui.libsoundplayertest;
import com.github.maeda6uiui.libsoundplayer.core.Sound;
import java.io.FileNotFoundException;
public class Main {
public static void main(String[] args) {
Sound sound;
try {
sound = new Sound("./Data/Op24.flac");
} catch (FileNotFoundException e) {
System.err.println(e);
return;
}
sound.play();
while (true) {
if (sound.isFinished()) {
break;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
System.err.println(e);
return;
}
}
}
}