| 355 | } |
| 356 | |
| 357 | SoundEffectId sound_maintain(SoundEffectId idInstance, SoundSourceId idSound, vec3_fixed pos) |
| 358 | { |
| 359 | if (idSound) |
| 360 | { |
| 361 | s32 vol, pan; |
| 362 | GameSound* sound = getSoundPtr(idSound); |
| 363 | soundCalculateCue(sound, pos.x, pos.y, pos.z, &vol, &pan); |
| 364 | s_lastMaintainVolume = vol; |
| 365 | |
| 366 | if (vol) |
| 367 | { |
| 368 | // Check to see if the sound is still playing at specific intervals. |
| 369 | if (idInstance && !(s_curTick & 0x0f)) |
| 370 | { |
| 371 | if (ImGetParam(idInstance, soundPlayCount) == 0) |
| 372 | { |
| 373 | sound_stop(idInstance); |
| 374 | idInstance = 0; |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | if (!idInstance) |
| 379 | { |
| 380 | idInstance = sound_play(idSound); |
| 381 | } |
| 382 | sound_setVolume(idInstance, vol); |
| 383 | sound_setPan(idInstance, pan); |
| 384 | } |
| 385 | else if (idInstance) |
| 386 | { |
| 387 | sound_stop(idInstance); |
| 388 | idInstance = 0; |
| 389 | } |
| 390 | return idInstance; |
| 391 | } |
| 392 | return 0; |
| 393 | } |
| 394 | |
| 395 | //////////////////////////////////////////////////////////////////// |
| 396 | // Internal |
no test coverage detected