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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 31. Playing and Generating Sound > Controlling Sound Playback

31.3. Controlling Sound Playback

After you've fired off an audio stream from a Sound object, you can control its playback. Remember that the handle for an active audio channel is the SoundChannel object returned by calling play() on a Sound.

31.3.1. Playing and Stopping

If you're sick of the sound you've chosen to play(), you can stop() it just as easily. Just call the stop() method on the SoundChannel object. This stops the audio and resets its playhead to zero — rewinds it. Example 31-2 modifies the Vivaldi player to stop playing when it detects a click.


  

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
  • DownloadDownload
  • PrintPrint