sfxSystem.cpp
Engine/source/sfx/sfxSystem.cpp
Public Variables
_sfxPlay2 ("@brief Create a new play-once source for the given @a track and start playback of the source.\n\n" "This is equivalent to calling sfxCreateSource() on @track and SFXSource::play() on the resulting source.\n\n" "@param track The sound datablock to play.\n\n" "@return The newly created play-once source or 0 if the creation failed.\n\n" "@ref SFXSource_playonce\n\n" "@ingroup SFX", NULL, "void sfxPlay( SFXTrack track );")
Public Functions
_sfxCreateSource1("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource2("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the given track and position its 3D sounds source at the given coordinates (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is a 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource3("@brief Create a temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename and then create and return a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">profile.\n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource4("@brief Create a temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename and then create and return a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the profile. " "Position the sound source at the given coordinates (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is a 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxPlay3("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given @a track, position its 3D sound at the given coordinates(<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the track 's description " "is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound) and start playback of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "This is equivalent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling sfxCreateSource() on @track and <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() on the resulting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" " @param track The sound datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n\n</a>" " @param x The X coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param y The Y coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param z The Z coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return The newly created play-once source or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the creation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "void sfxPlay( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track, float x, float y, float z );" )
_sPlayOnce1("@brief Create a play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">update.\n</a>" " @param track The sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track );" )
_sPlayOnce2("@brief Create a play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given given @a track and position the source's 3D sound at the given coordinates " "only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the track's description is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound)
_sPlayOnce3("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename, then create a play-once source " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> it and start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " "otherwise by then, the temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> will also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted.\n</a>" " @param description The description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n</a>" " @param filename Path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Play a sound effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">once.\n</a>" "sfxPlayOnce( AudioEffects, \"art/sound/weapons/Weapon_pickup\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename );" )
_sPlayOnce4("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename, then create a play-once source " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> it and start playback. Position the source 's 3D sound at the given coordinates(only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the description " "is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " "otherwise by then, the temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> will also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted.\n</a>" " @param description The description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n</a>" " @param filename Path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" " @param x The X coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param y The Y coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param z The Z coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param fadeInTime If >= 0, this overrides the SFXDescription::fadeInTime value on the track 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Play a sound effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> once using a 3D sound with a default falloff placed at the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">origin.\n</a>" "sfxPlayOnce( AudioDefault3D, \"art/sound/weapons/Weapon_pickup\", 0, 0, 0 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename, float x, float y, float z, float fadeInTime=-1 );" )
DefineConsoleFunction(sfxCreateSource , S32 , (const char *sfxType, const char *arg0, const char *arg1, const char *arg2, const char *arg3) , ("", "", "", "") , "( SFXTrack track | ( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename ) [, float x, float y, float z ] ) " "Creates a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> paused sound source using a profile or a description " "and filename. The return value is the source which must be " "released by delete().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@hide" )
DefineConsoleFunction(sfxPlay , S32 , (const char *trackName, const char *pointOrX, const char *y, const char *z) , ("", "", "") , "Start playing the given source or create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given track and play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n</a>" "@hide" )
DefineConsoleFunction(sfxPlayOnce , S32 , (const char *sfxType, const char *arg0, const char *arg1, const char *arg2, const char *arg3, const char *arg4) , ("", "", "", "", "-1.0f") , "SFXSource sfxPlayOnce( ( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track | <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename ) [, float x, float y, float z, float fadeInTime=-1 ] ) " "Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given profile or description+filename and start playback of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "@hide" )
DefineEngineFunction(sfxCreateDevice , bool , (const char *provider, const char *device, bool useHardware, S32 maxBuffers) , "Try <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> sound device using the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">properties.\n</a>" "If a sound device is currently initialized, it will be uninitialized first. However, be aware that in this case, " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this function fails, it will not restore the previously active device but rather leave the sound system in an " "uninitialized <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "Sounds that are already playing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> device is created will be temporarily transitioned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> virtualized " "playback and then resume normal playback once the device has been <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">created.\n\n</a>" "In the core scripts, sound is automatically set up during startup in the sfxStartup() <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">function.\n\n</a>" " @param provider The name of the device provider as returned by sfxGetAvailableDevices().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param device The name of the device as returned by sfxGetAvailableDevices().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param useHardware Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> enabled hardware mixing on the device or not. Only relevant <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> supported by the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device.\n</a>" " @param maxBuffers The maximum number of concurrent voices <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this device <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use or -1 <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the device <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> pick its own reasonable default." " @return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the initialization was successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" " @note This function must be called before any of the sound playback functions can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetAvailableDevices\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDeviceInfo\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDeleteDevice\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDeleteDevice , void , () , "Delete the currently active sound device and release all its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resources.\n</a>" "SFXSources that are still playing will be transitioned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> virtualized playback mode. " "When creating a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> device, they will automatically transition back <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In the core scripts, this is done automatically <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> you during shutdown in the sfxShutdown() <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">function.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDeleteWhenStopped , void , (SFXSource *source) , "Mark the given @a source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> deletion as soon as it moves into stopped <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "This function will retroactively turn the given @a source into a play-once source (see @ref SFXSource_playonce).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param source A sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDumpSources , void , (bool includeGroups) , (false) , "Dump information about all current <a href="/coding/class/classsfxsource/">SFXSource</a> instances <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console.\n</a>" "The dump includes information about the playback status <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> each source, volume levels, virtualization , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">etc.\n</a>" " @param includeGroups If true, direct instances of SFXSources(which represent logical sound groups) will be included. " "Otherwise only instances of subclasses of SFXSources are included in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">dump.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDumpSourcesToString\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDumpSourcesToString , const char * , (bool includeGroups) , (false) , "Dump information about all current <a href="/coding/class/classsfxsource/">SFXSource</a> instances <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string.\n</a>" "The dump includes information about the playback status <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> each source, volume levels, virtualization , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">etc.\n</a>" " @param includeGroups If true, direct instances of SFXSources(which represent logical sound groups) will be included. " "Otherwise only instances of subclasses of SFXSources are included in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">dump.\n</a>" " @return A string containing a dump of information about all currently instantiated <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSources.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDumpSources\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetAvailableDevices , const char * , () , "Get a list of all available sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">devices.\n</a>" "The return value will be a newline-separated list of entries where each line describes one available sound " "device. Each such line will have the following format:" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">verbatim\n</a>" "provider TAB device TAB hasHardware TAB <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numMaxBuffers\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endverbatim\n</a>" "- provider: The name of the device provider (e.g. \"FMOD\").\n" "- device: The name of the device as returned by the device <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">layer.\n</a>" "- hasHardware: Whether the device supports hardware mixing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " "limit is exceeded, i.e. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there are more active sounds playing at any one time, then voice virtualization " "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " "be provided by the device itself;<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not provided by the device, it will be provided by Torque 's sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n\n</a>" " @return A newline-separated list of information about all available sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">devices.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDeviceInfo\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_PROVIDER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_NAME\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_USEHARDWARE\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_MAXBUFFERS\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDeviceInfo , const char * , () , "Return information about the currently active sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device.\n</a>" "The return value is a tab-delimited string of the following <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format:\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">verbatim\n</a>" "provider TAB device TAB hasHardware TAB numMaxBuffers TAB <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">caps\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endverbatim\n</a>" "- provider: The name of the device provider (e.g. \"FMOD\").\n" "- device: The name of the device as returned by the device <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">layer.\n</a>" "- hasHardware: Whether the device supports hardware mixing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " "limit is exceeded, i.e. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there are more active sounds playing at any one time, then voice virtualization " "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " "be provided by the device itself;<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not provided by the device, it will be provided by Torque 's sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "- caps:A bitfield of capability <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">flags.\n\n</a>" " @return A tab-separated list of properties of the currently active sound device or the empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> no sound device has been <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">initialized.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetAvailableDevices\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_PROVIDER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_NAME\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_USEHARDWARE\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_MAXBUFFERS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_CAPS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_REVERB\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_VOICEMANAGEMENT\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_OCCLUSION\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_DSPEFFECTS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_MULTILISTENER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_FMODDESIGNER\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDistanceModel , SFXDistanceModel , () , "Get the falloff curve type currently being applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@return The current distance model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">type.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDopplerFactor , F32 , () , "Get the current global doppler effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setting.\n\n</a>" "@return The current global doppler effect scale factor (>=0).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxSetDopplerFactor\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_doppler\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetRolloffFactor , F32 , () , "Get the current global scale factor applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> volume attenuation of 3D sounds in the logarithmic <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n</a>" "@return The current scale factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> logarithmic 3D sound falloff <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curves.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDistanceModel\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetDistanceModel , void , (SFXDistanceModel model) , "Set the falloff curve type <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> distance-based volume attenuation of 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@param model The distance model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sound.\n\n</a>" "@note This setting takes effect globally and is applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> all 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetDopplerFactor , void , (F32 value) , "Set the global doppler effect scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@param value The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> doppler shift scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@pre @a value must be >= 0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDopplerFactor\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_doppler\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetRolloffFactor , void , (F32 value) , "Set the global scale factor <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> volume attenuation of 3D sounds in the logarithmic <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n</a>" "@param value The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> scale factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> logarithmic 3D sound falloff <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curves.\n\n</a>" "@pre @a value must be, 0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @note This function has no effect <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the currently distance model is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel::Linear.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDistanceModel\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxStop , void , (SFXSource *source) , "Stop playback of the given @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "This is equivalent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling <a href="/coding/class/classsfxsource/#classsfxsource_1a978d0e62496766631ed34894d82b4c11">SFXSource::stop</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param source The source <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> put into stopped <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxStopAndDelete , void , (SFXSource *source) , "Stop playback of the given @a source (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is not already stopped) and delete the @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "The advantage of this function over directly calling delete() is that it will correctly " "handle volume fades that may be configured on the source. Whereas calling delete() would immediately " "stop playback and delete the source, this functionality will wait <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the fade-out <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play and only then " "stop the source and delete <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" " @param source A sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_fades\n\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXChannel , "Channels are individual properties of sound sources that may be animated over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">time.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXParameter\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_interactive\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXDistanceModel , "Type of volume distance attenuation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curve.\n</a>" "The distance model determines the falloff curve applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the volume of 3D sounds over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">distance.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXStatus , "Playback status of sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
MODULE_SHUTDOWN_BEFORE(Sim )
Detailed Description
Public Variables
ConsoleDocFragment _sfxPlay2 ("@brief Create a new play-once source for the given @a track and start playback of the source.\n\n" "This is equivalent to calling sfxCreateSource() on @track and SFXSource::play() on the resulting source.\n\n" "@param track The sound datablock to play.\n\n" "@return The newly created play-once source or 0 if the creation failed.\n\n" "@ref SFXSource_playonce\n\n" "@ingroup SFX", NULL, "void sfxPlay( SFXTrack track );")
EndImplementEnumType
MODULE_END
MODULE_SHUTDOWN
const U32 sDeviceCapsDSPEffects
const U32 sDeviceCapsFMODDesigner
const U32 sDeviceCapsMultiListener
const U32 sDeviceCapsOcclusion
const U32 sDeviceCapsReverb
const U32 sDeviceCapsVoiceManagement
const U32 sDeviceInfoMaxBuffers
const U32 sDeviceInfoName
const U32 sDeviceInfoProvider
const U32 sDeviceInfoUseHardware
Public Functions
_sfxCreateSource1("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource2("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the given track and position its 3D sounds source at the given coordinates (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is a 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource3("@brief Create a temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename and then create and return a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">profile.\n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxCreateSource4("@brief Create a temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename and then create and return a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source that plays the profile. " "Position the sound source at the given coordinates (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is a 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The source will be returned in stopped state. Call <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In contrast <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play-once sources)
_sfxPlay1()
_sfxPlay3("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given @a track, position its 3D sound at the given coordinates(<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the track 's description " "is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound) and start playback of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "This is equivalent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling sfxCreateSource() on @track and <a href="/coding/class/classsfxsource/#classsfxsource_1ac4fc07cbb3de3393c29e6fe76ed4cd06">SFXSource::play</a>() on the resulting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" " @param track The sound datablock <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n\n</a>" " @param x The X coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param y The Y coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param z The Z coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @return The newly created play-once source or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the creation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "void sfxPlay( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track, float x, float y, float z );" )
_sPlayOnce1("@brief Create a play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">update.\n</a>" " @param track The sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track );" )
_sPlayOnce2("@brief Create a play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given given @a track and position the source's 3D sound at the given coordinates " "only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the track's description is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound)
_sPlayOnce3("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename, then create a play-once source " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> it and start <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " "otherwise by then, the temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> will also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted.\n</a>" " @param description The description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n</a>" " @param filename Path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Play a sound effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">once.\n</a>" "sfxPlayOnce( AudioEffects, \"art/sound/weapons/Weapon_pickup\" );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename );" )
_sPlayOnce4("@brief Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> from the given @a description and @a filename, then create a play-once source " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> it and start playback. Position the source 's 3D sound at the given coordinates(only <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the description " "is set up <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D sound).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " "otherwise by then, the temporary <a href="/coding/class/classsfxprofile/">SFXProfile</a> will also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">deleted.\n</a>" " @param description The description <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n</a>" " @param filename Path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">play.\n</a>" " @param x The X coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param y The Y coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param z The Z coordinate of the 3D sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">position.\n</a>" " @param fadeInTime If >= 0, this overrides the SFXDescription::fadeInTime value on the track 's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">description.\n</a>" " @return A newly created temporary source in \"Playing\" state or 0 <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the operation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">failed.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Play a sound effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> once using a 3D sound with a default falloff placed at the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">origin.\n</a>" "sfxPlayOnce( AudioDefault3D, \"art/sound/weapons/Weapon_pickup\", 0, 0, 0 );\n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_playonce\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" , NULL , "SFXSource sfxPlayOnce( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename, float x, float y, float z, float fadeInTime=-1 );" )
DefineConsoleFunction(sfxCreateSource , S32 , (const char *sfxType, const char *arg0, const char *arg1, const char *arg2, const char *arg3) , ("", "", "", "") , "( SFXTrack track | ( <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename ) [, float x, float y, float z ] ) " "Creates a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> paused sound source using a profile or a description " "and filename. The return value is the source which must be " "released by delete().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@hide" )
DefineConsoleFunction(sfxPlay , S32 , (const char *trackName, const char *pointOrX, const char *y, const char *z) , ("", "", "") , "Start playing the given source or create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given track and play <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n</a>" "@hide" )
DefineConsoleFunction(sfxPlayOnce , S32 , (const char *sfxType, const char *arg0, const char *arg1, const char *arg2, const char *arg3, const char *arg4) , ("", "", "", "", "-1.0f") , "SFXSource sfxPlayOnce( ( <a href="/coding/class/classsfxtrack/">SFXTrack</a> track | <a href="/coding/class/classsfxdescription/">SFXDescription</a> description, string filename ) [, float x, float y, float z, float fadeInTime=-1 ] ) " "Create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> play-once source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the given profile or description+filename and start playback of the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "@hide" )
DefineEngineFunction(sfxCreateDevice , bool , (const char *provider, const char *device, bool useHardware, S32 maxBuffers) , "Try <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> create a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> sound device using the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">properties.\n</a>" "If a sound device is currently initialized, it will be uninitialized first. However, be aware that in this case, " "<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> this function fails, it will not restore the previously active device but rather leave the sound system in an " "uninitialized <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "Sounds that are already playing <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> device is created will be temporarily transitioned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> virtualized " "playback and then resume normal playback once the device has been <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">created.\n\n</a>" "In the core scripts, sound is automatically set up during startup in the sfxStartup() <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">function.\n\n</a>" " @param provider The name of the device provider as returned by sfxGetAvailableDevices().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param device The name of the device as returned by sfxGetAvailableDevices().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @param useHardware Whether <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> enabled hardware mixing on the device or not. Only relevant <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> supported by the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device.\n</a>" " @param maxBuffers The maximum number of concurrent voices <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this device <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use or -1 <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the device <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> pick its own reasonable default." " @return True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the initialization was successful, false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" " @note This function must be called before any of the sound playback functions can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetAvailableDevices\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDeviceInfo\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDeleteDevice\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDeleteDevice , void , () , "Delete the currently active sound device and release all its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">resources.\n</a>" "SFXSources that are still playing will be transitioned <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> virtualized playback mode. " "When creating a <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> device, they will automatically transition back <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> normal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">playback.\n\n</a>" "In the core scripts, this is done automatically <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> you during shutdown in the sfxShutdown() <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">function.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDeleteWhenStopped , void , (SFXSource *source) , "Mark the given @a source <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> deletion as soon as it moves into stopped <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "This function will retroactively turn the given @a source into a play-once source (see @ref SFXSource_playonce).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param source A sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDumpSources , void , (bool includeGroups) , (false) , "Dump information about all current <a href="/coding/class/classsfxsource/">SFXSource</a> instances <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">console.\n</a>" "The dump includes information about the playback status <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> each source, volume levels, virtualization , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">etc.\n</a>" " @param includeGroups If true, direct instances of SFXSources(which represent logical sound groups) will be included. " "Otherwise only instances of subclasses of SFXSources are included in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">dump.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDumpSourcesToString\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxDumpSourcesToString , const char * , (bool includeGroups) , (false) , "Dump information about all current <a href="/coding/class/classsfxsource/">SFXSource</a> instances <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">string.\n</a>" "The dump includes information about the playback status <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> each source, volume levels, virtualization , <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">etc.\n</a>" " @param includeGroups If true, direct instances of SFXSources(which represent logical sound groups) will be included. " "Otherwise only instances of subclasses of SFXSources are included in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">dump.\n</a>" " @return A string containing a dump of information about all currently instantiated <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSources.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxDumpSources\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetAvailableDevices , const char * , () , "Get a list of all available sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">devices.\n</a>" "The return value will be a newline-separated list of entries where each line describes one available sound " "device. Each such line will have the following format:" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">verbatim\n</a>" "provider TAB device TAB hasHardware TAB <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">numMaxBuffers\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endverbatim\n</a>" "- provider: The name of the device provider (e.g. \"FMOD\").\n" "- device: The name of the device as returned by the device <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">layer.\n</a>" "- hasHardware: Whether the device supports hardware mixing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " "limit is exceeded, i.e. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there are more active sounds playing at any one time, then voice virtualization " "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " "be provided by the device itself;<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not provided by the device, it will be provided by Torque 's sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n\n</a>" " @return A newline-separated list of information about all available sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">devices.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDeviceInfo\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_PROVIDER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_NAME\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_USEHARDWARE\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_MAXBUFFERS\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDeviceInfo , const char * , () , "Return information about the currently active sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">device.\n</a>" "The return value is a tab-delimited string of the following <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">format:\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">verbatim\n</a>" "provider TAB device TAB hasHardware TAB numMaxBuffers TAB <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">caps\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endverbatim\n</a>" "- provider: The name of the device provider (e.g. \"FMOD\").\n" "- device: The name of the device as returned by the device <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">layer.\n</a>" "- hasHardware: Whether the device supports hardware mixing or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">not.\n</a>" "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " "limit is exceeded, i.e. <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> there are more active sounds playing at any one time, then voice virtualization " "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " "be provided by the device itself;<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> not provided by the device, it will be provided by Torque 's sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">system.\n</a>" "- caps:A bitfield of capability <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">flags.\n\n</a>" " @return A tab-separated list of properties of the currently active sound device or the empty string <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> no sound device has been <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">initialized.\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxCreateDevice\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetAvailableDevices\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_PROVIDER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_NAME\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_USEHARDWARE\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_MAXBUFFERS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_INFO_CAPS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_REVERB\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_VOICEMANAGEMENT\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_OCCLUSION\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_DSPEFFECTS\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_MULTILISTENER\n\n</a>" " @see $<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX::DEVICE_CAPS_FMODDESIGNER\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_devices\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDistanceModel , SFXDistanceModel , () , "Get the falloff curve type currently being applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@return The current distance model <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">type.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetDopplerFactor , F32 , () , "Get the current global doppler effect <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">setting.\n\n</a>" "@return The current global doppler effect scale factor (>=0).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxSetDopplerFactor\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_doppler\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxGetRolloffFactor , F32 , () , "Get the current global scale factor applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> volume attenuation of 3D sounds in the logarithmic <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n</a>" "@return The current scale factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> logarithmic 3D sound falloff <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curves.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDistanceModel\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetDistanceModel , void , (SFXDistanceModel model) , "Set the falloff curve type <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> distance-based volume attenuation of 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@param model The distance model <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> use <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sound.\n\n</a>" "@note This setting takes effect globally and is applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> all 3D <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sounds.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetDopplerFactor , void , (F32 value) , "Set the global doppler effect scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@param value The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> doppler shift scale <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">factor.\n</a>" "@pre @a value must be >= 0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDopplerFactor\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_doppler\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxSetRolloffFactor , void , (F32 value) , "Set the global scale factor <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> volume attenuation of 3D sounds in the logarithmic <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">model.\n</a>" "@param value The <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> scale factor <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> logarithmic 3D sound falloff <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curves.\n\n</a>" "@pre @a value must be, 0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @note This function has no effect <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> the currently distance model is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel::Linear.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sfxGetDistanceModel\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXDistanceModel\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxStop , void , (SFXSource *source) , "Stop playback of the given @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "This is equivalent <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> calling <a href="/coding/class/classsfxsource/#classsfxsource_1a978d0e62496766631ed34894d82b4c11">SFXSource::stop</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@param source The source <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> put into stopped <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">state.\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
DefineEngineFunction(sfxStopAndDelete , void , (SFXSource *source) , "Stop playback of the given @a source (<a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a2594a51175f310ed96ad6cd7d6514878">if</a> it is not already stopped) and delete the @a <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" "The advantage of this function over directly calling delete() is that it will correctly " "handle volume fades that may be configured on the source. Whereas calling delete() would immediately " "stop playback and delete the source, this functionality will wait <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the fade-out <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> play and only then " "stop the source and delete <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">it.\n\n</a>" " @param source A sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n\n</a>" " @ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_fades\n\n</a>" " @ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXChannel , "Channels are individual properties of sound sources that may be animated over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">time.\n\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXParameter\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_interactive\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXDistanceModel , "Type of volume distance attenuation <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">curve.\n</a>" "The distance model determines the falloff curve applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the volume of 3D sounds over <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">distance.\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFXSource_volume\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">SFX_3d\n\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
ImplementEnumType(SFXStatus , "Playback status of sound <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">source.\n</a>" "@ingroup <a href="/coding/file/sfxsystem_8h/#sfxsystem_8h_1a52e87f85ae30be82ffefd31b5c03e03d">SFX</a>" )
MODULE_SHUTDOWN_BEFORE(Sim )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "platform/platform.h" 25#include "sfx/sfxSystem.h" 26 27#include "sfx/sfxProvider.h" 28#include "sfx/sfxDevice.h" 29#include "sfx/sfxInternal.h" 30#include "sfx/sfxSource.h" 31#include "sfx/sfxProfile.h" 32#include "sfx/sfxDescription.h" 33#include "sfx/sfxTrack.h" 34#include "sfx/sfxPlayList.h" 35#include "sfx/sfxSound.h" 36#include "sfx/sfxController.h" 37#include "sfx/sfxSoundscape.h" 38 39#include "console/console.h" 40#include "console/engineAPI.h" 41#include "T3D/gameBase/processList.h" 42#include "platform/profiler.h" 43#include "platform/platformTimer.h" 44#include "core/util/autoPtr.h" 45#include "core/module.h" 46 47#include "sfx/media/sfxWavStream.h" 48#ifdef TORQUE_OGGVORBIS 49 #include "sfx/media/sfxVorbisStream.h" 50#endif 51 52 53MODULE_BEGIN( SFX ) 54 55 MODULE_INIT_BEFORE( Sim ) 56 MODULE_SHUTDOWN_BEFORE( Sim ) // Make sure all SimObjects disappear in time. 57 58 MODULE_INIT 59 { 60 SFXSystem::init(); 61 } 62 63 MODULE_SHUTDOWN 64 { 65 SFXSystem::destroy(); 66 } 67 68MODULE_END; 69 70 71SFXSystem* SFXSystem::smSingleton = NULL; 72 73 74// Excludes Null and Blocked as these are not passed out to the control layer. 75ImplementEnumType( SFXStatus, 76 "Playback status of sound source.\n" 77 "@ingroup SFX" ) 78 { SFXStatusPlaying, "Playing", 79 "The source is currently playing." }, 80 { SFXStatusStopped, "Stopped", 81 "Playback of the source is stopped. When transitioning to Playing state, playback will start at the beginning " 82 "of the source." }, 83 { SFXStatusPaused, "Paused", 84 "Playback of the source is paused. Resuming playback will play from the current playback position." }, 85EndImplementEnumType; 86 87ImplementEnumType( SFXDistanceModel, 88 "Type of volume distance attenuation curve.\n" 89 "The distance model determines the falloff curve applied to the volume of 3D sounds over distance.\n\n" 90 "@ref SFXSource_volume\n\n" 91 "@ref SFX_3d\n\n" 92 "@ingroup SFX" ) 93 { SFXDistanceModelLinear, "Linear", 94 "Volume attenuates linearly from the references distance onwards to max distance where it reaches zero." }, 95 { SFXDistanceModelLogarithmic, "Logarithmic", 96 "Volume attenuates logarithmically starting from the reference distance and halving every reference distance step from there on. " 97 "Attenuation stops at max distance but volume won't reach zero." }, 98EndImplementEnumType; 99 100ImplementEnumType( SFXChannel, 101 "Channels are individual properties of sound sources that may be animated over time.\n\n" 102 "@see SFXParameter\n\n" 103 "@ref SFX_interactive\n\n" 104 "@ingroup SFX" ) 105 { SFXChannelVolume, "Volume", 106 "Channel controls volume level of attached sound sources.\n" 107 "@see SFXDescription::volume" }, 108 { SFXChannelPitch, "Pitch", 109 "Channel controls pitch of attached sound sources.\n" 110 "@see SFXDescription::pitch" }, 111 { SFXChannelPriority, "Priority", 112 "Channel controls virtualizaton priority level of attached sound sources.\n" 113 "@see SFXDescription::priority" }, 114 { SFXChannelPositionX, "PositionX", 115 "Channel controls X coordinate of 3D sound position of attached sources." }, 116 { SFXChannelPositionY, "PositionY", 117 "Channel controls Y coordinate of 3D sound position of attached sources." }, 118 { SFXChannelPositionZ, "PositionZ", 119 "Channel controls Z coordinate of 3D sound position of attached sources." }, 120 { SFXChannelRotationX, "RotationX", 121 "Channel controls X rotation (in degrees) of 3D sound orientation of attached sources." }, 122 { SFXChannelRotationY, "RotationY", 123 "Channel controls Y rotation (in degrees) of 3D sound orientation of attached sources." }, 124 { SFXChannelRotationZ, "RotationZ", 125 "Channel controls Z rotation (in degrees) of 3D sound orientation of attached sources." }, 126 { SFXChannelVelocityX, "VelocityX", 127 "Channel controls X coordinate of 3D sound velocity vector of attached sources." }, 128 { SFXChannelVelocityY, "VelocityY", 129 "Channel controls Y coordinate of 3D sound velocity vector of attached sources." }, 130 { SFXChannelVelocityZ, "VelocityZ", 131 "Channel controls Z coordinate of 3D sound velocity vector of attached sources." }, 132 { SFXChannelMinDistance, "ReferenceDistance", 133 "Channel controls reference distance of 3D sound of attached sources.\n" 134 "@see SFXDescription::referenceDistance" }, 135 { SFXChannelMaxDistance, "MaxDistance", 136 "Channel controls max volume attenuation distance of 3D sound of attached sources.\n" 137 "@see SFXDescription::maxDistance" }, 138 { SFXChannelConeInsideAngle, "ConeInsideAngle", 139 "Channel controls angle (in degrees) of 3D sound inner volume cone of attached sources.\n" 140 "@see SFXDescription::coneInsideAngle" }, 141 { SFXChannelConeOutsideAngle, "ConeOutsideAngle", 142 "Channel controls angle (in degrees) of 3D sound outer volume cone of attached sources.\n" 143 "@see SFXDescription::coneOutsideAngle" }, 144 { SFXChannelConeOutsideVolume, "ConeOutsideVolume", 145 "Channel controls volume outside of 3D sound outer cone of attached sources.\n" 146 "@see SFXDescription::coneOutsideVolume" }, 147 { SFXChannelCursor, "Cursor", 148 "Channel controls playback cursor of attached sound sources.\n\n" 149 "@note Be aware that different types of sound sources interpret play cursor positions differently " 150 "or do not actually have play cursors (these sources will ignore the channel)." }, 151 { SFXChannelStatus, "Status", 152 "Channel controls playback status of attached sound sources.\n\n" 153 "The channel's value is rounded down to the nearest integer and interpreted in the following way:\n" 154 "- 1: Play\n" 155 "- 2: Stop\n" 156 "- 3: Pause\n\n" }, 157 { SFXChannelUser0, "User0", 158 "Channel available for custom use. By default ignored by sources.\n\n" 159 "@note For FMOD Designer event sources (SFXFMODEventSource), this channel is used for event parameters " 160 "defined in FMOD Designer and should not be used otherwise.\n\n" 161 "@see SFXSource::onParameterValueChange" }, 162 { SFXChannelUser1, "User1", 163 "Channel available for custom use. By default ignored by sources.\n\n" 164 "@see SFXSource::onParameterValueChange" }, 165 { SFXChannelUser2, "User2", 166 "Channel available for custom use. By default ignored by sources.\n\n" 167 "@see SFXSource::onParameterValueChange" }, 168 { SFXChannelUser3, "User3", 169 "Channel available for custom use. By default ignored by sources.\n\n" 170 "@see SFXSource::onParameterValueChange" }, 171EndImplementEnumType; 172 173 174// Constants. 175static const U32 sDeviceCapsReverb = SFXDevice::CAPS_Reverb; 176static const U32 sDeviceCapsVoiceManagement = SFXDevice::CAPS_VoiceManagement; 177static const U32 sDeviceCapsOcclusion = SFXDevice::CAPS_Occlusion; 178static const U32 sDeviceCapsDSPEffects = SFXDevice::CAPS_DSPEffects; 179static const U32 sDeviceCapsMultiListener = SFXDevice::CAPS_MultiListener; 180static const U32 sDeviceCapsFMODDesigner = SFXDevice::CAPS_FMODDesigner; 181 182static const U32 sDeviceInfoProvider = 0; 183static const U32 sDeviceInfoName = 1; 184static const U32 sDeviceInfoUseHardware = 2; 185static const U32 sDeviceInfoMaxBuffers = 3; 186 187 188//----------------------------------------------------------------------------- 189 190SFXSystem::SFXSystem() 191 : mDevice( NULL ), 192 mLastSourceUpdateTime( 0 ), 193 mLastAmbientUpdateTime( 0 ), 194 mLastParameterUpdateTime( 0 ), 195 mStatNumSources( 0 ), 196 mStatNumSounds( 0 ), 197 mStatNumPlaying( 0 ), 198 mStatNumCulled( 0 ), 199 mStatNumVoices( 0 ), 200 mStatSourceUpdateTime( 0 ), 201 mStatParameterUpdateTime( 0 ), 202 mStatAmbientUpdateTime( 0 ), 203 mDistanceModel( SFXDistanceModelLinear ), 204 mDopplerFactor( 0.5 ), 205 mRolloffFactor( 1.0 ), 206 mSoundscapeMgr( NULL ) 207{ 208 VECTOR_SET_ASSOCIATION( mSounds ); 209 VECTOR_SET_ASSOCIATION( mPlayOnceSources ); 210 VECTOR_SET_ASSOCIATION( mPlugins ); 211 VECTOR_SET_ASSOCIATION( mListeners ); 212 213 // Always at least one listener. 214 215 mListeners.increment(); 216 217 // Register stat variables. 218 219 Con::addVariable( "SFX::numSources", TypeS32, &mStatNumSources, 220 "Number of SFXSource type objects that are currently instantiated.\n" 221 "@ingroup SFX" ); 222 Con::addVariable( "SFX::numSounds", TypeS32, &mStatNumSounds, 223 "Number of SFXSound type objects (i.e. actual single-file sounds) that are currently instantiated.\n" 224 "@ingroup SFX" ); 225 Con::addVariable( "SFX::numPlaying", TypeS32, &mStatNumPlaying, 226 "Number of SFXSources that are currently in playing state.\n" 227 "@ingroup SFX" ); 228 Con::addVariable( "SFX::numCulled", TypeS32, &mStatNumCulled, 229 "Number of SFXSounds that are currently in virtualized playback mode.\n" 230 "@ref SFXSound_virtualization\n\n" 231 "@ingroup SFX" ); 232 Con::addVariable( "SFX::numVoices", TypeS32, &mStatNumVoices, 233 "Number of voices that are currently allocated on the sound device.\n" 234 "@ingroup SFX" ); 235 Con::addVariable( "SFX::sourceUpdateTime", TypeS32, &mStatSourceUpdateTime, 236 "Milliseconds spent on the last SFXSource update loop.\n" 237 "@ref SFX_updating\n\n" 238 "@ingroup SFX" ); 239 Con::addVariable( "SFX::parameterUpdateTime", TypeS32, &mStatParameterUpdateTime, 240 "Milliseconds spent on the last SFXParameter update loop.\n" 241 "@ref SFX_updating\n\n" 242 "@ref SFX_interactive\n\n" 243 "@ingroup SFX" ); 244 Con::addVariable( "SFX::ambientUpdateTime", TypeS32, &mStatAmbientUpdateTime, 245 "Milliseconds spent on the last ambient audio update.\n" 246 "@ref SFX_updating\n\n" 247 "@ref SFX_ambient\n\n" 248 "@ingroup SFX" ); 249 250 // Register constants. 251 252 Con::addConstant( "$SFX::DEVICE_CAPS_REVERB", TypeS32, &sDeviceCapsReverb, 253 "Sound device capability flag indicating that the sound device supports reverb.\n\n" 254 "@note Currently only FMOD implements this.\n\n" 255 "@see sfxGetDeviceInfo\n\n" 256 "@ref SFX_reverb\n\n" 257 "@ingroup SFX" ); 258 Con::addConstant( "$SFX::DEVICE_CAPS_VOICEMANAGEMENT", TypeS32, &sDeviceCapsVoiceManagement, 259 "Sound device capability flag indicating that the sound device implements its own voice virtualization.\n\n" 260 "For these devices, the sound system will deactivate its own voice management and leave voice " 261 "virtualization entirely to the device.\n\n" 262 "@note Currently only FMOD implements this.\n\n" 263 "@see sfxGetDeviceInfo\n\n" 264 "@ref SFXSound_virtualization\n\n" 265 "@ingroup SFX" ); 266 Con::addConstant( "$SFX::DEVICE_CAPS_OCCLUSION", TypeS32, &sDeviceCapsOcclusion, 267 "Sound device capability flag indicating that the sound device implements sound occlusion.\n\n" 268 "@note This is not yet used by the sound system.\n\n" 269 "@see sfxGetDeviceInfo\n\n" 270 "@ingroup SFX" ); 271 Con::addConstant( "$SFX::DEVICE_CAPS_DSPEFFECTS", TypeS32, &sDeviceCapsDSPEffects, 272 "Sound device capability flag indicating that the sound device supports adding DSP effect chains to sounds.\n\n" 273 "@see sfxGetDeviceInfo\n\n" 274 "@note This is not yet used by the sound system.\n\n" 275 "@see sfxGetDeviceInfo\n\n" 276 "@ingroup SFX" ); 277 Con::addConstant( "$SFX::DEVICE_CAPS_MULTILISTENER", TypeS32, &sDeviceCapsMultiListener, 278 "Sound device capability flag indicating that the sound device supports multiple concurrent listeners.\n\n" 279 "@note Currently only FMOD implements this.\n\n" 280 "@see sfxGetDeviceInfo\n\n" 281 "@ingroup SFX" ); 282 Con::addConstant( "$SFX::DEVICE_CAPS_FMODDESIGNER", TypeS32, &sDeviceCapsFMODDesigner, 283 "Sound device capability flag indicating that the sound device supports FMOD Designer audio projects.\n\n" 284 "@note This is exclusive to FMOD. If the FMOD Event DLLs are in place and could be successfully loaded, this " 285 "flag will be set after initializating an FMOD audio device.\n\n" 286 "@see sfxGetDeviceInfo\n\n" 287 "@ref FMOD_designer\n\n" 288 "@ingroup SFX" ); 289 290 Con::addConstant( "$SFX::DEVICE_INFO_PROVIDER", TypeS32, &sDeviceInfoProvider, 291 "Index of sound provider field in device info string.\n\n" 292 "@see sfxGetDeviceInfo\n\n" 293 "@see sfxGetAvailableDevices\n\n" 294 "@ingroup SFX" ); 295 Con::addConstant( "$SFX::DEVICE_INFO_NAME", TypeS32, &sDeviceInfoName, 296 "Index of device name field in device info string.\n\n" 297 "@see sfxGetDeviceInfo\n\n" 298 "@see sfxGetAvailableDevices\n\n" 299 "@ingroup SFX" ); 300 Con::addConstant( "$SFX::DEVICE_INFO_USEHARDWARE", TypeS32, &sDeviceInfoUseHardware, 301 "Index of use hardware flag in device info string.\n\n" 302 "@see sfxGetDeviceInfo\n\n" 303 "@see sfxGetAvailableDevices\n\n" 304 "@ingroup SFX" ); 305 Con::addConstant( "$SFX::DEVICE_INFO_MAXBUFFERS", TypeS32, &sDeviceInfoMaxBuffers, 306 "Index of buffer limit number in device info string.\n\n" 307 "@see sfxGetDeviceInfo\n\n" 308 "@see sfxGetAvailableDevices\n\n" 309 "@ingroup SFX" ); 310 Con::addConstant( "$SFX::DEVICE_INFO_CAPS", TypeS32, &sDeviceInfoMaxBuffers, 311 "Index of device capability flags in device info string.\n\n" 312 "@see sfxGetDeviceInfo\n\n" 313 "@see sfxGetAvailableDevices\n\n" 314 "@ingroup SFX" ); 315 316 // Create subsystems. 317 318 mSoundscapeMgr = new SFXSoundscapeManager(); 319} 320 321//----------------------------------------------------------------------------- 322 323SFXSystem::~SFXSystem() 324{ 325 // Unregister stat variables. 326 327 Con::removeVariable( "SFX::numSources" ); 328 Con::removeVariable( "SFX::numSounds" ); 329 Con::removeVariable( "SFX::numPlaying" ); 330 Con::removeVariable( "SFX::numCulled" ); 331 Con::removeVariable( "SFX::numVoices" ); 332 Con::removeVariable( "SFX::sourceUpdateTime" ); 333 Con::removeVariable( "SFX::parameterUpdateTime" ); 334 Con::removeVariable( "SFX::ambientUpdateTime" ); 335 336 // Cleanup any remaining sources. 337 338 if( Sim::getSFXSourceSet() ) 339 Sim::getSFXSourceSet()->deleteAllObjects(); 340 341 mSounds.clear(); 342 mPlayOnceSources.clear(); 343 mListeners.clear(); 344 345 // Delete subsystems. 346 347 if( mSoundscapeMgr ) 348 SAFE_DELETE( mSoundscapeMgr ); 349 350 // Delete device if we still have one. 351 352 deleteDevice(); 353} 354 355//----------------------------------------------------------------------------- 356 357void SFXSystem::init() 358{ 359 AssertWarn( smSingleton == NULL, "SFX has already been initialized!" ); 360 361 SFXProvider::initializeAllProviders(); 362 363 // Register the streams and resources. Note that 364 // the order here does matter! 365 SFXFileStream::registerExtension( ".wav", ( SFXFILESTREAM_CREATE_FN ) SFXWavStream::create ); 366 #ifdef TORQUE_OGGVORBIS 367 SFXFileStream::registerExtension( ".ogg", ( SFXFILESTREAM_CREATE_FN ) SFXVorbisStream::create ); 368 #endif 369 370 // Create the stream thread pool. 371 372 SFXInternal::SFXThreadPool::createSingleton(); 373 374 // Note: If you have provider specific file types you should 375 // register them in the provider initialization. 376 377 // Create the system. 378 smSingleton = new SFXSystem(); 379} 380 381//----------------------------------------------------------------------------- 382 383void SFXSystem::destroy() 384{ 385 AssertWarn( smSingleton != NULL, "SFX has not been initialized!" ); 386 387 SFXFileStream::unregisterExtension( ".wav" ); 388 #ifdef TORQUE_OGGVORBIS 389 SFXFileStream::unregisterExtension( ".ogg" ); 390 #endif 391 392 delete smSingleton; 393 smSingleton = NULL; 394 395 // Destroy the stream thread pool 396 397 SFXInternal::SFXThreadPool::deleteSingleton(); 398} 399 400//----------------------------------------------------------------------------- 401 402void SFXSystem::addPlugin( SFXSystemPlugin* plugin ) 403{ 404 for( U32 i = 0; i < mPlugins.size(); ++ i ) 405 AssertFatal( mPlugins[ i ] != plugin, "SFXSystem::addPlugin - plugin already added to the system!" ); 406 407 mPlugins.push_back( plugin ); 408} 409 410//----------------------------------------------------------------------------- 411 412void SFXSystem::removePlugin( SFXSystemPlugin* plugin ) 413{ 414 for( U32 i = 0; i < mPlugins.size(); ++ i ) 415 if( mPlugins[ i ] == plugin ) 416 { 417 mPlugins.erase_fast( i ); 418 break; 419 } 420} 421 422//----------------------------------------------------------------------------- 423 424bool SFXSystem::createDevice( const String& providerName, const String& deviceName, bool useHardware, S32 maxBuffers, bool changeDevice ) 425{ 426 // Make sure we don't have a device already. 427 428 if( mDevice && !changeDevice ) 429 return false; 430 431 // Lookup the provider. 432 433 SFXProvider* provider = SFXProvider::findProvider( providerName ); 434 if( !provider ) 435 return false; 436 437 // If we have already created this device and are using it then no need to do anything. 438 439 if( mDevice 440 && providerName.equal( mDevice->getProvider()->getName(), String::NoCase ) 441 && deviceName.equal( mDevice->getName(), String::NoCase ) 442 && useHardware == mDevice->getUseHardware() ) 443 return true; 444 445 // If we have an existing device remove it. 446 447 if( mDevice ) 448 deleteDevice(); 449 450 // Create the new device.. 451 452 mDevice = provider->createDevice( deviceName, useHardware, maxBuffers ); 453 if( !mDevice ) 454 { 455 Con::errorf( "SFXSystem::createDevice - failed creating %s device '%s'", providerName.c_str(), deviceName.c_str() ); 456 return false; 457 } 458 459 // Print capabilities. 460 461 Con::printf( "SFXSystem::createDevice - created %s device '%s'", providerName.c_str(), deviceName.c_str() ); 462 if( mDevice->getCaps() & SFXDevice::CAPS_Reverb ) 463 Con::printf( " CAPS_Reverb" ); 464 if( mDevice->getCaps() & SFXDevice::CAPS_VoiceManagement ) 465 Con::printf( " CAPS_VoiceManagement" ); 466 if( mDevice->getCaps() & SFXDevice::CAPS_Occlusion ) 467 Con::printf( "\tCAPS_Occlusion" ); 468 if( mDevice->getCaps() & SFXDevice::CAPS_MultiListener ) 469 Con::printf( "\tCAPS_MultiListener" ); 470 471 // Set defaults. 472 473 mDevice->setNumListeners( getNumListeners() ); 474 mDevice->setDistanceModel( mDistanceModel ); 475 mDevice->setDopplerFactor( mDopplerFactor ); 476 mDevice->setRolloffFactor( mRolloffFactor ); 477 mDevice->setReverb( mReverb ); 478 479 // Signal system. 480 481 getEventSignal().trigger( SFXSystemEvent_CreateDevice ); 482 483 return true; 484} 485 486//----------------------------------------------------------------------------- 487 488String SFXSystem::getDeviceInfoString() 489{ 490 // Make sure we have a valid device. 491 if( !mDevice ) 492 return String(); 493 494 return String::ToString( "%s\t%s\t%s\t%d\t%d", 495 mDevice->getProvider()->getName().c_str(), 496 mDevice->getName().c_str(), 497 mDevice->getUseHardware() ? "1" : "0", 498 mDevice->getMaxBuffers(), 499 mDevice->getCaps() ); 500} 501 502//----------------------------------------------------------------------------- 503 504void SFXSystem::deleteDevice() 505{ 506 // Make sure we have a valid device. 507 if ( !mDevice ) 508 return; 509 510 // Put all playing sounds into virtualized playback mode. Where this fails, 511 // stop the source. 512 513 for( U32 i = 0; i < mSounds.size(); ++ i ) 514 { 515 SFXSound* sound = mSounds[ i ]; 516 if( sound->hasVoice() && !sound->_releaseVoice() ) 517 sound->stop(); 518 } 519 520 // Signal everyone who cares that the 521 // device is being deleted. 522 getEventSignal().trigger( SFXSystemEvent_DestroyDevice ); 523 524 // Free the device which should delete all 525 // the active voices and buffers. 526 delete mDevice; 527 mDevice = NULL; 528} 529 530//----------------------------------------------------------------------------- 531 532SFXSource* SFXSystem::createSource( SFXTrack* track, 533 const MatrixF* transform, 534 const VectorF* velocity ) 535{ 536 if( !track ) 537 return NULL; 538 539 SFXSource* source = NULL; 540 541 // Try creating through a plugin first so that they 542 // always get the first shot and may override our 543 // logic here. 544 545 for( U32 i = 0; !source && i < mPlugins.size(); ++ i ) 546 source = mPlugins[ i ]->createSource( track ); 547 548 // If that failed, try our own logic using the track 549 // types that we know about. 550 551 if( !source ) 552 { 553 if( !mDevice ) 554 { 555 Con::errorf( "SFXSystem::createSource() - no device initialized!" ); 556 return NULL; 557 } 558 559 if( dynamic_cast< SFXPlayList* >( track ) ) 560 { 561 // Create a playback controller for the track. 562 563 SFXPlayList* playList = static_cast< SFXPlayList* >( track ); 564 source = SFXController::_create( playList ); 565 } 566 else if( dynamic_cast< SFXProfile* >( track ) ) 567 { 568 // Create a sound. 569 570 SFXProfile* profile = static_cast< SFXProfile* >( track ); 571 source = SFXSound::_create( mDevice, profile ); 572 if( !source ) 573 { 574 Con::errorf( 575 "SFXSystem::createSource() - Failed to create sound!\n" 576 " Profile: %s\n" 577 " Filename: %s", 578 profile->getName(), 579 profile->getSoundFileName().c_str() ); 580 } 581 } 582 else 583 { 584 Con::errorf( "SFXSystem::createSource - cannot create source for %i (%s) of type '%s'", 585 track->getId(), track->getName(), track->getClassName() ); 586 Con::errorf( "SFXSystem::createSource - maybe you are using the wrong SFX provider for this type of track" ); 587 return NULL; 588 } 589 } 590 591 if( source ) 592 { 593 if( transform ) 594 source->setTransform( *transform ); 595 if( velocity ) 596 source->setVelocity( *velocity ); 597 } 598 599 return source; 600} 601 602//----------------------------------------------------------------------------- 603 604SFXSound* SFXSystem::createSourceFromStream( const ThreadSafeRef< SFXStream>& stream, 605 SFXDescription* description ) 606{ 607 AssertFatal( mDevice, "SFXSystem::createSourceFromStream() - no device initialized!" ); 608 609 // We sometimes get null values from script... fail in that case. 610 611 if( !stream || !description ) 612 return NULL; 613 614 // Create the sound. 615 616 SFXSound* sound = SFXSound::_create( mDevice, stream, description ); 617 if( !sound ) 618 return NULL; 619 620 return sound; 621} 622 623//----------------------------------------------------------------------------- 624 625void SFXSystem::stopAndDeleteSource( SFXSource* source ) 626{ 627 if( source->getFadeOutTime() > 0.f ) 628 { 629 // Fade-out. Stop and put on play-once list to 630 // ensure deletion when the source actually stops. 631 632 source->stop(); 633 deleteWhenStopped( source ); 634 } 635 else 636 { 637 // No fade-out. Just stop and delete the source. 638 639 source->stop(); 640 SFX_DELETE( source ); 641 } 642} 643 644//----------------------------------------------------------------------------- 645 646void SFXSystem::deleteWhenStopped( SFXSource* source ) 647{ 648 // If the source isn't already on the play-once source list, 649 // put it there now. 650 651 Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); 652 if( iter == mPlayOnceSources.end() ) 653 mPlayOnceSources.push_back( source ); 654} 655 656//----------------------------------------------------------------------------- 657 658void SFXSystem::_onAddSource( SFXSource* source ) 659{ 660 if( dynamic_cast< SFXSound* >( source ) ) 661 { 662 SFXSound* sound = static_cast< SFXSound* >( source ); 663 mSounds.push_back( sound ); 664 665 mStatNumSounds = mSounds.size(); 666 } 667 668 // Update the stats. 669 mStatNumSources ++; 670} 671 672//----------------------------------------------------------------------------- 673 674void SFXSystem::_onRemoveSource( SFXSource* source ) 675{ 676 // Check if it was a play once source. 677 678 Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); 679 if ( iter != mPlayOnceSources.end() ) 680 mPlayOnceSources.erase_fast( iter ); 681 682 // Update the stats. 683 684 mStatNumSources --; 685 686 if( dynamic_cast< SFXSound* >( source ) ) 687 { 688 SFXSoundVector::iterator iter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); 689 if( iter != mSounds.end() ) 690 mSounds.erase_fast( iter ); 691 692 mStatNumSounds = mSounds.size(); 693 } 694} 695 696//----------------------------------------------------------------------------- 697 698SFXBuffer* SFXSystem::_createBuffer( const ThreadSafeRef< SFXStream>& stream, SFXDescription* description ) 699{ 700 // The buffers are created by the active 701 // device... without one we cannot do anything. 702 if ( !mDevice ) 703 { 704 Con::errorf( "SFXSystem::_createBuffer - No sound device initialized!!" ); 705 return NULL; 706 } 707 708 // Some sanity checking for streaming. If the stream isn't at least three packets 709 // in size given the current settings in "description", then turn off streaming. 710 // The device code *will* mess up if the stream input fails to match certain metrics. 711 // Just disabling streaming when it doesn't make sense is easier than complicating the 712 // device logic to account for bad metrics. 713 714 bool streamFlag = description->mIsStreaming; 715 if( description->mIsStreaming 716 && stream->getDuration() < description->mStreamPacketSize * 1000 * SFXInternal::SFXAsyncQueue::DEFAULT_STREAM_QUEUE_LENGTH ) 717 description->mIsStreaming = false; 718 719 SFXBuffer* buffer = mDevice->createBuffer( stream, description ); 720 721 description->mIsStreaming = streamFlag; // restore in case we stomped it 722 return buffer; 723} 724 725//----------------------------------------------------------------------------- 726 727SFXBuffer* SFXSystem::_createBuffer( const String& filename, SFXDescription* description ) 728{ 729 if( !mDevice ) 730 { 731 Con::errorf( "SFXSystem::_createBuffer - No sound device initialized!!" ); 732 return NULL; 733 } 734 735 return mDevice->createBuffer( filename, description ); 736} 737 738//----------------------------------------------------------------------------- 739 740SFXSource* SFXSystem::playOnce( SFXTrack* track, 741 const MatrixF *transform, 742 const VectorF *velocity, 743 F32 fadeInTime ) 744{ 745 // We sometimes get null profiles... nothing to play without a profile! 746 if( !track ) 747 return NULL; 748 749 SFXSource *source = createSource( track, transform, velocity ); 750 if( source ) 751 { 752 mPlayOnceSources.push_back( source ); 753 source->play( fadeInTime ); 754 } 755 756 return source; 757} 758 759//----------------------------------------------------------------------------- 760 761void SFXSystem::_update() 762{ 763 PROFILE_SCOPE( SFXSystem_Update ); 764 765 getEventSignal().trigger( SFXSystemEvent_Update ); 766 767 for( U32 i = 0; i < mPlugins.size(); ++ i ) 768 mPlugins[ i ]->update(); 769 770 const U32 SOURCE_UPDATE_MS = TickMs * 2; 771 const U32 PARAMETER_UPDATE_MS = TickMs * 3; 772 const U32 AMBIENT_UPDATE_MS = TickMs * 4; 773 774 static AutoPtr< PlatformTimer> sTimer; 775 if( sTimer.isNull() ) 776 sTimer = PlatformTimer::create(); 777 778 // The update of the sources can be a bit expensive 779 // and it does not need to be updated every frame. 780 const U32 currentTime = Platform::getRealMilliseconds(); 781 if( ( currentTime - mLastSourceUpdateTime ) >= SOURCE_UPDATE_MS ) 782 { 783 S32 tick = sTimer->getElapsedMs(); 784 785 _updateSources(); 786 mLastSourceUpdateTime = currentTime; 787 788 mStatSourceUpdateTime = ( sTimer->getElapsedMs() - tick ); 789 } 790 if( ( currentTime - mLastParameterUpdateTime ) >= PARAMETER_UPDATE_MS ) 791 { 792 S32 tick = sTimer->getElapsedMs(); 793 794 SimSet* set = Sim::getSFXParameterGroup(); 795 for( SimSet::iterator iter = set->begin(); iter != set->end(); ++ iter ) 796 { 797 SFXParameter* parameter = dynamic_cast< SFXParameter* >( *iter ); 798 if( parameter ) 799 parameter->update(); 800 } 801 802 mLastParameterUpdateTime = currentTime; 803 mStatParameterUpdateTime = ( sTimer->getElapsedMs() - tick ); 804 } 805 if( mSoundscapeMgr && ( currentTime - mLastAmbientUpdateTime ) >= AMBIENT_UPDATE_MS ) 806 { 807 S32 tick = sTimer->getElapsedMs(); 808 809 mSoundscapeMgr->update(); 810 mLastAmbientUpdateTime = currentTime; 811 812 mStatAmbientUpdateTime = ( sTimer->getElapsedMs() - tick ); 813 } 814 815 // If we have a device then update it. 816 if( mDevice ) 817 mDevice->update(); 818} 819 820//----------------------------------------------------------------------------- 821 822void SFXSystem::_updateSources() 823{ 824 PROFILE_SCOPE( SFXSystem_UpdateSources ); 825 826 SimSet* sources = Sim::getSFXSourceSet(); 827 if( !sources ) 828 return; 829 830 // Check the status of the sources here once. 831 // 832 // NOTE: We do not use iterators in this loop because 833 // SFXControllers can add to the source list during the 834 // loop. 835 // 836 mStatNumPlaying = 0; 837 for( S32 i=0; i < sources->size(); i++ ) 838 { 839 SFXSource *source = dynamic_cast< SFXSource* >( sources->at( i ) ); 840 if ( source ) 841 { 842 source->update(); 843 if( source->getStatus() == SFXStatusPlaying ) 844 ++ mStatNumPlaying; 845 } 846 } 847 848 // First check to see if any play once sources have 849 // finished playback... delete them. 850 851 for( SFXSourceVector::iterator iter = mPlayOnceSources.begin(); iter != mPlayOnceSources.end(); ) 852 { 853 SFXSource* source = *iter; 854 855 if( source->getLastStatus() == SFXStatusStopped && 856 source->getSavedStatus() != SFXStatusPlaying ) 857 { 858 S32 index = iter - mPlayOnceSources.begin(); 859 860 // Erase it from the vector first, so that onRemoveSource 861 // doesn't do it during cleanup and screw up our loop here! 862 mPlayOnceSources.erase_fast( iter ); 863 source->deleteObject(); 864 865 iter = mPlayOnceSources.begin() + index; 866 continue; 867 } 868 869 ++ iter; 870 } 871 872 873 if( mDevice ) 874 { 875 // Reassign buffers to the sounds (if voices are managed by 876 // us instead of by the device). 877 878 if( !( mDevice->getCaps() & SFXDevice::CAPS_VoiceManagement ) ) 879 _assignVoices(); 880 881 // Update the voice count stat. 882 mStatNumVoices = mDevice->getVoiceCount(); 883 } 884} 885 886//----------------------------------------------------------------------------- 887 888void SFXSystem::_sortSounds( const SFXListenerProperties& listener ) 889{ 890 PROFILE_SCOPE( SFXSystem_SortSounds ); 891 892 // Sort the source vector by the attenuated 893 // volume and priorities. This leaves us 894 // with the loudest and highest priority sounds 895 // at the front of the vector. 896 897 dQsort( ( void* ) mSounds.address(), mSounds.size(), sizeof( SFXSound* ), SFXSound::qsortCompare ); 898} 899 900//----------------------------------------------------------------------------- 901 902void SFXSystem::_assignVoices() 903{ 904 AssertFatal( getNumListeners() == 1, "SFXSystem::_assignVoices() - must only have a single listener" ); 905 PROFILE_SCOPE( SFXSystem_AssignVoices ); 906 907 mStatNumVoices = 0; 908 mStatNumCulled = 0; 909 910 if( !mDevice ) 911 return; 912 913 // Sort the sources in the SFX source set by priority. This also 914 // updates each soures effective volume first. 915 916 _sortSounds( getListener() ); 917 918 // We now make sure that the sources closest to the 919 // listener, the ones at the top of the source list, 920 // have a device buffer to play thru. 921 922 mStatNumCulled = 0; 923 for( SFXSoundVector::iterator iter = mSounds.begin(); iter != mSounds.end(); ++ iter ) 924 { 925 SFXSound* sound = *iter; 926 927 // Non playing sources (paused or stopped) are at the 928 // end of the vector, so when i encounter one i know 929 // that nothing else in the vector needs buffer assignment. 930 931 if( !sound->isPlaying() ) 932 break; 933 934 // If the source is outside it's max range we can 935 // skip it as well, so that we don't waste cycles 936 // setting up a buffer for something we won't hear. 937 938 if( sound->getAttenuatedVolume() <= 0.0f ) 939 { 940 ++ mStatNumCulled; 941 continue; 942 } 943 944 // If the source has a voice then we can skip it. 945 946 if( sound->hasVoice() ) 947 continue; 948 949 // Ok let the device try to assign a new voice for 950 // this source... this may fail if we're out of voices. 951 952 if( sound->_allocVoice( mDevice ) ) 953 continue; 954 955 // The device couldn't assign a new voice, so we go through 956 // local priority sounds and try to steal a voice. 957 958 for( SFXSoundVector::iterator hijack = mSounds.end() - 1; hijack != iter; -- hijack ) 959 { 960 SFXSound* other = *hijack; 961 962 if( other->hasVoice() ) 963 { 964 // If the sound is a suitable candidate, try to steal 965 // its voice. While the sound definitely is lower down the chain 966 // in the total priority ordering, we don't want to steal voices 967 // from sounds that are clearly audible as that results in noticable 968 // sound pops. 969 970 if( ( other->getAttenuatedVolume() < 0.1 // Very quiet or maybe not even audible. 971 || !other->isPlaying() // Not playing so not audible anyways. 972 || other->getPosition() == 0 ) // Not yet started playing. 973 && other->_releaseVoice() ) 974 break; 975 } 976 } 977 978 // Ok try to assign a voice once again! 979 980 if( sound->_allocVoice( mDevice ) ) 981 continue; 982 983 // If the source still doesn't have a buffer... well 984 // tough cookies. It just cannot be heard yet, maybe 985 // it can in the next update. 986 987 mStatNumCulled ++; 988 } 989 990 // Update the voice count stat. 991 mStatNumVoices = mDevice->getVoiceCount(); 992} 993 994//----------------------------------------------------------------------------- 995 996void SFXSystem::_assignVoice( SFXSound* sound ) 997{ 998 if( !mDevice ) 999 return; 1000 1001 // Make sure all properties are up-to-date. 1002 1003 sound->_update(); 1004 1005 // If voices are managed by the device, just let the sound 1006 // allocate a voice on it. Otherwise, do a voice allocation pass 1007 // on all our active sounds. 1008 1009 if( mDevice->getCaps() & SFXDevice::CAPS_VoiceManagement ) 1010 sound->_allocVoice( mDevice ); 1011 else 1012 _assignVoices(); 1013 1014 // Update the voice count stat. 1015 mStatNumVoices = mDevice->getVoiceCount(); 1016} 1017 1018//----------------------------------------------------------------------------- 1019 1020void SFXSystem::setDistanceModel( SFXDistanceModel model ) 1021{ 1022 const bool changed = ( model != mDistanceModel ); 1023 1024 mDistanceModel = model; 1025 if( mDevice && changed ) 1026 mDevice->setDistanceModel( model ); 1027} 1028 1029//----------------------------------------------------------------------------- 1030 1031void SFXSystem::setDopplerFactor( F32 factor ) 1032{ 1033 const bool changed = ( factor != mDopplerFactor ); 1034 1035 mDopplerFactor = factor; 1036 if( mDevice && changed ) 1037 mDevice->setDopplerFactor( factor ); 1038} 1039 1040//----------------------------------------------------------------------------- 1041 1042void SFXSystem::setRolloffFactor( F32 factor ) 1043{ 1044 const bool changed = ( factor != mRolloffFactor ); 1045 1046 mRolloffFactor = factor; 1047 if( mDevice && changed ) 1048 mDevice->setRolloffFactor( factor ); 1049} 1050 1051//----------------------------------------------------------------------------- 1052 1053void SFXSystem::setReverb( const SFXReverbProperties& reverb ) 1054{ 1055 mReverb = reverb; 1056 1057 // Allow the plugins to adjust the reverb. 1058 1059 for( U32 i = 0; i < mPlugins.size(); ++ i ) 1060 mPlugins[ i ]->filterReverb( mReverb ); 1061 1062 // Pass it on to the device. 1063 1064 if( mDevice ) 1065 mDevice->setReverb( mReverb ); 1066} 1067 1068//----------------------------------------------------------------------------- 1069 1070void SFXSystem::setNumListeners( U32 num ) 1071{ 1072 // If we are set to a single listener, just accept this as 1073 // we always support this no matter what. 1074 1075 if( num == 1 ) 1076 { 1077 mListeners.setSize( 1 ); 1078 if( mDevice ) 1079 mDevice->setNumListeners( 1 ); 1080 return; 1081 } 1082 1083 // If setting to multiple listeners, make sure that the device 1084 // both supports multiple listeners and implements its own voice 1085 // management (as our voice virtualization does not work with more 1086 // than a single listener). 1087 1088 if( !mDevice || !( mDevice->getCaps() & SFXDevice::CAPS_MultiListener ) 1089 || !( mDevice->getCaps() & SFXDevice::CAPS_VoiceManagement ) ) 1090 { 1091 Con::errorf( "SFXSystem::setNumListeners() - multiple listeners not supported on current configuration" ); 1092 return; 1093 } 1094 1095 mListeners.setSize( num ); 1096 if( mDevice ) 1097 mDevice->setNumListeners( num ); 1098} 1099 1100//----------------------------------------------------------------------------- 1101 1102void SFXSystem::setListener( U32 index, const MatrixF& transform, const Point3F& velocity ) 1103{ 1104 if( index >= mListeners.size() ) 1105 return; 1106 1107 mListeners[ index ] = SFXListenerProperties( transform, velocity ); 1108 1109 if( mDevice ) 1110 mDevice->setListener( index, mListeners[ index ] ); 1111} 1112 1113//----------------------------------------------------------------------------- 1114 1115void SFXSystem::notifyDescriptionChanged( SFXDescription* description ) 1116{ 1117 SimSet* set = Sim::getSFXSourceSet(); 1118 for( SimSet::iterator iter = set->begin(); iter != set->end(); ++ iter ) 1119 { 1120 SFXSource* source = dynamic_cast< SFXSource* >( *iter ); 1121 if( source && source->getDescription() == description ) 1122 source->notifyDescriptionChanged(); 1123 } 1124} 1125 1126//----------------------------------------------------------------------------- 1127 1128void SFXSystem::notifyTrackChanged( SFXTrack* track ) 1129{ 1130 SimSet* set = Sim::getSFXSourceSet(); 1131 for( SimSet::iterator iter = set->begin(); iter != set->end(); ++ iter ) 1132 { 1133 SFXSource* source = dynamic_cast< SFXSource* >( *iter ); 1134 if( source && source->getTrack() == track ) 1135 source->notifyTrackChanged(); 1136 } 1137} 1138 1139//----------------------------------------------------------------------------- 1140 1141void SFXSystem::dumpSources( StringBuilder* toString, bool excludeGroups ) 1142{ 1143 SimSet* sources = Sim::getSFXSourceSet(); 1144 if( !sources ) 1145 return; 1146 1147 bool isFirst = true; 1148 for( SimSet::iterator iter = sources->begin(); iter != sources->end(); ++ iter ) 1149 { 1150 SFXSource* source = dynamic_cast< SFXSource* >( *iter ); 1151 if( !source ) 1152 continue; 1153 1154 bool isGroup = typeid( *source ) == typeid( SFXSource ); 1155 if( isGroup && excludeGroups ) 1156 continue; 1157 1158 bool isPlayOnce = false; 1159 for( U32 j = 0; j < mPlayOnceSources.size(); ++ j ) 1160 if( mPlayOnceSources[ j ] == source ) 1161 { 1162 isPlayOnce = true; 1163 break; 1164 } 1165 1166 SFXSource* sourceGroup = source->getSourceGroup(); 1167 1168 SFXSound* sound = dynamic_cast< SFXSound* >( source ); 1169 SFXController* controller = dynamic_cast< SFXController* >( source ); 1170 1171 if( toString ) 1172 toString->format( "%s%5i: type=%s, status=%s, blocked=%s, volume=%.2f, priority=%.2f, virtual=%s, looping=%s, 3d=%s, group=%s, playtime=%.2f, playOnce=%s, streaming=%s, hasVoice=%s, track=%s", 1173 ( isFirst ? "" : "\n" ), 1174 source->getId(), 1175 ( isGroup ? "group" : sound ? "sound" : controller ? "list" : "other" ), 1176 source->isPlaying() 1177 ? "playing" 1178 : source->isPaused() 1179 ? "paused" 1180 : source->isStopped() 1181 ? "stopped" 1182 : "unknown", 1183 ( sound && sound->isBlocked() ? "1" : "0" ), 1184 source->getAttenuatedVolume(), 1185 source->getEffectivePriority(), 1186 ( sound && sound->isVirtualized() ? "1" : "0" ), 1187 ( sound && sound->isLooping() ) ? "1" : "0", 1188 source->getDescription()->mIs3D ? "1" : "0", 1189 sourceGroup ? sourceGroup->getName() : "", 1190 source->getElapsedPlayTimeCurrentCycle(), 1191 isPlayOnce ? "1" : "0", 1192 ( sound && sound->isStreaming() ? "1" : "0" ), 1193 ( sound && sound->hasVoice() ? "1" : "0" ), 1194 source->getTrack() ? source->getTrack()->getName() : "" 1195 ); 1196 else 1197 Con::printf( "%5i: type=%s, status=%s, blocked=%s, volume=%.2f, priority=%.2f, virtual=%s, looping=%s, 3d=%s, group=%s, playtime=%.2f, playOnce=%s, streaming=%s, hasVoice=%s, track=%s", 1198 source->getId(), 1199 ( isGroup ? "group" : sound ? "sound" : controller ? "list" : "other" ), 1200 source->isPlaying() 1201 ? "playing" 1202 : source->isPaused() 1203 ? "paused" 1204 : source->isStopped() 1205 ? "stopped" 1206 : "unknown", 1207 ( sound && sound->isBlocked() ? "1" : "0" ), 1208 source->getAttenuatedVolume(), 1209 source->getEffectivePriority(), 1210 ( sound && sound->isVirtualized() ? "1" : "0" ), 1211 ( sound && sound->isLooping() ) ? "1" : "0", 1212 source->getDescription()->mIs3D ? "1" : "0", 1213 sourceGroup ? sourceGroup->getName() : "", 1214 source->getElapsedPlayTimeCurrentCycle(), 1215 isPlayOnce ? "1" : "0", 1216 ( sound && sound->isStreaming() ? "1" : "0" ), 1217 ( sound && sound->hasVoice() ? "1" : "0" ), 1218 source->getTrack() ? source->getTrack()->getName() : "" 1219 ); 1220 1221 isFirst = false; 1222 } 1223} 1224 1225//============================================================================= 1226// Console Functions. 1227//============================================================================= 1228// MARK: ---- Console Functions ---- 1229 1230//----------------------------------------------------------------------------- 1231 1232DefineEngineFunction( sfxGetAvailableDevices, const char*, (),, 1233 "Get a list of all available sound devices.\n" 1234 "The return value will be a newline-separated list of entries where each line describes one available sound " 1235 "device. Each such line will have the following format:" 1236 "@verbatim\n" 1237 "provider TAB device TAB hasHardware TAB numMaxBuffers\n" 1238 "@endverbatim\n" 1239 "- provider: The name of the device provider (e.g. \"FMOD\").\n" 1240 "- device: The name of the device as returned by the device layer.\n" 1241 "- hasHardware: Whether the device supports hardware mixing or not.\n" 1242 "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " 1243 "limit is exceeded, i.e. if there are more active sounds playing at any one time, then voice virtualization " 1244 "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " 1245 "be provided by the device itself; if not provided by the device, it will be provided by Torque's sound system.\n\n" 1246 "@return A newline-separated list of information about all available sound devices.\n" 1247 "@see sfxCreateDevice\n" 1248 "@see sfxGetDeviceInfo\n\n" 1249 "@see $SFX::DEVICE_INFO_PROVIDER\n\n" 1250 "@see $SFX::DEVICE_INFO_NAME\n\n" 1251 "@see $SFX::DEVICE_INFO_USEHARDWARE\n\n" 1252 "@see $SFX::DEVICE_INFO_MAXBUFFERS\n\n" 1253 "@ref SFX_devices\n" 1254 "@ingroup SFX" ) 1255{ 1256 const S32 bufferSize = 2048; 1257 char* deviceList = Con::getReturnBuffer( bufferSize ); 1258 S32 len = bufferSize; 1259 char *ptr = deviceList; 1260 *ptr = 0; 1261 1262 SFXProvider* provider = SFXProvider::getFirstProvider(); 1263 while ( provider ) 1264 { 1265 // List the devices in this provider. 1266 const SFXDeviceInfoVector& deviceInfo = provider->getDeviceInfo(); 1267 for ( S32 d=0; d < deviceInfo.size(); d++ ) 1268 { 1269 const SFXDeviceInfo* info = deviceInfo[d]; 1270 const char *providerName = provider->getName().c_str(); 1271 const char *infoName = info->name.c_str(); 1272 dSprintf(ptr, len, "%s\t%s\t%s\t%i\n", providerName, infoName, info->hasHardware ? "1" : "0", info->maxBuffers); 1273 1274 ptr += dStrlen(ptr); 1275 len = bufferSize - (ptr - deviceList); 1276 1277 if (len <= 0) 1278 return deviceList; 1279 } 1280 1281 provider = provider->getNextProvider(); 1282 } 1283 1284 return deviceList; 1285} 1286 1287//----------------------------------------------------------------------------- 1288 1289DefineEngineFunction( sfxCreateDevice, bool, ( const char* provider, const char* device, bool useHardware, S32 maxBuffers ),, 1290 "Try to create a new sound device using the given properties.\n" 1291 "If a sound device is currently initialized, it will be uninitialized first. However, be aware that in this case, " 1292 "if this function fails, it will not restore the previously active device but rather leave the sound system in an " 1293 "uninitialized state.\n\n" 1294 "Sounds that are already playing while the new device is created will be temporarily transitioned to virtualized " 1295 "playback and then resume normal playback once the device has been created.\n\n" 1296 "In the core scripts, sound is automatically set up during startup in the sfxStartup() function.\n\n" 1297 "@param provider The name of the device provider as returned by sfxGetAvailableDevices().\n" 1298 "@param device The name of the device as returned by sfxGetAvailableDevices().\n" 1299 "@param useHardware Whether to enabled hardware mixing on the device or not. Only relevant if supported by the given device.\n" 1300 "@param maxBuffers The maximum number of concurrent voices for this device to use or -1 for the device to pick its own reasonable default." 1301 "@return True if the initialization was successful, false if not.\n" 1302 "@note This function must be called before any of the sound playback functions can be used.\n" 1303 "@see sfxGetAvailableDevices\n" 1304 "@see sfxGetDeviceInfo\n" 1305 "@see sfxDeleteDevice\n\n" 1306 "@ref SFX_devices\n" 1307 "@ingroup SFX" ) 1308{ 1309 return SFX->createDevice( provider, device, useHardware, maxBuffers, true ); 1310} 1311 1312//----------------------------------------------------------------------------- 1313 1314DefineEngineFunction( sfxDeleteDevice, void, (),, 1315 "Delete the currently active sound device and release all its resources.\n" 1316 "SFXSources that are still playing will be transitioned to virtualized playback mode. " 1317 "When creating a new device, they will automatically transition back to normal playback.\n\n" 1318 "In the core scripts, this is done automatically for you during shutdown in the sfxShutdown() function.\n\n" 1319 "@see sfxCreateDevice\n\n" 1320 "@ref SFX_devices\n" 1321 "@ingroup SFX" ) 1322{ 1323 SFX->deleteDevice(); 1324} 1325 1326//----------------------------------------------------------------------------- 1327 1328DefineEngineFunction( sfxGetDeviceInfo, const char*, (),, 1329 "Return information about the currently active sound device.\n" 1330 "The return value is a tab-delimited string of the following format:\n" 1331 "@verbatim\n" 1332 "provider TAB device TAB hasHardware TAB numMaxBuffers TAB caps\n" 1333 "@endverbatim\n" 1334 "- provider: The name of the device provider (e.g. \"FMOD\").\n" 1335 "- device: The name of the device as returned by the device layer.\n" 1336 "- hasHardware: Whether the device supports hardware mixing or not.\n" 1337 "- numMaxBuffers: The maximum number of concurrent voices supported by the device's mixer. If this limit " 1338 "limit is exceeded, i.e. if there are more active sounds playing at any one time, then voice virtualization " 1339 "will start culling voices and put them into virtualized playback mode. Voice virtualization may or may not " 1340 "be provided by the device itself; if not provided by the device, it will be provided by Torque's sound system.\n" 1341 "- caps: A bitfield of capability flags.\n\n" 1342 "@return A tab-separated list of properties of the currently active sound device or the empty string if no sound device has been initialized.\n" 1343 "@see sfxCreateDevice\n" 1344 "@see sfxGetAvailableDevices\n\n" 1345 "@see $SFX::DEVICE_INFO_PROVIDER\n\n" 1346 "@see $SFX::DEVICE_INFO_NAME\n\n" 1347 "@see $SFX::DEVICE_INFO_USEHARDWARE\n\n" 1348 "@see $SFX::DEVICE_INFO_MAXBUFFERS\n\n" 1349 "@see $SFX::DEVICE_INFO_CAPS\n\n" 1350 "@see $SFX::DEVICE_CAPS_REVERB\n\n" 1351 "@see $SFX::DEVICE_CAPS_VOICEMANAGEMENT\n\n" 1352 "@see $SFX::DEVICE_CAPS_OCCLUSION\n\n" 1353 "@see $SFX::DEVICE_CAPS_DSPEFFECTS\n\n" 1354 "@see $SFX::DEVICE_CAPS_MULTILISTENER\n\n" 1355 "@see $SFX::DEVICE_CAPS_FMODDESIGNER\n\n" 1356 "@ref SFX_devices\n" 1357 "@ingroup SFX" ) 1358{ 1359 String deviceInfo = SFX->getDeviceInfoString(); 1360 if( deviceInfo.isEmpty() ) 1361 return ""; 1362 1363 return Con::getReturnBuffer( deviceInfo ); 1364} 1365 1366//----------------------------------------------------------------------------- 1367 1368static ConsoleDocFragment _sfxCreateSource1( 1369 "@brief Create a new source that plays the given track.\n\n" 1370 "The source will be returned in stopped state. Call SFXSource::play() to start playback.\n\n" 1371 "In contrast to play-once sources, the source object will not be automatically deleted once playback stops. " 1372 "Call delete() to release the source object.\n\n" 1373 "This function will automatically create the right SFXSource type for the given SFXTrack.\n\n" 1374 "@param track The track the source should play.\n" 1375 "@return A new SFXSource for playback of the given track or 0 if no source could be created from the given track.\n\n" 1376 "@note Trying to create a source for a device-specific track type will fail if the currently selected device " 1377 "does not support the type. Example: trying to create a source for an FMOD Designer event when not running FMOD.\n\n" 1378 "@tsexample\n" 1379 "// Create and play a source from a pre-existing profile:\n" 1380 "%source = sfxCreateSource( SoundFileProfile );\n" 1381 "%source.play();\n" 1382 "@endtsexample\n\n" 1383 "@ingroup SFX", 1384 NULL, 1385 "SFXSource sfxCreateSource( SFXTrack track );" ); 1386static ConsoleDocFragment _sfxCreateSource2( 1387 "@brief Create a new source that plays the given track and position its 3D sounds source at the given coordinates (if it is a 3D sound).\n\n" 1388 "The source will be returned in stopped state. Call SFXSource::play() to start playback.\n\n" 1389 "In contrast to play-once sources, the source object will not be automatically deleted once playback stops. " 1390 "Call delete() to release the source object.\n\n" 1391 "This function will automatically create the right SFXSource type for the given SFXTrack.\n\n" 1392 "@param track The track the source should play.\n" 1393 "@param x The X coordinate of the 3D sound position.\n" 1394 "@param y The Y coordinate of the 3D sound position.\n" 1395 "@param z The Z coordinate of the 3D sound position.\n" 1396 "@return A new SFXSource for playback of the given track or 0 if no source could be created from the given track.\n\n" 1397 "@note Trying to create a source for a device-specific track type will fail if the currently selected device " 1398 "does not support the type. Example: trying to create a source for an FMOD Designer event when not running FMOD.\n\n" 1399 "@tsexample\n" 1400 "// Create and play a source from a pre-existing profile and position it at (100, 200, 300):\n" 1401 "%source = sfxCreateSource( SoundFileProfile, 100, 200, 300 );\n" 1402 "%source.play();\n" 1403 "@endtsexample\n\n" 1404 "@ingroup SFX", 1405 NULL, 1406 "SFXSource sfxCreateSource( SFXTrack track, float x, float y, float z );" ); 1407static ConsoleDocFragment _sfxCreateSource3( 1408 "@brief Create a temporary SFXProfile from the given @a description and @a filename and then create and return a new source that plays the profile.\n\n" 1409 "The source will be returned in stopped state. Call SFXSource::play() to start playback.\n\n" 1410 "In contrast to play-once sources, the source object will not be automatically deleted once playback stops. " 1411 "Call delete() to release the source object.\n\n" 1412 "@param description The description to use for setting up the temporary SFXProfile.\n" 1413 "@param filename Path to the sound file to play.\n" 1414 "@return A new SFXSource for playback of the given track or 0 if no source or no temporary profile could be created.\n\n" 1415 "@tsexample\n" 1416 "// Create a source for a music track:\n" 1417 "%source = sfxCreateSource( AudioMusicLoop2D, \"art/sound/backgroundMusic\" );\n" 1418 "%source.play();\n" 1419 "@endtsexample\n\n" 1420 "@see SFXProfile\n\n" 1421 "@ingroup SFX", 1422 NULL, 1423 "SFXSound sfxCreateSource( SFXDescription description, string filename );" ); 1424static ConsoleDocFragment _sfxCreateSource4( 1425 "@brief Create a temporary SFXProfile from the given @a description and @a filename and then create and return a new source that plays the profile. " 1426 "Position the sound source at the given coordinates (if it is a 3D sound).\n\n" 1427 "The source will be returned in stopped state. Call SFXSource::play() to start playback.\n\n" 1428 "In contrast to play-once sources, the source object will not be automatically deleted once playback stops. " 1429 "Call delete() to release the source object.\n\n" 1430 "@param description The description to use for setting up the temporary SFXProfile.\n" 1431 "@param filename Path to the sound file to play.\n" 1432 "@param x The X coordinate of the 3D sound position.\n" 1433 "@param y The Y coordinate of the 3D sound position.\n" 1434 "@param z The Z coordinate of the 3D sound position.\n" 1435 "@return A new SFXSource for playback of the given track or 0 if no source or no temporary profile could be created.\n\n" 1436 "@tsexample\n" 1437 "// Create a source for a music track and position it at (100, 200, 300):\n" 1438 "%source = sfxCreateSource( AudioMusicLoop3D, \"art/sound/backgroundMusic\", 100, 200, 300 );\n" 1439 "%source.play();\n" 1440 "@endtsexample\n\n" 1441 "@see SFXProfile\n\n" 1442 "@ingroup SFX", 1443 NULL, 1444 "SFXSound sfxCreateSource( SFXDescription description, string filename, float x, float y, float z );" ); 1445 1446DefineConsoleFunction( sfxCreateSource, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3 ), ("", "", "", ""), 1447 "( SFXTrack track | ( SFXDescription description, string filename ) [, float x, float y, float z ] ) " 1448 "Creates a new paused sound source using a profile or a description " 1449 "and filename. The return value is the source which must be " 1450 "released by delete().\n" 1451 "@hide" ) 1452{ 1453 SFXDescription* description = NULL; 1454 SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( sfxType ) ); 1455 if ( !track ) 1456 { 1457 description = dynamic_cast< SFXDescription* >( Sim::findObject( sfxType ) ); 1458 if ( !description ) 1459 { 1460 Con::printf( "Unable to locate sound track/description '%s'", sfxType ); 1461 return 0; 1462 } 1463 } 1464 1465 SFXSource* source = NULL; 1466 1467 if ( track ) 1468 { 1469 // In this overloaded use of the function, arg0..arg2 are x, y, and z. 1470 if ( String::isEmpty(arg0) ) 1471 { 1472 source = SFX->createSource( track ); 1473 } 1474 else 1475 { 1476 MatrixF transform; 1477 transform.set( EulerF(0,0,0), Point3F( dAtof(arg0), dAtof(arg1), dAtof(arg2)) ); 1478 source = SFX->createSource( track, &transform ); 1479 } 1480 } 1481 else if ( description ) 1482 { 1483 // In this use, arg0 is the filename, and arg1..arg3 are x, y, and z. 1484 SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( arg0), true ); 1485 if( !tempProfile->registerObject() ) 1486 { 1487 Con::errorf( "sfxCreateSource - unable to create profile" ); 1488 delete tempProfile; 1489 } 1490 else 1491 { 1492 if ( String::isEmpty(arg1) ) 1493 { 1494 source = SFX->createSource( tempProfile ); 1495 } 1496 else 1497 { 1498 MatrixF transform; 1499 transform.set(EulerF(0,0,0), Point3F( dAtof(arg1), dAtof(arg2), dAtof(arg3) )); 1500 source = SFX->createSource( tempProfile, &transform ); 1501 } 1502 1503 tempProfile->setAutoDelete( true ); 1504 } 1505 } 1506 1507 if ( source ) 1508 return source->getId(); 1509 1510 return 0; 1511} 1512 1513//----------------------------------------------------------------------------- 1514 1515static ConsoleDocFragment _sfxPlay1( 1516 "@brief Start playback of the given source.\n\n" 1517 "This is the same as calling SFXSource::play() directly.\n\n" 1518 "@param source The source to start playing.\n\n" 1519 "@return @a source.\n\n" 1520 "@tsexample\n" 1521 "// Create and play a source from a pre-existing profile:\n" 1522 "%source = sfxCreateSource( SoundFileProfile );\n" 1523 "%source.play();\n" 1524 "@endtsexample\n\n" 1525 "@ingroup SFX", 1526 NULL, 1527 "SFXSource sfxPlay( SFXSource source );" ); 1528static ConsoleDocFragment _sfxPlay2( 1529 "@brief Create a new play-once source for the given @a track and start playback of the source.\n\n" 1530 "This is equivalent to calling sfxCreateSource() on @track and SFXSource::play() on the resulting source.\n\n" 1531 "@param track The sound datablock to play.\n\n" 1532 "@return The newly created play-once source or 0 if the creation failed.\n\n" 1533 "@ref SFXSource_playonce\n\n" 1534 "@ingroup SFX", 1535 NULL, 1536 "void sfxPlay( SFXTrack track );" ); 1537static ConsoleDocFragment _sfxPlay3( 1538 "@brief Create a new play-once source for the given @a track, position its 3D sound at the given coordinates (if the track's description " 1539 "is set up for 3D sound) and start playback of the source.\n\n" 1540 "This is equivalent to calling sfxCreateSource() on @track and SFXSource::play() on the resulting source.\n\n" 1541 "@param track The sound datablock to play.\n\n" 1542 "@param x The X coordinate of the 3D sound position.\n" 1543 "@param y The Y coordinate of the 3D sound position.\n" 1544 "@param z The Z coordinate of the 3D sound position.\n" 1545 "@return The newly created play-once source or 0 if the creation failed.\n\n" 1546 "@ref SFXSource_playonce\n\n" 1547 "@ingroup SFX", 1548 NULL, 1549 "void sfxPlay( SFXTrack track, float x, float y, float z );" ); 1550 1551DefineConsoleFunction( sfxPlay, S32, ( const char * trackName, const char * pointOrX, const char * y, const char * z ), ( "", "", ""), 1552 "Start playing the given source or create a new source for the given track and play it.\n" 1553 "@hide" ) 1554{ 1555 if ( String::isEmpty(pointOrX) ) 1556 { 1557 SFXSource* source = dynamic_cast<SFXSource*>( Sim::findObject( trackName ) ); 1558 if ( source ) 1559 { 1560 source->play(); 1561 return source->getId(); 1562 } 1563 } 1564 1565 SFXTrack* track = dynamic_cast<SFXTrack*>( Sim::findObject( trackName ) ); 1566 if ( !track ) 1567 { 1568 Con::printf( "Unable to locate sfx track '%s'", trackName ); 1569 return 0; 1570 } 1571 1572 Point3F pos(0.f, 0.f, 0.f); 1573 if ( !String::isEmpty( pointOrX ) && String::isEmpty( y ) && String::isEmpty( z ) ) 1574 { 1575 dSscanf( pointOrX, "%g %g %g", &pos.x, &pos.y, &pos.z ); 1576 } 1577 else if( !String::isEmpty( pointOrX ) && !String::isEmpty( y ) && !String::isEmpty( z ) ) 1578 pos.set( dAtof(pointOrX), dAtof(y), dAtof(z) ); 1579 1580 MatrixF transform; 1581 transform.set( EulerF(0,0,0), pos ); 1582 1583 SFXSource* source = SFX->playOnce( track, &transform ); 1584 if ( source ) 1585 return source->getId(); 1586 1587 return 0; 1588} 1589 1590//----------------------------------------------------------------------------- 1591 1592static ConsoleDocFragment _sPlayOnce1( 1593 "@brief Create a play-once source for the given @a track.\n\n" 1594 "Once playback has finished, the source will be automatically deleted in the next sound system update.\n" 1595 "@param track The sound datablock.\n" 1596 "@return A newly created temporary source in \"Playing\" state or 0 if the operation failed.\n\n" 1597 "@ref SFXSource_playonce\n\n" 1598 "@ingroup SFX", 1599 NULL, 1600 "SFXSource sfxPlayOnce( SFXTrack track );" 1601); 1602static ConsoleDocFragment _sPlayOnce2( 1603 "@brief Create a play-once source for the given given @a track and position the source's 3D sound at the given coordinates " 1604 "only if the track's description is set up for 3D sound).\n\n" 1605 "Once playback has finished, the source will be automatically deleted in the next sound system update.\n" 1606 "@param track The sound datablock.\n" 1607 "@param x The X coordinate of the 3D sound position.\n" 1608 "@param y The Y coordinate of the 3D sound position.\n" 1609 "@param z The Z coordinate of the 3D sound position.\n" 1610 "@param fadeInTime If >=0, this overrides the SFXDescription::fadeInTime value on the track's description.\n" 1611 "@return A newly created temporary source in \"Playing\" state or 0 if the operation failed.\n\n" 1612 "@tsexample\n" 1613 "// Immediately start playing the given track. Fade it in to full volume over 5 seconds.\n" 1614 "sfxPlayOnce( MusicTrack, 0, 0, 0, 5.f );\n" 1615 "@endtsexample\n\n" 1616 "@ref SFXSource_playonce\n\n" 1617 "@ingroup SFX", 1618 NULL, 1619 "SFXSource sfxPlayOnce( SFXTrack track, float x, float y, float z, float fadeInTime=-1 );" 1620); 1621static ConsoleDocFragment _sPlayOnce3( 1622 "@brief Create a new temporary SFXProfile from the given @a description and @a filename, then create a play-once source " 1623 "for it and start playback.\n\n" 1624 "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " 1625 "otherwise by then, the temporary SFXProfile will also be deleted.\n" 1626 "@param description The description to use for playback.\n" 1627 "@param filename Path to the sound file to play.\n" 1628 "@return A newly created temporary source in \"Playing\" state or 0 if the operation failed.\n\n" 1629 "@tsexample\n" 1630 "// Play a sound effect file once.\n" 1631 "sfxPlayOnce( AudioEffects, \"art/sound/weapons/Weapon_pickup\" );\n" 1632 "@endtsexample\n\n" 1633 "@ref SFXSource_playonce\n\n" 1634 "@ingroup SFX", 1635 NULL, 1636 "SFXSource sfxPlayOnce( SFXDescription description, string filename );" 1637); 1638static ConsoleDocFragment _sPlayOnce4( 1639 "@brief Create a new temporary SFXProfile from the given @a description and @a filename, then create a play-once source " 1640 "for it and start playback. Position the source's 3D sound at the given coordinates (only if the description " 1641 "is set up for 3D sound).\n\n" 1642 "Once playback has finished, the source will be automatically deleted in the next sound system update. If not referenced " 1643 "otherwise by then, the temporary SFXProfile will also be deleted.\n" 1644 "@param description The description to use for playback.\n" 1645 "@param filename Path to the sound file to play.\n" 1646 "@param x The X coordinate of the 3D sound position.\n" 1647 "@param y The Y coordinate of the 3D sound position.\n" 1648 "@param z The Z coordinate of the 3D sound position.\n" 1649 "@param fadeInTime If >=0, this overrides the SFXDescription::fadeInTime value on the track's description.\n" 1650 "@return A newly created temporary source in \"Playing\" state or 0 if the operation failed.\n\n" 1651 "@tsexample\n" 1652 "// Play a sound effect file once using a 3D sound with a default falloff placed at the origin.\n" 1653 "sfxPlayOnce( AudioDefault3D, \"art/sound/weapons/Weapon_pickup\", 0, 0, 0 );\n" 1654 "@endtsexample\n\n" 1655 "@ref SFXSource_playonce\n\n" 1656 "@ingroup SFX", 1657 NULL, 1658 "SFXSource sfxPlayOnce( SFXDescription description, string filename, float x, float y, float z, float fadeInTime=-1 );" 1659); 1660 1661DefineConsoleFunction( sfxPlayOnce, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3, const char* arg4 ), ("", "", "", "", "-1.0f"), 1662 "SFXSource sfxPlayOnce( ( SFXTrack track | SFXDescription description, string filename ) [, float x, float y, float z, float fadeInTime=-1 ] ) " 1663 "Create a new play-once source for the given profile or description+filename and start playback of the source.\n" 1664 "@hide" ) 1665{ 1666 SFXDescription* description = NULL; 1667 SFXTrack* track = dynamic_cast< SFXTrack* >( Sim::findObject( sfxType ) ); 1668 if( !track ) 1669 { 1670 description = dynamic_cast< SFXDescription* >( Sim::findObject( sfxType ) ); 1671 if( !description ) 1672 { 1673 Con::errorf( "sfxPlayOnce - Unable to locate sound track/description '%s'", sfxType ); 1674 return 0; 1675 } 1676 } 1677 1678 SFXSource* source = NULL; 1679 if( track ) 1680 { 1681 // In this overloaded use, arg0..arg2 are x, y, z, and arg3 is the fadeInTime. 1682 if (String::isEmpty(arg0)) 1683 { 1684 source = SFX->playOnce( track ); 1685 } 1686 else 1687 { 1688 MatrixF transform; 1689 transform.set( EulerF( 0, 0, 0 ), Point3F( dAtof( arg0 ), dAtof( arg1 ),dAtof( arg2 ) ) ); 1690 source = SFX->playOnce( track, &transform, NULL, dAtof( arg3 ) ); 1691 } 1692 } 1693 else if( description ) 1694 { 1695 // In this overload, arg0 is the filename, arg1..arg3 are x, y, z, and arg4 is fadeInTime. 1696 SFXProfile* tempProfile = new SFXProfile( description, StringTable->insert( arg0 ), true ); 1697 if( !tempProfile->registerObject() ) 1698 { 1699 Con::errorf( "sfxPlayOnce - unable to create profile" ); 1700 delete tempProfile; 1701 } 1702 else 1703 { 1704 if (String::isEmpty(arg1)) 1705 source = SFX->playOnce( tempProfile ); 1706 else 1707 { 1708 MatrixF transform; 1709 transform.set( EulerF( 0, 0, 0 ), Point3F( dAtof( arg1 ), dAtof( arg2 ),dAtof( arg3 ) ) ); 1710 source = SFX->playOnce( tempProfile, &transform, NULL, dAtof( arg4 ) ); 1711 } 1712 1713 // Set profile to auto-delete when SFXSource releases its reference. 1714 // Also add to root group so the profile will get deleted when the 1715 // Sim system is shut down before the SFXSource has played out. 1716 1717 tempProfile->setAutoDelete( true ); 1718 Sim::getRootGroup()->addObject( tempProfile ); 1719 } 1720 } 1721 1722 if( !source ) 1723 return 0; 1724 1725 return source->getId(); 1726} 1727 1728//----------------------------------------------------------------------------- 1729 1730DefineEngineFunction( sfxStop, void, ( SFXSource* source ),, 1731 "Stop playback of the given @a source.\n" 1732 "This is equivalent to calling SFXSource::stop().\n\n" 1733 "@param source The source to put into stopped state.\n\n" 1734 "@ingroup SFX" ) 1735{ 1736 if( source ) 1737 source->stop(); 1738} 1739 1740//----------------------------------------------------------------------------- 1741 1742DefineEngineFunction( sfxStopAndDelete, void, ( SFXSource* source ),, 1743 "Stop playback of the given @a source (if it is not already stopped) and delete the @a source.\n\n" 1744 "The advantage of this function over directly calling delete() is that it will correctly " 1745 "handle volume fades that may be configured on the source. Whereas calling delete() would immediately " 1746 "stop playback and delete the source, this functionality will wait for the fade-out to play and only then " 1747 "stop the source and delete it.\n\n" 1748 "@param source A sound source.\n\n" 1749 "@ref SFXSource_fades\n\n" 1750 "@ingroup SFX" ) 1751{ 1752 if( source ) 1753 SFX->stopAndDeleteSource( source ); 1754} 1755 1756//----------------------------------------------------------------------------- 1757 1758DefineEngineFunction( sfxDeleteWhenStopped, void, ( SFXSource* source ),, 1759 "Mark the given @a source for deletion as soon as it moves into stopped state.\n\n" 1760 "This function will retroactively turn the given @a source into a play-once source (see @ref SFXSource_playonce).\n\n" 1761 "@param source A sound source.\n\n" 1762 "@ingroup SFX" ) 1763{ 1764 if( source ) 1765 SFX->deleteWhenStopped( source ); 1766} 1767 1768//----------------------------------------------------------------------------- 1769 1770DefineEngineFunction( sfxGetDistanceModel, SFXDistanceModel, (),, 1771 "Get the falloff curve type currently being applied to 3D sounds.\n\n" 1772 "@return The current distance model type.\n\n" 1773 "@ref SFXSource_volume\n\n" 1774 "@ref SFX_3d\n\n" 1775 "@ingroup SFX" ) 1776{ 1777 return SFX->getDistanceModel(); 1778} 1779 1780//----------------------------------------------------------------------------- 1781 1782DefineEngineFunction( sfxSetDistanceModel, void, ( SFXDistanceModel model ),, 1783 "Set the falloff curve type to use for distance-based volume attenuation of 3D sounds.\n\n" 1784 "@param model The distance model to use for 3D sound.\n\n" 1785 "@note This setting takes effect globally and is applied to all 3D sounds.\n\n" 1786 "@ingroup SFX" ) 1787{ 1788 SFX->setDistanceModel( model ); 1789} 1790 1791//----------------------------------------------------------------------------- 1792 1793DefineEngineFunction( sfxGetDopplerFactor, F32, (),, 1794 "Get the current global doppler effect setting.\n\n" 1795 "@return The current global doppler effect scale factor (>=0).\n\n" 1796 "@see sfxSetDopplerFactor\n\n" 1797 "@ref SFXSource_doppler\n\n" 1798 "@ingroup SFX" ) 1799{ 1800 return SFX->getDopplerFactor(); 1801} 1802 1803//----------------------------------------------------------------------------- 1804 1805DefineEngineFunction( sfxSetDopplerFactor, void, ( F32 value ),, 1806 "Set the global doppler effect scale factor.\n" 1807 "@param value The new doppler shift scale factor.\n" 1808 "@pre @a value must be >= 0.\n" 1809 "@see sfxGetDopplerFactor\n\n" 1810 "@ref SFXSource_doppler\n\n" 1811 "@ingroup SFX" ) 1812{ 1813 if( value < 0.0f ) 1814 { 1815 Con::errorf( "sfxSetDopplerFactor - factor must be >0" ); 1816 return; 1817 } 1818 1819 SFX->setDopplerFactor( value ); 1820} 1821 1822//----------------------------------------------------------------------------- 1823 1824DefineEngineFunction( sfxGetRolloffFactor, F32, (),, 1825 "Get the current global scale factor applied to volume attenuation of 3D sounds in the logarithmic model.\n" 1826 "@return The current scale factor for logarithmic 3D sound falloff curves.\n\n" 1827 "@see sfxGetDistanceModel\n" 1828 "@see SFXDistanceModel\n\n" 1829 "@ref SFXSource_volume\n" 1830 "@ref SFX_3d\n" 1831 "@ingroup SFX" ) 1832{ 1833 return SFX->getRolloffFactor(); 1834} 1835 1836//----------------------------------------------------------------------------- 1837 1838DefineEngineFunction( sfxSetRolloffFactor, void, ( F32 value ),, 1839 "Set the global scale factor to apply to volume attenuation of 3D sounds in the logarithmic model.\n" 1840 "@param value The new scale factor for logarithmic 3D sound falloff curves.\n\n" 1841 "@pre @a value must be > 0.\n" 1842 "@note This function has no effect if the currently distance model is set to SFXDistanceModel::Linear.\n\n" 1843 "@see sfxGetDistanceModel\n" 1844 "@see SFXDistanceModel\n\n" 1845 "@ref SFXSource_volume\n" 1846 "@ref SFX_3d\n" 1847 "@ingroup SFX" ) 1848{ 1849 if( value <= 0.0f ) 1850 { 1851 Con::errorf( "sfxSetRolloffFactor - factor must be >0" ); 1852 return; 1853 } 1854 1855 SFX->setRolloffFactor( value ); 1856} 1857 1858//----------------------------------------------------------------------------- 1859 1860DefineEngineFunction( sfxDumpSources, void, ( bool includeGroups ), ( false ), 1861 "Dump information about all current SFXSource instances to the console.\n" 1862 "The dump includes information about the playback status for each source, volume levels, virtualization, etc.\n" 1863 "@param includeGroups If true, direct instances of SFXSources (which represent logical sound groups) will be included. " 1864 "Otherwise only instances of subclasses of SFXSources are included in the dump.\n" 1865 "@see SFXSource\n" 1866 "@see sfxDumpSourcesToString\n" 1867 "@ingroup SFX" ) 1868{ 1869 SFX->dumpSources( NULL, !includeGroups ); 1870} 1871 1872//----------------------------------------------------------------------------- 1873 1874DefineEngineFunction( sfxDumpSourcesToString, const char*, ( bool includeGroups ), ( false ), 1875 "Dump information about all current SFXSource instances to a string.\n" 1876 "The dump includes information about the playback status for each source, volume levels, virtualization, etc.\n" 1877 "@param includeGroups If true, direct instances of SFXSources (which represent logical sound groups) will be included. " 1878 "Otherwise only instances of subclasses of SFXSources are included in the dump.\n" 1879 "@return A string containing a dump of information about all currently instantiated SFXSources.\n" 1880 "@see SFXSource\n" 1881 "@see sfxDumpSources\n" 1882 "@ingroup SFX" ) 1883{ 1884 StringBuilder str; 1885 SFX->dumpSources( &str, !includeGroups ); 1886 1887 return Con::getReturnBuffer( str ); 1888} 1889
