Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15: Media > Adding Sounds to an Application

Adding Sounds to an Application

In the first demo, you played a video, but you can also use MediaElement to play music files or create sound effects in a game or application. In this demo, you will learn how to apply a sound effect to an animated object—in this case, a flying robot. Such sound effects are essential in games. You will also learn to handle background music that users may be listening to prior to launching your application. This is done in accordance with the marketplace rules for receiving user approval to stop music that is currently playing in the background before playing the application’s sound.

Figure 15-4 shows the UI of the demo application. When you click the Play button, the robot flies diagonally toward the bottom-right corner of the screen. When it reaches an edge, the robot will bounce several times while making a swooshing sound to give the animation that dash of realism it needs to satisfy gamers.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint