| 911 | } |
| 912 | |
| 913 | void Looper::MergeIn(Looper* otherLooper) |
| 914 | { |
| 915 | int newNumBars = MAX(mNumBars, otherLooper->mNumBars); |
| 916 | |
| 917 | SetNumBars(newNumBars); |
| 918 | |
| 919 | otherLooper->SetNumBars(newNumBars); |
| 920 | |
| 921 | if (mVol > 0.01f) |
| 922 | { |
| 923 | for (int ch = 0; ch < mBuffer->NumActiveChannels(); ++ch) |
| 924 | { |
| 925 | Mult(otherLooper->mBuffer->GetChannel(ch), (otherLooper->mVol * otherLooper->mVol) / (mVol * mVol), mLoopLength); //keep other looper at same apparent volume |
| 926 | Add(mBuffer->GetChannel(ch), otherLooper->mBuffer->GetChannel(ch), mLoopLength); |
| 927 | } |
| 928 | } |
| 929 | else //ours was silent, just replace it |
| 930 | { |
| 931 | mBuffer->CopyFrom(otherLooper->mBuffer, mLoopLength); |
| 932 | mVol = 1; |
| 933 | } |
| 934 | |
| 935 | otherLooper->Clear(); |
| 936 | |
| 937 | if (mRecorder) |
| 938 | mLastCommit = mRecorder->IncreaseCommitCount(); |
| 939 | } |
| 940 | |
| 941 | void Looper::SwapBuffers(Looper* otherLooper) |
| 942 | { |
no test coverage detected