| 414 | static const f32 c_offset[] = { -1.0f, -1.0f, 0.0f }; |
| 415 | |
| 416 | void cleanupSources() |
| 417 | { |
| 418 | // call any finished callbacks. |
| 419 | for (u32 s = 0; s < s_sourceCount; s++) |
| 420 | { |
| 421 | if (s_sources[s].flags&SND_FLAG_FINISHED) |
| 422 | { |
| 423 | s_sources[s].flags = 0; |
| 424 | s_sources[s].buffer = nullptr; |
| 425 | if (s_sources[s].finishedCallback) |
| 426 | { |
| 427 | s_sources[s].finishedCallback(s_sources[s].finishedUserData, s_sources[s].finishedArg); |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | const s32 end = (s32)s_sourceCount - 1; |
| 433 | //shrink the number of sources until an active source is found. |
| 434 | for (s32 s = end; s >= 0; s--) |
| 435 | { |
| 436 | if (s_sources[s].flags&SND_FLAG_ACTIVE) |
| 437 | { |
| 438 | break; |
| 439 | } |
| 440 | s_sourceCount--; |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | f32 sampleBuffer(u32 index, SoundDataType type, const u8* data) |
| 445 | { |