Packagecom.whirled.contrib
Classpublic class SimpleSoundManager

A very simple sound manager for letting you globally adjust the volume on a number of different sounds. Volume can be faded by combining this with Tweener.



Protected Properties
 PropertyDefined by
  _baseVols : Dictionary
A mapping of SoundChannel objects to their base volume.
SimpleSoundManager
  _volume : Number = 1
The global volume value.
SimpleSoundManager
Public Methods
 MethodDefined by
  
Construct a SimpleSoundManager.
SimpleSoundManager
  
addChannel(channel:SoundChannel):void
Add a sound channel to be tracked.
SimpleSoundManager
  
removeChannel(channel:SoundChannel):void
Stop tracking the specified channel.
SimpleSoundManager
  
setGlobalVolume(volume:Number):void
Set the global volume of all the registered SoundChannels.
SimpleSoundManager
Protected Methods
 MethodDefined by
  
adjustVolume(channel:SoundChannel):void
Used to adjust the volume on each channel when registered, or the global volume changes.
SimpleSoundManager
  
handleChannelStopped(event:Event):void
Take care of removing a channel that's been stopped.
SimpleSoundManager
Property detail
_baseVolsproperty
protected var _baseVols:Dictionary

A mapping of SoundChannel objects to their base volume.

_volumeproperty 
protected var _volume:Number = 1

The global volume value.

Constructor detail
SimpleSoundManager()constructor
public function SimpleSoundManager()

Construct a SimpleSoundManager.

Method detail
addChannel()method
public function addChannel(channel:SoundChannel):void

Add a sound channel to be tracked. The initial volume level of this channel is taken to be the "base" sound level, so that when the global volume is adjusted this channel will adjust between 0 and the base. The channel will be automatically removed when it stops.

Parameters
channel:SoundChannel
adjustVolume()method 
protected function adjustVolume(channel:SoundChannel):void

Used to adjust the volume on each channel when registered, or the global volume changes.

Parameters
channel:SoundChannel
handleChannelStopped()method 
protected function handleChannelStopped(event:Event):void

Take care of removing a channel that's been stopped.

Parameters
event:Event
removeChannel()method 
public function removeChannel(channel:SoundChannel):void

Stop tracking the specified channel. This does not adjust the volume or stop the sound in any way.

Parameters
channel:SoundChannel
setGlobalVolume()method 
public function setGlobalVolume(volume:Number):void

Set the global volume of all the registered SoundChannels.

Parameters
volume:Number — a value between 1 (full volume) to 0 (silent).