good day all
I am trying to run 1 audio signal through 3 filters. a low shelf, a band pass and a high shelf.
The idea is to have variable pots like that on a mixer.
As yet all they do is change the gain of the output signal. so you could say I’m getting ahead of myself but I can’t work out how addFrom() or getFrom() work
I have set up a buffer for each of the filters and made them the filters i need. I have 3 sliders that control the gain within them, for example:
lowFilter->makeLowShelf(sampleRate, 200.0, 1.0, bassGain);
my thought process was that i need to add each of the filtered signals into a mixedBuffer and have that as my output instead of bufferToFill. this way when you adjust the relative gain the signal will be boosted or attenuated.
this code is contained within an audioSource that is called by the audio I/O callback in my main app component.
What i want is the output signal to be the combination of the filtered signal
Any help will be greatly appreciated.
code :
[code]//==============================================================================
//Audio
//==============================================================================
void Player::prepareToPlay (int samplesPerBlockExpected,double sampleRate)
{
resamplingAudioSource->prepareToPlay(samplesPerBlockExpected, sampleRate);
lowFilter->makeLowShelf(sampleRate, 200.0, 1.0, bassGain);
midFilter->makeBandPass(sampleRate, 4000, 880, midGain);
highFilter->makeHighShelf(sampleRate, 22000.0, 1.0, highGain);
}
void Player::releaseResources()
{
resamplingAudioSource->releaseResources();
}
void Player::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill)
{
resamplingAudioSource->getNextAudioBlock(bufferToFill);
AudioSampleBuffer lsbuf(*bufferToFill.buffer);
lowFilter->processSamples(lsbuf.getSampleData(0), lsbuf.getNumSamples());
bufferToFill.buffer->applyGain(0, lsbuf.getNumSamples(), bassGain);
// have different buffers fo mid low and high, add them together and then use get???() to add them to buffer to fill
AudioSampleBuffer bpbuf(*bufferToFill.buffer);
midFilter->processSamples(bpbuf.getSampleData(0), bpbuf.getNumSamples());
bufferToFill.buffer->applyGain(0, bpbuf.getNumSamples(), midGain);
AudioSampleBuffer hsbuf(*bufferToFill.buffer);
highFilter->processSamples(hsbuf.getSampleData(0), hsbuf.getNumSamples());
bufferToFill.buffer->applyGain(0, hsbuf.getNumSamples(), highGain);
mixedBuffer->copyFrom(0, 0, lsbuf, lsbuf.getNumSamples());
// if (bufferToFill.buffer->getNumChannels() > 1)
//{
// lowFilter2->processSamples(bufferToFill.buffer->getSampleData(1), bufferToFill.buffer->getNumSamples());
// }
}[/code]