Packagecitrus.sounds
Classpublic class SoundManager
InheritanceSoundManager Inheritance CitrusEventDispatcher Inheritance Object



Public Properties
 PropertyDefined By
  _instance : SoundManager
[static]
SoundManager
  masterMute : Boolean
sets the master mute : resets all sound transforms to volume 0 if true, or returns to normal volue if false : normal volume is masterVolumeroupVolumeoundVolume
SoundManager
  masterVolume : Number
sets the master volume : resets all sound transforms to masterVolumeroupVolumeoundVolume
SoundManager
Protected Properties
 PropertyDefined By
 InheriteddispatchChildren : Vector.<CitrusEventDispatcher>
CitrusEventDispatcher
 InheriteddispatchParent : CitrusEventDispatcher
CitrusEventDispatcher
 Inheritedlisteners : Dictionary
CitrusEventDispatcher
  _masterMute : Boolean = false
SoundManager
  _masterVolume : Number = 1
SoundManager
  soundGroups : Vector.<CitrusSoundGroup>
SoundManager
  soundsDic : Dictionary
SoundManager
Public Methods
 MethodDefined By
  
SoundManager
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Warning: all references to the listener will be strong and you need to remove them explicitly.
CitrusEventDispatcher
  
add your own custom CitrusSoundGroup here.
SoundManager
  
addSound(id:String, params:Object = null):void
Register a new sound an initialize its values with the params objects.
SoundManager
  
create a CitrusSoundGroup with a group id.
SoundManager
  
crossFade(fadeOutId:String, fadeInId:String, tweenDuration:Number = 2):void
SoundManager
  
destroy():void
SoundManager
 Inherited
CitrusEventDispatcher
  
return group of id 'name' , defaults would be SFX or BGM
SoundManager
  
[static]
SoundManager
  
getSound(name:String):CitrusSound
returns a CitrusSound object.
SoundManager
 Inherited
hasEventListener(type:String):Boolean
CitrusEventDispatcher
  
Return true if Flash' SoundMixer is muted.
SoundManager
  
moveSoundToGroup(soundName:String, groupID:String = null):void
moves a sound to a group - if groupID is null, sound is simply removed from any groups
SoundManager
  
muteFlashSound(mute:Boolean = true):void
Mute/unmute Flash' SoundMixer.
SoundManager
  
pauseAll(... except):void
pauses all playing sounds
SoundManager
  
pauseSound(id:String):void
SoundManager
  
SoundManager
  
SoundManager
  
removeAllSounds(... except):void
SoundManager
 Inherited
removeEventListener(type:String, listener:Function):void
CitrusEventDispatcher
 Inherited
remove all event listeners (clears lists)
CitrusEventDispatcher
  
removeGroup(groupID:String):void
removes a group and detaches all its sounds - they will now have their default volume modulated only by masterVolume
SoundManager
 Inherited
removeListener(listener:Function):void
remove listener from all events
CitrusEventDispatcher
 Inherited
removeListenersOf(type:String):void
remove all listeners of event
CitrusEventDispatcher
  
removeSound(id:String):void
SoundManager
  
resumeAll(... except):void
resumes all paused sounds
SoundManager
  
resumeSound(id:String):void
SoundManager
  
setMute(id:String, mute:Boolean):void
set mute of a sound : if set to mute, neither the group nor the master volume will affect this sound of course.
SoundManager
  
setPanning(id:String, panning:Number):void
set pan of an individual sound (not affected by group or master
SoundManager
  
setVolume(id:String, volume:Number):void
set volume of an individual sound (its group volume and the master volume will be multiplied to it to get the final volume)
SoundManager
  
soundIsAdded(id:String):Boolean
tells if the sound is added in the list.
SoundManager
  
soundIsPaused(sound:String):Boolean
SoundManager
  
soundIsPlaying(sound:String):Boolean
SoundManager
  
stopAllPlayingSounds(... except):void
Stop playing all the current sounds.
SoundManager
  
stopSound(id:String):void
SoundManager
  
tweenVolume(id:String, volume:Number = 0, tweenDuration:Number = 2, callback:Function = null):void
tween the volume of a CitrusSound.
SoundManager
 Inherited
willTrigger(func:Function):Boolean
CitrusEventDispatcher
Protected Methods
 MethodDefined By
  
SoundManager
Property Detail
_instanceproperty
public static var _instance:SoundManager

_masterMuteproperty 
protected var _masterMute:Boolean = false

_masterVolumeproperty 
protected var _masterVolume:Number = 1

masterMuteproperty 
masterMute:Boolean

sets the master mute : resets all sound transforms to volume 0 if true, or returns to normal volue if false : normal volume is masterVolumeroupVolumeoundVolume


Implementation
    public function get masterMute():Boolean
    public function set masterMute(value:Boolean):void
masterVolumeproperty 
masterVolume:Number

sets the master volume : resets all sound transforms to masterVolumeroupVolumeoundVolume


Implementation
    public function get masterVolume():Number
    public function set masterVolume(value:Number):void
soundGroupsproperty 
protected var soundGroups:Vector.<CitrusSoundGroup>

soundsDicproperty 
protected var soundsDic:Dictionary

Constructor Detail
SoundManager()Constructor
public function SoundManager()



Method Detail
addGroup()method
public function addGroup(group:CitrusSoundGroup):CitrusSoundGroup

add your own custom CitrusSoundGroup here.

Parameters

group:CitrusSoundGroup

Returns
CitrusSoundGroup
addSound()method 
public function addSound(id:String, params:Object = null):void

Register a new sound an initialize its values with the params objects. Accepted parameters are:

Parameters

id:String
 
params:Object (default = null)

createGroup()method 
public function createGroup(groupID:String):CitrusSoundGroup

create a CitrusSoundGroup with a group id.

Parameters

groupID:String

Returns
CitrusSoundGroup
crossFade()method 
public function crossFade(fadeOutId:String, fadeInId:String, tweenDuration:Number = 2):void

Parameters

fadeOutId:String
 
fadeInId:String
 
tweenDuration:Number (default = 2)

destroy()method 
public function destroy():void

getGroup()method 
public function getGroup(name:String):CitrusSoundGroup

return group of id 'name' , defaults would be SFX or BGM

Parameters

name:String

Returns
CitrusSoundGroup — CitrusSoundGroup
getInstance()method 
public static function getInstance():SoundManager

Returns
SoundManager
getSound()method 
public function getSound(name:String):CitrusSound

returns a CitrusSound object. you can use this reference to change volume/panning/mute or play/pause/resume/stop sounds without going through SoundManager's methods.

Parameters

name:String

Returns
CitrusSound
handleSoundLoaded()method 
protected function handleSoundLoaded(e:CitrusSoundEvent):void

Parameters

e:CitrusSoundEvent

isFlashSoundMuted()method 
public function isFlashSoundMuted():Boolean

Return true if Flash' SoundMixer is muted.

Returns
Boolean
moveSoundToGroup()method 
public function moveSoundToGroup(soundName:String, groupID:String = null):void

moves a sound to a group - if groupID is null, sound is simply removed from any groups

Parameters

soundName:String
 
groupID:String (default = null) — ("BGM", "SFX" or custom group id's)

muteFlashSound()method 
public function muteFlashSound(mute:Boolean = true):void

Mute/unmute Flash' SoundMixer. No sound will be heard but they're still playing.

Parameters

mute:Boolean (default = true)

pauseAll()method 
public function pauseAll(... except):void

pauses all playing sounds

Parameters

... except — list of sound names to not pause.

pauseSound()method 
public function pauseSound(id:String):void

Parameters

id:String

playSound()method 
public function playSound(id:String):CitrusSoundInstance

Parameters

id:String

Returns
CitrusSoundInstance
preloadAllSounds()method 
public function preloadAllSounds():void

removeAllSounds()method 
public function removeAllSounds(... except):void

Parameters

... except

removeGroup()method 
public function removeGroup(groupID:String):void

removes a group and detaches all its sounds - they will now have their default volume modulated only by masterVolume

Parameters

groupID:String

removeSound()method 
public function removeSound(id:String):void

Parameters

id:String

resumeAll()method 
public function resumeAll(... except):void

resumes all paused sounds

Parameters

... except — list of sound names to not resume.

resumeSound()method 
public function resumeSound(id:String):void

Parameters

id:String

setMute()method 
public function setMute(id:String, mute:Boolean):void

set mute of a sound : if set to mute, neither the group nor the master volume will affect this sound of course.

Parameters

id:String
 
mute:Boolean

setPanning()method 
public function setPanning(id:String, panning:Number):void

set pan of an individual sound (not affected by group or master

Parameters

id:String
 
panning:Number

setVolume()method 
public function setVolume(id:String, volume:Number):void

set volume of an individual sound (its group volume and the master volume will be multiplied to it to get the final volume)

Parameters

id:String
 
volume:Number

soundIsAdded()method 
public function soundIsAdded(id:String):Boolean

tells if the sound is added in the list.

Parameters

id:String

Returns
Boolean
soundIsPaused()method 
public function soundIsPaused(sound:String):Boolean

Parameters

sound:String

Returns
Boolean
soundIsPlaying()method 
public function soundIsPlaying(sound:String):Boolean

Parameters

sound:String

Returns
Boolean
stopAllPlayingSounds()method 
public function stopAllPlayingSounds(... except):void

Stop playing all the current sounds.

Parameters

... except — an array of soundIDs you want to preserve.

stopSound()method 
public function stopSound(id:String):void

Parameters

id:String

tweenVolume()method 
public function tweenVolume(id:String, volume:Number = 0, tweenDuration:Number = 2, callback:Function = null):void

tween the volume of a CitrusSound. If callback is defined, its optional argument will be the CitrusSound.

Parameters

id:String
 
volume:Number (default = 0)
 
tweenDuration:Number (default = 2)
 
callback:Function (default = null)