MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Process

Method Process

Source/Granulator.cpp:145–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void 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
159void Grain::DrawGrain(int idx, float x, float y, float w, float h, int bufferStart, int viewLength, int bufferLength)
160{

Callers 1

ProcessFrameMethod · 0.45

Calls 2

GetInterpolatedSampleFunction · 0.85
NumActiveChannelsMethod · 0.80

Tested by

no test coverage detected