com.jtransc.game.audio.Sound Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-media-game Show documentation
Show all versions of jtransc-media-game Show documentation
JVM AOT compiler currently generating Javascript and Haxe, with initial focus on Kotlin and games.
package com.jtransc.game.audio;
import com.jtransc.media.JTranscAudio;
/**
* Use JTranscGame.sound() to create a sound
*/
public class Sound {
private int id;
public Sound(String path) {
id = JTranscAudio.createSound(path);
}
public void dispose() {
if (id < 0) return;
JTranscAudio.disposeSound(id);
id = -1;
}
public void play() {
JTranscAudio.playSound(id);
}
}