Multlple buffer.getNumSamples in loop crashes Reaper


#1

I added a second gain knob to my first plugin. Why? Because Rome wasn’t built before anyone could walk. :shock:

Every time I touched the second knob I’d crash Reaper with a c0000005 exception. After picking it with a stick a bit, I figured out that I can’t use two instances of buffer.getNumSamples() in the same loop. Why is that? Just curious. Option #2 works fine.

[code] // Go through the incoming data, and apply our gain to it…
for (channel = 0; channel < getNumInputChannels(); ++channel)
{
// Option 1 - Crashed Reaper Every Time
// buffer.applyGain (channel, 0, buffer.getNumSamples(), gain);
// buffer.applyGain (channel, 0, buffer.getNumSamples(), gain2);

	// Option 2 - works fine
		int brandobuffer = buffer.getNumSamples();
		buffer.applyGain (channel, 0, brandobuffer, gain);
		buffer.applyGain (channel, 0, brandobuffer, gain2);
}[/code]

Brandon


#2

Totally the wrong conclusion, I’m afraid. If that code is crashing, it must be because the buffer object is trashed, or the channel is out-of-range. You need to spend some quality time with your debugger!