protected var _backgroundVolume:Number
backgroundVolume:Number [read-write]Implementation
public function get backgroundVolume():Number
public function set backgroundVolume(value:Number):void
protected var _channels:Map
protected var _effectsVolume:Number
effectsVolume:Number [read-write]Implementation
public function get effectsVolume():Number
public function set effectsVolume(value:Number):void
protected var _eventMgr:EventHandlerManager
protected var _levelPackMgr:LevelPackManager
protected var _soundFactory:SoundFactory
protected var _tickBindings:Array
protected var _timer:Timer
protected var _track:SoundChannel
protected var _trackName:String
protected var _tracks:Map
public function SoundController(factory:SoundFactory = null, initialBackgroundVolume:Number = 0.5, initialEffectsVolume:Number = 0.5, levelPackMgr:LevelPackManager = null)
Parameters
| factory:SoundFactory (default = null) — The sound factory to use to fetch sound effects. If none is provided,
a default ApplicationDomainSoundFactory is created that uses the currentDomain
|
| |
| initialBackgroundVolume:Number (default = 0.5) — The initial value of the background volume
|
| |
| initialEffectsVolume:Number (default = 0.5) — The initial volume of sound effects
|
| |
| levelPackMgr:LevelPackManager (default = null) — Background music is defined as MP3s that are loaded out of game level
packs. If no LevelPackManager is provided, LevelPacks.getGlobalManager()
is used.
|
protected function addBinding(binding:Function):voidParameters
protected function bindChannelRemoval(key:String):FunctionParameters
Returns
protected function bindFadein(channel:SoundChannel, type:SoundType):FunctionParameters
| channel:SoundChannel |
| |
| type:SoundType |
Returns
protected function bindFadeout(channel:SoundChannel):FunctionParameters
Returns
protected function getKey(effect:SoundEffect, id:int):StringParameters
Returns
protected function loopTrack():void
public function playEffect(effect:SoundEffect, id:int = 0, location:Point = null):void
Location indicates how far off center the sound should feel to the user. The pure distance
from (0, 0) indicates the overall volume level that the effect will play at, and the x value
indicates how far left/right the sound will be panned.
The location point x and y values should be normalized to a [-1, 1] scale.
Parameters
| effect:SoundEffect |
| |
| id:int (default = 0) |
| |
| location:Point (default = null) |
protected function playSound(sound:Sound, volume:Number, pan:Number = 0):SoundChannelParameters
| sound:Sound |
| |
| volume:Number |
| |
| pan:Number (default = 0) |
Returns
public function shutdown():void
public function startBackgroundMusic(name:String, crossfade:Boolean = true, loop:Boolean = true):voidParameters
| name:String |
| |
| crossfade:Boolean (default = true) |
| |
| loop:Boolean (default = true) |
public function stopBackgroundMusic(fadeOut:Boolean = true):voidParameters
| fadeOut:Boolean (default = true) |
public function stopEffect(effect:SoundEffect, id:int):voidParameters
protected function tick(... ignored):voidParameters
Event object type: flash.events.Event
public static const BACKGROUND_MUSIC_COMPLETE:String = "backgroundMusicComplete"
protected static const DISTANCE_NORMALIZE:Number
protected static const FADE_TIME:int = 3000
public static const SOUND_ENABLED:Boolean = true