AudioCue is a new Java resource for playing back sound files, designed for use with game programming.
Java's Clip class (javax.audio.sampled.Clip) was not built with game programming needs in mind. The class has a tricky, non-intuitive syntax and a limited feature set. A Clip cannot be played concurrently with itself, can only be played at its recorded pitch, and the Control class provided for real time changes such as panning and volume is system-dependent upon implementation and limited by only allowing changes at buffer increments.
AudioCue addresses these issues:
-
- Very light: Download or copy/paste five class files from GitHub directly into your project.
- Syntax is simpler than Java's Clip class.
- API and demonstration programs provided.
-
- Runs directly on Java's SourceDataLine.
- Allows concurrent playback of cues.
- Allows playback at varying speeds.
- Real-time volume, panning and frequency faders.
- Highly configurable.
- Messaging system for coordination with graphics.
a single output line.
AudioCue requires five files:
In addition, there are two optional file folders with demo content and resources used by the demo programs:
Installation involves copying and pasting the five files into your program.
- Method 1) navigate to, then copy and paste the five files directly into your program.
- Method 2) download and unzip audiocue.zip, which holds these five files, into your project.
- Method 3) download audiocue.jar, which includes source code, the "supportpack" and "res" content, and import into your IDE. [NOTE: I'm not clear if the .jar file, which I generated from Eclipse, will import into other IDEs.]