| 61 | } |
| 62 | |
| 63 | void SlowLayers::Process(double time) |
| 64 | { |
| 65 | PROFILER(SlowLayers); |
| 66 | |
| 67 | IAudioReceiver* target = GetTarget(); |
| 68 | |
| 69 | if (!mEnabled || target == nullptr) |
| 70 | return; |
| 71 | |
| 72 | ComputeSliders(0); |
| 73 | SyncBuffers(); |
| 74 | |
| 75 | int bufferSize = GetBuffer()->BufferSize(); |
| 76 | float* out = target->GetBuffer()->GetChannel(0); |
| 77 | |
| 78 | int loopLengthInSamples = LoopLength(); |
| 79 | |
| 80 | int layers = 4; |
| 81 | for (int i = 0; i < bufferSize; ++i) |
| 82 | { |
| 83 | float smooth = .001f; |
| 84 | mSmoothedVol = mSmoothedVol * (1 - smooth) + mVol * smooth; |
| 85 | float volSq = mSmoothedVol * mSmoothedVol; |
| 86 | |
| 87 | double measurePos = TheTransport->GetMeasureTime(time); |
| 88 | measurePos = DoubleWrap(measurePos, 1 << layers * mNumBars); |
| 89 | int offset = measurePos * loopLengthInSamples; |
| 90 | |
| 91 | mBuffer[offset % loopLengthInSamples] += GetBuffer()->GetChannel(0)[i] * mFeedIn; |
| 92 | |
| 93 | float output = (1 - mFeedIn) * GetBuffer()->GetChannel(0)[i]; |
| 94 | for (int j = 0; j < layers; ++j) |
| 95 | output += GetInterpolatedSample(offset / float(1 << j), mBuffer, loopLengthInSamples); |
| 96 | |
| 97 | output *= volSq; |
| 98 | |
| 99 | out[i] += output; |
| 100 | |
| 101 | time += gInvSampleRateMs; |
| 102 | } |
| 103 | |
| 104 | Add(out, GetBuffer()->GetChannel(0), bufferSize); |
| 105 | |
| 106 | GetVizBuffer()->WriteChunk(GetBuffer()->GetChannel(0), bufferSize, 0); |
| 107 | |
| 108 | GetBuffer()->Reset(); |
| 109 | } |
| 110 | |
| 111 | int SlowLayers::LoopLength() const |
| 112 | { |
nothing calls this directly
no test coverage detected