Hey everyone, I’m slowly getting up to speed with Juce and DSP, so I apologize if what I may be doing is a hack but essentially, I’m following along the Audio Plugin demo, except right now I’m only implementing gain being changed, as if I want a VST that just adjusts volume (for now). Now the timer callbacks seem to work no problem however my VST crashes when I go to move the slider that triggers:
if (slider == slider1)
{
getProcessor()->setParameterNotifyingHost (JuceAudioTestAudioProcessor::gainParam, (float)slider1->getValue());
}
I get an application error (in Reaper) saying "The instruction at “0x03b543d0” referenced memory at “0x00000004”. The memory could not be “read”.
And it’s the above call that triggers it, my code in my Processor looks like this:
[code]void JuceAudioTestAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
{
// This is the place where you’d normally do the guts of your plugin’s
// audio processing…
for (int channel = 0; channel < getNumInputChannels(); ++channel)
{
float* channelData = buffer.getSampleData (channel);
// ..do something to the data...
buffer.applyGain (channel, 0, buffer.getNumSamples(), gain);
}
// In case we have more outputs than inputs, we'll clear any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
{
buffer.clear (i, 0, buffer.getNumSamples());
}
}[/code]
I only have a gainParam and numParams, and in addition I’m using the float variable “gain” as the variable name just like in the demo.
Now when I debug I get:
"Unhandled exception at 0x03b543d0 (Juce Audio test.dll) in reaper.exe: 0xC0000005: Access violation reading location 0x00000004."
and it breaks at this code:
void AudioProcessor::sendParamChangeMessageToListeners (const int parameterIndex, const float newValue)
{
jassert (isPositiveAndBelow (parameterIndex, getNumParameters()));
for (int i = listeners.size(); --i >= 0;)
{
AudioProcessorListener* l;
{
const ScopedLock sl (listenerLock);
l = listeners [i];
}
if (l != 0)
l->audioProcessorParameterChanged (this, parameterIndex, newValue); // IT POINTS TO THIS LINE
}
}
Now I’m not entirely sure what’s going on, and I don’t know if somehow the VST I’m trying to design maybe isn’t somehow taking in input from the DAW or something, as it’s built off the Juce Audio Demo which is a synth. I could be out to lunch somewhere but I’ve been trying and trying with this and no luck. Any help would be appreciated! Thanks!