MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateAudioState

Method updateAudioState

Engine/source/T3D/shapeBase.cpp:2259–2292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2257}
2258
2259void ShapeBase::updateAudioState(SoundThread& st)
2260{
2261 SFX_DELETE( st.sound );
2262
2263 if ( st.play && st.asset )
2264 {
2265 if ( isGhost() )
2266 {
2267 // if asset is valid, play
2268 if (st.asset->isAssetValid() )
2269 {
2270 st.sound = SFX->createSource( st.asset->getSfxProfile() , &getTransform() );
2271 if ( st.sound )
2272 st.sound->play();
2273 }
2274 else
2275 st.play = false;
2276 }
2277 else
2278 {
2279 // Non-looping sounds timeout on the server
2280 st.timeout = 0;
2281 if ( !st.asset->getSfxDescription()->mIsLooping )
2282 st.timeout = Sim::getCurrentTime() + sAudioTimeout;
2283 }
2284 }
2285 else
2286 {
2287 // st.sound was not stopped before. If this causes issues remove.
2288 st.play = false;
2289 if (st.sound)
2290 st.sound->stop();
2291 }
2292}
2293
2294void ShapeBase::updateAudioPos()
2295{

Callers

nothing calls this directly

Calls 7

isAssetValidMethod · 0.80
getSfxProfileMethod · 0.80
getSfxDescriptionMethod · 0.80
getCurrentTimeFunction · 0.50
createSourceMethod · 0.45
playMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected