MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / mapResampleBuffers

Method mapResampleBuffers

extlibs/soloud/src/core/soloud.cpp:1625–1675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1623 }
1624
1625 void Soloud::mapResampleBuffers()
1626 {
1627 SOLOUD_ASSERT(mMaxActiveVoices < 256);
1628 char live[256];
1629 memset(live, 0, mMaxActiveVoices);
1630 unsigned int i, j;
1631 for (i = 0; i < mMaxActiveVoices; i++)
1632 {
1633 for (j = 0; j < mMaxActiveVoices; j++)
1634 {
1635 if (mResampleDataOwner[i] && mResampleDataOwner[i] == mVoice[mActiveVoice[j]])
1636 {
1637 live[i] |= 1; // Live channel
1638 live[j] |= 2; // Live voice
1639 }
1640 }
1641 }
1642
1643 for (i = 0; i < mMaxActiveVoices; i++)
1644 {
1645 if (!(live[i] & 1) && mResampleDataOwner[i]) // For all dead channels with owners..
1646 {
1647 mResampleDataOwner[i]->mResampleData[0] = 0;
1648 mResampleDataOwner[i]->mResampleData[1] = 0;
1649 mResampleDataOwner[i] = 0;
1650 }
1651 }
1652
1653 int latestfree = 0;
1654 for (i = 0; i < mActiveVoiceCount; i++)
1655 {
1656 if (!(live[i] & 2) && mVoice[mActiveVoice[i]]) // For all live voices with no channel..
1657 {
1658 int found = -1;
1659 for (j = latestfree; found == -1 && j < mMaxActiveVoices; j++)
1660 {
1661 if (mResampleDataOwner[j] == 0)
1662 {
1663 found = j;
1664 }
1665 }
1666 SOLOUD_ASSERT(found != -1);
1667 mResampleDataOwner[found] = mVoice[mActiveVoice[i]];
1668 mResampleDataOwner[found]->mResampleData[0] = &mResampleData[found * 2 + 0];
1669 mResampleDataOwner[found]->mResampleData[1] = &mResampleData[found * 2 + 1];
1670 mResampleDataOwner[found]->mResampleData[0]->clear();
1671 mResampleDataOwner[found]->mResampleData[1]->clear();
1672 latestfree = found + 1;
1673 }
1674 }
1675 }
1676
1677 void Soloud::calcActiveVoices()
1678 {

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected