Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIFmodEventMgr Class Reference

Inherits MOAIGlobalClass< TYPE, SUPER >.

List of all members.

Function List

  getMemoryStats
  init
  isEnabled
  loadProject
  unloadProject
  loadVoiceProject
  unloadAllVoiceProjects
  loadGroup
  unloadGroup
  unloadPendingUnloads
  setSoundCategoryVolume
  getSoundCategoryVolume
  muteSoundCategory
  isSoundCategoryMuted
  pauseSoundCategory
  isSoundCategoryPaused
  playEvent3D
  playEvent2D
  playVoiceLine
  unloadEvent
  stopAllEvents
  muteAllEvents
  getEventDuration
  preloadVoiceLine
  getMicrophone
  setDefaultReverb
  setDistantOcclusion
  setNear2DBlend

Function Documentation

Returns the duration of an Event. Although multiple sounds can potentially be played from 1 Event, to support determinism, a consistent duration will be returned for a given Event.


function getEventDuration ( string eventName [, string lineName ] )
Parameters:
eventName ( string ) The name of the Event
lineName ( string ) Optional. Pass this is if you want the duration of a voice line
Returns:
duration ( number )

Get memory usage.


function getMemoryStats ( [ boolean blocking ] )
Parameters:
blocking ( boolean ) Optional. Default value is 'false.'
Returns:
currentAlloc ( number ), maxAlloc ( number )

Returns the game microphone.


function getMicrophone ()
Returns:
mic ( MOAIFmodMicrophone )

Gets the volume for a sound category.


function getSoundCategoryVolume ( string categoryName )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna know
Returns:
categoryVolume ( number )

Initializes the sound system.


function init ()
Returns:
enabled ( boolean )

Returns true if the Event Manager is enabled (active).


function isEnabled ()
Returns:
enabled ( boolean )

Checks to see whether a sound category is muted.


function isSoundCategoryMuted ( string categoryName )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna know
Returns:
isMuted ( boolean )

Checks to see whether a sound category is muted.


function isSoundCategoryPaused ( string categoryName )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna know
Returns:
isMuted ( boolean )

Loads the wave data and instance data associated with a particular group. Groups are reference counted internally, with each call to LoadGroup incrementing the ref count.


function loadGroup ( string groupPath, boolean persistent, boolean blockOnLoad )
Parameters:
groupPath ( string ) Should be of the form ProjectName/GroupName
persistent ( boolean ) Passing true means that this group is expected to be around for the entire duration of the app
blockOnLoad ( boolean ) Passing true means that the main thread will block while loading wav data for this Group.
Returns:
loaded ( boolean )

Loads a project from disk, but does not load any wav or instance data. Projects must be loaded before sounds can be played from them. For special voice projects, use loadVoiceProject()


function loadProject ( string projectName )
Parameters:
projectName ( string ) The name of the .fev file (path should be relative from project root)
Returns:
loaded ( boolean )

Calls LoadProject and does all attendant special voice load stuff, as well. For regular projects, use loadProject()


function loadVoiceProject ( string projectName )
Parameters:
projectName ( string ) The name of the .fsb file (path should be relative from project root)
Returns:
loaded ( boolean )

Stops all events/sounds from playing.


function muteAllEvents ( boolean muteSetting )
Parameters:
muteSetting ( boolean ) Whether to mute (true) or unmute (false)
Returns:
nil

Mute a sound category.


function muteSoundCategory ( string categoryName, boolean muteSetting )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna modify
muteSetting ( boolean ) Whether to mute the category or not (Default: true)
Returns:
nil

Mute a sound category.


function pauseSoundCategory ( string categoryName, boolean pauseSetting )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna modify
pauseSetting ( boolean ) Whether to mute the category or not (Default: true)
Returns:
nil

Plays an FMOD Event in 2D. Calling this function on 3D Events is undefined.


function playEvent2D ( string eventName [, boolean loopSound ] )
Parameters:
eventName ( string ) Event to play
loopSound ( boolean ) Optional. Will force the Event to loop even if it does not in the data.
Returns:
eventInst ( MOAIFmodEventInstance )

Plays an FMOD Event 3D. Calling this function on 2D Events is harmless, but not advised.


function playEvent3D ( string eventName [, number x, number y, number z, boolean loopSound ] )
Parameters:
eventName ( string ) Event to play
x ( number ) Optional. x position of this sound
y ( number ) Optional. y position of this sound
z ( number ) Optional. z position of this sound
loopSound ( boolean ) Optional. Will force the Event to loop even if it does not in the data.
Returns:
eventInst ( MOAIFmodEventInstance )

Plays a voice line that exists in a loaded voice project. Will play it 2D or 3D based on Event settings. Uses a unique identifier for the line that is not the name of the Event -- although the event serves as a template for how the line will play.


function playVoiceLine ( string linename, string eventName [, number x, number y, number z ] )
Parameters:
linename ( string ) Unique identifier for a voice line
eventName ( string ) The Event template to use for playing this line
x ( number ) Optional. x position of this sound
y ( number ) Optional. y position of this sound
z ( number ) Optional. z position of this sound
Returns:
eventInst ( MOAIFmodEventInstance )

Preload a high demand voice line.


function preloadVoiceLine ( string eventName, string lineName )
Parameters:
eventName ( string ) The Event template to use for this line
lineName ( string ) The unique ID of the line to preload
Returns:
nil

Set the default regional Reverb.


function setDefaultReverb ( string reverbName )
Parameters:
reverbName ( string ) Name of the Reverb (defined in Designer)
Returns:
nil

Sets a lowpass filter on distant sounds -- a filter added to everything greater than a certain distance (minRange to maxRange) from the microphone to make it sound muffled/far away.


function setDistantOcclusion ( number minRange, number maxRange, number maxOcclusion )
Parameters:
minRange ( number ) Minimum distance from mic
maxRange ( number ) Maximum distance from mic
maxOcclusion ( number ) Maximum occlusion value
Returns:
nil

Blend sounds near the microphone to 2D sounds. When 3D Events are playing near the microphone, their positioning becomes distracting rather than helpful/interesting, so this is a way to blend them together as if they were all taking place just at the mic.


function setNear2DBlend ( number minRange, number maxRange, number maxLevel )
Parameters:
minRange ( number ) Minimum distance from mic
maxRange ( number ) Maximum distance from mic
maxLevel ( number ) Maximum pan level
Returns:
nil

Sets the volume for a sound category.


function setSoundCategoryVolume ( string categoryName, number newVolume )
Parameters:
categoryName ( string ) Name of the category whose volume you wanna modify
newVolume ( number ) New volume to set for the category
Returns:
nil

Stops all events/sounds from playing.


function stopAllEvents ()
Returns:
nil

Calls UnloadProject and does all attendant special voice unload stuff, as well. For regular projects, use unloadProject()


function unloadAllVoiceProjects ()
Returns:
unloaded ( boolean )

Unloads the data associated with an Event. All instances of this Event will be stopped when this call is made. Returns true if the Event is no longer loaded after this call.


function unloadEvent ( string eventName [, boolean blockOnUnload ] )
Parameters:
eventName ( string ) The name of the Event
blockOnUnload ( boolean ) Optional. Passing true means that the main thread will block while unloading
Returns:
eventUnloaded ( boolean )

Unloads the wave data and instance data associated with a particular group. Groups might not be unloaded immediately either because their reference count is not zero, or because the sound system is not ready to release the group.


function unloadGroup ( string groupPath, boolean unloadImmediately )
Parameters:
groupPath ( string ) Should be of the form ProjectName/GroupName
unloadImmediately ( boolean ) If true is passed in, it'll try to unload now, but won't block. Passing false will allow it to wait before trying to unload
Returns:
unloaded ( boolean )

Unloads all the pending unload groups. Use between act changes in the game.


function unloadPendingUnloads ( [ boolean blockOnUnload ] )
Parameters:
blockOnUnload ( boolean ) Optional. Passing true means that the main thread will block while unloading
Returns:
nil

Unloads all data associated with a particular project. Completely flushes all memory associated with the project. For special voice projects, use unloadAllVoiceProjects()


function unloadProject ( string projectName )
Parameters:
projectName ( string ) The name of the .fev file (path should be relative from project root)
Returns:
unloaded ( boolean )