Summary
In this chapter, you learned how to use LibGDX's four audio interfaces, Sound
, Music
, AudioDevice
, and AudioRecorder
, and about their specific use cases. We took a look at the freely available and open source sound generators and used one of them to create sound effects that can be used in Canyon Bunny. We also added background music to the game and understood that LibGDX takes care of when a music instance being played needs to be paused and resumed in terms of the life cycle in a LibGDX application. A manager class called AudioManager
was created to gain centralized control over any audio-related actions. Finally, playing music and sounds turned out to be a very straightforward process in conjunction with the use of our audio manager. We had to add just a few new lines of code to trigger the music and sound effects at the right time for each event.
In the next chapter, we will look at some advanced programming techniques. This includes using a physics engine suitable for two...