A (175)

(Tuis.) #1

460 CHAPTER 12: Digital Audio: Providing Aural Feedback for UI Designs Using SoundPool


Finally, you should copy and paste the six compressed audio assets into the proper asset location in
the Android Project resource hierarchy, in the /res/raw folder, so you can access them later on in the
chapter in your code.


Figure 12-14. Warning dialog shown in the Export File dialog for a buttonaudio AMR file using a .3GP extension


Note We are about to get into the complexities of implementing the Android SoundPool digital audio
sequencing engine. Remember that the appendix covers digital audio concepts and principles that are used
in the remainder of this chapter. This information relates to what exactly digital audio sequencing is, as well
as how it ties into digital audio synthesis, as this powerful SoundPool class not only allows you to sequence
digital audio, but also to apply the effects afforded by digital audio synthesis to your digital audio sequences!
So if you are unsure of any terms used, please refer to the appendix.

Android SoundPool: Audio Engine & Methods


The Android SoundPool class is a direct subclass of the java.lang.Object master class. It’s important
to note that SoundPool is not a subclass of the Android MediaPlayer class, as one might be liable to
assume. However, like the MediaPlayer class, it is part of the android.media package, and thus, the
complete path to the class (as used in an import statement) would be android.media.SoundPool.
The Java class hierarchy looks like the following:


java.lang.Object



android.media.SoundPool



Since SoundPool is a subclass of java.lang.Object, we can infer that it is its own scratch-coded
audio sequencing engine creation. It is also important to note that you can use SoundPool objects
(SoundPool class) and MediaPlayer objects (MediaPlayer class) at the same time, if need be. In fact,
there are distinct applications for both of these audio playback classes. You should use MediaPlayer

Free download pdf