| 2257 | } |
| 2258 | |
| 2259 | void 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 | |
| 2294 | void ShapeBase::updateAudioPos() |
| 2295 | { |
nothing calls this directly
no test coverage detected