JavaSound

JavaSound represents the built-in libraries that accompany the JDK. JavaSound is still listed as an extension to the JDK and is included in the Java extension packages. Before the release of JOAL, JavaSound represented the game programmer’s best chance of working with audio.

The core classes of JavaSound are found in the javax.sound.sampled and the javax.sound.midi packages. These packages each offer a range of options for sound-related programming for use in both applications and applets.

javax.sound.midi: Contains everything a programmer needs to load and play back MIDI files in an application. The capabilities of the MIDI library go way beyond the needs of the typical game. The standard loading and playback mechanisms as well as a complete MIDI synthesizer can be found. Most PC games would not have obvious use for full MIDI synthesis, but the imagination is the only limitation. Historically, MIDI synthesis formed the backbone of game audio until memory prices dropped to allow the average machine to have more than 32MG of RAM. As long as there are embedded game systems, MIDI synthesis will be an integral part of game development.

javax.sound.sampled: Handles all aspects of digital audio in JavaSound. The fundamental architecture of this package views the use of audio in the same manner as a physical mixer. Full support exists for audio mixing, filtering, recording, and streaming. This package contains the basic utilities to process playback in a number of audio formats and is capable of handling custom formats through the service provider classes. Frankly, JavaSound provides far too much for basic game playback. JavaSound is designed to handle professional-quality sound recordings and to give the Java platform a robust group of tools to process audio for a number of types of applications.

The general downside to JavaSound is the real-time performance drawbacks. Most of the basic functionality cannot process looping quickly enough to be implemented in games requiring quick repeating sounds. You can circumvent these limitations in code, but they tend not to be preferred against the group of other available options.

Light Weight Java Game Library (LWJGL)

This project stems from a group of game developers taking the initiative to create powerful game libraries centered on OpenGL and OpenAL. This is not an official Java release, but several games have been created using it. The LWJGL OpenAL bindings are more mature than the official libraries in many cases, but they require a different style of programming to achieve their power. One of the core premises of the project is that the APIs are stripped to the bare minimum of functionality, hence the name “Light Weight.” The LWJGL goes so far as to expose pointers to Java programmers to reduce additional overhead created by working with the JNI. The LWJGL continues to evolve and can be found at www.lwjgl.org.

Java OpenAL Library (JOAL)

The Java OpenAL Library (JOAL) represents a binding of Java functions to the native OpenAL implementations through the use of the Java Native Interface (JNI). Effectively, the set of Java functions are mapped directly through to the native C calls made in the actual OpenAL library. JOAL is one of the three core game technologies available on the Java platform. JOAL is designed to present game developers using the Java platform with high-performance audio capabilities and, in doing so, replace JavaSound for most game audio requirements.

JOAL is still a young library and will no doubt go through a number of revisions until it implements all expected functionality of OpenAL. JOAL is a great step forward for audio programming on the Java platform.

This chapter is designed to give an overview of JOAL and introduce you to the basic concepts regarding its usage. Per the authors’ knowledge, this book is the first to catalog this new Java gaming technology. Be sure to check for an updated implementation before working with JOAL. Although it is certainly the intent of this chapter to be thorough, technology is ever changing and improving itself.

This section has shown a number of existing technologies available to Java game developers regarding sound. Additional options exist beyond those listed here. Be sure to evaluate each one to find the best fit for your next project.

With that technology overview, the remainder of the chapter emphasizes the Java games core library JOAL, demonstrating the capabilities and limitations of the API.



Practical Java Game Programming
Practical Java Game Programming (Charles River Media Game Development)
ISBN: 1584503262
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net