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

Method mix_internal

extlibs/soloud/src/core/soloud.cpp:1766–1924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1764 }
1765
1766 void Soloud::mix_internal(unsigned int aSamples)
1767 {
1768#ifdef FLOATING_POINT_DEBUG
1769 // This needs to be done in the audio thread as well..
1770 static int done = 0;
1771 if (!done)
1772 {
1773 unsigned int u;
1774 u = _controlfp(0, 0);
1775 u = u & ~(_EM_INVALID | /*_EM_DENORMAL |*/ _EM_ZERODIVIDE | _EM_OVERFLOW /*| _EM_UNDERFLOW | _EM_INEXACT*/);
1776 _controlfp(u, _MCW_EM);
1777 done = 1;
1778 }
1779#endif
1780
1781 float buffertime = aSamples / (float)mSamplerate;
1782 float globalVolume[2];
1783 mStreamTime += buffertime;
1784 mLastClockedTime = 0;
1785
1786 globalVolume[0] = mGlobalVolume;
1787 if (mGlobalVolumeFader.mActive)
1788 {
1789 mGlobalVolume = mGlobalVolumeFader.get(mStreamTime);
1790 }
1791 globalVolume[1] = mGlobalVolume;
1792
1793 lockAudioMutex();
1794
1795 // Process faders. May change scratch size.
1796 int i;
1797 for (i = 0; i < (signed)mHighestVoice; i++)
1798 {
1799 if (mVoice[i] && !(mVoice[i]->mFlags & AudioSourceInstance::PAUSED))
1800 {
1801 float volume[2];
1802
1803 mVoice[i]->mActiveFader = 0;
1804
1805 if (mGlobalVolumeFader.mActive > 0)
1806 {
1807 mVoice[i]->mActiveFader = 1;
1808 }
1809
1810 mVoice[i]->mStreamTime += buffertime;
1811 mVoice[i]->mStreamPosition += buffertime;
1812
1813 // TODO: this is actually unstable, because mStreamTime depends on the relative
1814 // play speed.
1815 if (mVoice[i]->mRelativePlaySpeedFader.mActive > 0)
1816 {
1817 float speed = mVoice[i]->mRelativePlaySpeedFader.get(mVoice[i]->mStreamTime);
1818 setVoiceRelativePlaySpeed(i, speed);
1819 }
1820
1821 volume[0] = mVoice[i]->mOverallVolume;
1822 if (mVoice[i]->mVolumeFader.mActive > 0)
1823 {

Callers

nothing calls this directly

Calls 4

clipFunction · 0.85
getMethod · 0.45
initMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected