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

11. Sound > Changing Sound Volume and Pan

Changing Sound Volume and Pan

During playback, it’s possible to manipulate the volume and pan of individual channels, as well as the global mixer containing all sounds. Doing so requires the SoundTransform class.

The process involves starting with a SoundTransform instance (either by creating a new instance or by storing a reference to the existing transform object of the channel or mixer), setting the volume and/or pan setting of that instance, and then applying the transformation to the channel. For example, this snippet will set the volume of a SoundChannel instance called channel to 50 percent.

var trans:SoundTransform = new SoundTransform();
trans.volume = 0.5;
channel.soundTransform = trans;

This syntax will set the volume of a channel to half of what it currently is:


  

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