Begin sound frame
| 624 | |
| 625 | // Begin sound frame |
| 626 | void lnxsound::SoundStartFrame() { |
| 627 | float frame_time; |
| 628 | |
| 629 | if (m_timer_last_frametime == -1) { |
| 630 | frame_time = 0.0f; |
| 631 | } else { |
| 632 | frame_time = (timer_GetMSTime() - m_timer_last_frametime) / 1000.0f; |
| 633 | } |
| 634 | m_timer_last_frametime = timer_GetMSTime(); |
| 635 | |
| 636 | // perform necessary functions if sound events are pending for frame, this doesn't have to do anything |
| 637 | // if the mixer doesn't require such actions. Aureal does though. |
| 638 | if (m_pending_actions) { |
| 639 | mprintf(0, "pending actions\n"); |
| 640 | } |
| 641 | |
| 642 | m_in_sound_frame = true; |
| 643 | m_pending_actions = false; |
| 644 | |
| 645 | int counter = 0, loop_counter = 0, stream_counter = 0, buf_loop_counter = 0; |
| 646 | |
| 647 | #ifdef _DEBUG |
| 648 | int n_p5 = 0, n_p4 = 0, n_p3 = 0, n_p2 = 0, n_p1 = 0, n_p0 = 0; |
| 649 | #endif |
| 650 | |
| 651 | for (auto ¤t_slot : sound_cache) { |
| 652 | sound_buffer_info *sb = ¤t_slot; |
| 653 | if (sb->m_status != SSF_UNUSED) { |
| 654 | counter++; |
| 655 | if (sb->m_status & SSF_PLAY_LOOPING) { |
| 656 | if (sb->m_status & SSF_BUFFERED_LOOP) |
| 657 | buf_loop_counter++; |
| 658 | loop_counter++; |
| 659 | } |
| 660 | if (sb->m_status & SSF_PLAY_STREAMING) |
| 661 | stream_counter++; |
| 662 | |
| 663 | #ifdef _DEBUG |
| 664 | if (sb->play_info->priority == SND_PRIORITY_CRITICAL) |
| 665 | n_p5++; |
| 666 | else if (sb->play_info->priority == SND_PRIORITY_HIGHEST) |
| 667 | n_p4++; |
| 668 | else if (sb->play_info->priority == SND_PRIORITY_HIGH) |
| 669 | n_p3++; |
| 670 | else if (sb->play_info->priority == SND_PRIORITY_NORMAL) |
| 671 | n_p2++; |
| 672 | else if (sb->play_info->priority == SND_PRIORITY_LOW) |
| 673 | n_p1++; |
| 674 | else if (sb->play_info->priority == SND_PRIORITY_LOWEST) |
| 675 | n_p0++; |
| 676 | #endif |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | // update cache stress timer. |
| 681 | if (counter < (MAX_SOUNDS_PLAYING_AT_ONCE * 3 / 4)) { |
| 682 | m_cache_stress_timer += frame_time; |
| 683 | } else { |
no outgoing calls
no test coverage detected