The Maven dependency is hosted off of JitPack, so you will need to add JitPack as a repository before you add V2DAudio as a dependency.
JitPack:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Dependency:
<dependency>
<groupId>com.github.Valkryst</groupId>
<artifactId>V2DAudio</artifactId>
<version>2020.02.01</version>
</dependency>
- Effect/MusicSettings objects can be reused, so you can use the same object with multiple different music tracks and effects.
- You must exit your program by calling
System.exit(0)
.- The JavaFX runtime is kept open, in the background, so that this library can make use of the AudioClip, Media, and MediaPlayer classes.
- If you do not manually exit the application, with
System.ext(0)
where appropriate, then it will remain open in the background, until the user either forcefully closes it or the system is shut down.
Initializing the AudioController with a JSON file.
final AudioController controller = AudioController.getInstance();
controller.initialize(Paths.get("./test_res/data-valid.json"));
Playing a piece of music.
final Music music = controller.loadMusic("victory");
music.play(null);
Playing an effect.
final Effect effect = controller.loadEffect("thunder 2");
effect.play(null);
Playing a piece of music.
final MusicSettings settings = new MusicSettings();
settings.setVolume(0.5);
final Music music = controller.loadMusic("victory");
music.play(settings);
Playing an effect.
final EffectSettings settings = new EffectSettings();
settings.setCycleCount(2);
final Effect effect = controller.loadEffect("thunder 2");
effect.play(settings);
- type - Either "effect" or "music".
- name - A unique ID for the sprite.
- Capital letters are ignored, so the words "Victory", "ViCtoRy", and "VICTORY" are all considered to be the same.
- path - The relative, or absolute, path to the file.
- This must begin with "./" if the filesystem is set to "jar".
- This must begin with "./" if the file is relative to the folder that the JAR is running from.
- filesystem - Either "local" or "jar".
[
{
"type": "effect",
"name": "thunder 1",
"path": "./test_res/effect_1.mp3",
"filesystem": "local"
},
{
"type": "effect",
"name": "thunder 2",
"path": "./test_res/effect_2.mp3",
"filesystem": "local"
},
{
"type": "music",
"name": "victory",
"path": "./test_res/music_1.wav",
"filesystem": "local"
}
]