Moai SDK
1.5 revision 1 (MoaiEdition)
|
Inherits MOAIGlobalClass< TYPE, SUPER >.
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 ] )
eventName | ( string ) The name of the Event |
lineName | ( string ) Optional. Pass this is if you want the duration of a voice line |
Get memory usage.
function getMemoryStats ( [ boolean blocking ] )
blocking | ( boolean ) Optional. Default value is 'false.' |
Gets the volume for a sound category.
function getSoundCategoryVolume ( string categoryName )
categoryName | ( string ) Name of the category whose volume you wanna know |
Initializes the sound system.
function init ()
Returns true if the Event Manager is enabled (active).
function isEnabled ()
Checks to see whether a sound category is muted.
function isSoundCategoryMuted ( string categoryName )
categoryName | ( string ) Name of the category whose volume you wanna know |
Checks to see whether a sound category is muted.
function isSoundCategoryPaused ( string categoryName )
categoryName | ( string ) Name of the category whose volume you wanna know |
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 )
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. |
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 )
projectName | ( string ) The name of the .fev file (path should be relative from project root) |
Calls LoadProject and does all attendant special voice load stuff, as well. For regular projects, use loadProject()
function loadVoiceProject ( string projectName )
projectName | ( string ) The name of the .fsb file (path should be relative from project root) |
Stops all events/sounds from playing.
function muteAllEvents ( boolean muteSetting )
muteSetting | ( boolean ) Whether to mute (true) or unmute (false) |
Mute a sound category.
function muteSoundCategory ( string categoryName, boolean muteSetting )
categoryName | ( string ) Name of the category whose volume you wanna modify |
muteSetting | ( boolean ) Whether to mute the category or not (Default: true) |
Mute a sound category.
function pauseSoundCategory ( string categoryName, boolean pauseSetting )
categoryName | ( string ) Name of the category whose volume you wanna modify |
pauseSetting | ( boolean ) Whether to mute the category or not (Default: true) |
Plays an FMOD Event in 2D. Calling this function on 3D Events is undefined.
function playEvent2D ( string eventName [, boolean loopSound ] )
eventName | ( string ) Event to play |
loopSound | ( boolean ) Optional. Will force the Event to loop even if it does not in the data. |
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 ] )
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. |
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 ] )
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 |
Preload a high demand voice line.
function preloadVoiceLine ( string eventName, string lineName )
eventName | ( string ) The Event template to use for this line |
lineName | ( string ) The unique ID of the line to preload |
Set the default regional Reverb.
function setDefaultReverb ( string reverbName )
reverbName | ( string ) Name of the Reverb (defined in Designer) |
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 )
minRange | ( number ) Minimum distance from mic |
maxRange | ( number ) Maximum distance from mic |
maxOcclusion | ( number ) Maximum occlusion value |
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 )
minRange | ( number ) Minimum distance from mic |
maxRange | ( number ) Maximum distance from mic |
maxLevel | ( number ) Maximum pan level |
Sets the volume for a sound category.
function setSoundCategoryVolume ( string categoryName, number newVolume )
categoryName | ( string ) Name of the category whose volume you wanna modify |
newVolume | ( number ) New volume to set for the category |
Stops all events/sounds from playing.
function stopAllEvents ()
Calls UnloadProject and does all attendant special voice unload stuff, as well. For regular projects, use unloadProject()
function unloadAllVoiceProjects ()
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 ] )
eventName | ( string ) The name of the Event |
blockOnUnload | ( boolean ) Optional. Passing true means that the main thread will block while unloading |
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 )
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 |
Unloads all the pending unload groups. Use between act changes in the game.
function unloadPendingUnloads ( [ boolean blockOnUnload ] )
blockOnUnload | ( boolean ) Optional. Passing true means that the main thread will block while unloading |
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 )
projectName | ( string ) The name of the .fev file (path should be relative from project root) |