Game Development Reference
In-Depth Information
stalled in Chapter 1 , when we installed all of your open source game development soft-
ware tools. We'll go through an audio asset creation and optimization process using
Audacity. We will use the concepts that we learned in Chapter 5 covering new media
content creation concepts, and optimize digital audio files to achieve an 800% data
footprint savings. We will do this so that our digital audio assets do not use more than
64KB of our system memory; in fact, we will get six 16-bit digital audio assets to use
less than 62KB of data.
Once we have created the six audio assets, which will match up with the six differ-
ent keys that we are using to control our InvinciBagel character, we will create the
.loadAudioAssets() method in the InvinciBagel class and learn how to declare Audi-
oClip and URL objects. Inside of the .loadAudioAssets() method we will then use
these two classes (objects) together in order to create our digital audio assets for the
game and install them into the player's computer system (or consumer electronics
device) memory.
Once these six AudioClip objects are in place, we will then have NetBeans create
six Setter methods for the AudioClip objects and then “morph” these .setiSound()
methods into the .playiSound() methods that we require. After this is done, we will go
into our Bagel.java class, and add a .playAudioClip() method. Inside of this method,
we will call the six .playiSound() methods, based upon which keys the player is press-
ing.
We have a lot of ground to cover during this chapter, so let's get started by taking
an in-depth look at the JavaFX AudioClip class and its various properties and methods
that we can invoke impressive audio sequencing with! After we get that out of the way
we can get into the fun stuff and start using Audacity 2.0.6 and NetBeans 8 to create!
JavaFX AudioClip Class: A Digital Au-
dio Sequencer
The public final AudioClip class is part of the javafx.scene.media package, and is es-
sentially a digital audio sample playback and audio sequencing engine that is designed
to use short audio snippets or “samples” to create more complex audio performances.
This is why this class is the perfect digital audio media playback class to use for your
Java 8 game development. As you can see by the Java inheritance hierarchy shown be-
low, the JavaFX AudioClip class is a direct subclass of the java.lang.Object master
class. This signifies that the AudioClip class has been “scratch coded” specifically for
the purpose of being a digital audio sequencing engine.
Search WWH ::




Custom Search