28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 15 ■ Implementing Game Audio Assets: Using the <strong>Java</strong>FX AudioClip Class Audio Sequencing Engine<br />

}<br />

iAudioFile3 = getClass().getResource("/downmono.wav");<br />

iSound3 = new AudioClip(iAudioFile3.toString());<br />

iAudioFile4 = getClass().getResource("/wmono.wav");<br />

iSound4 = new AudioClip(iAudioFile4.toString());<br />

iAudioFile5 = getClass().getResource("/smono.wav");<br />

iSound5 = new AudioClip(iAudioFile5.toString());<br />

Figure 15-15. Create more AudioClip objects referencing the rightmono, upmono, downmono, wmono, and smono files<br />

Since we’ve made our AudioClip objects private, we need to create methods inside of the InvinciBagel class,<br />

which can be called from our Bagel.java class (and other classes as well, later on in development) using method calls.<br />

Use your Source ➤ Insert Code ➤ Generate ➤ Setters work process to open the Generate Setters dialog, seen<br />

in Figure 15-16, and select the iSound0 through iSound5 objects, so that NetBeans creates six .setiSound() methods.<br />

www.it-ebooks.info<br />

337

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!