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