| 143 | } |
| 144 | |
| 145 | void Grain::Process(double time, ChannelBuffer* buffer, int bufferLength, float* output) |
| 146 | { |
| 147 | if (time >= mStartTime && time <= mEndTime && mVol != 0) |
| 148 | { |
| 149 | mPos += mSpeedMult * mOwner->mSpeed; |
| 150 | float window = GetWindow(time); |
| 151 | for (int ch = 0; ch < buffer->NumActiveChannels(); ++ch) |
| 152 | { |
| 153 | float sample = GetInterpolatedSample(mPos, buffer, bufferLength, std::clamp(ch + mStereoPosition, 0.f, 1.f)); |
| 154 | output[ch] += sample * window * mVol * (1 + (ch == 0 ? mStereoPosition : -mStereoPosition)); |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | void Grain::DrawGrain(int idx, float x, float y, float w, float h, int bufferStart, int viewLength, int bufferLength) |
| 160 | { |
no test coverage detected