Hi everyone,
I’m having some issue here trying to figure out what i do wrong.
My plugin is playing Binary Wav Files simultaly
in the constructor
newSource = getReader(BinaryData::Test1_wav, BinaryData::Test1_wavSize);
newSource2 = getReader(BinaryData::Test2_wav, BinaryData::Test2_wavSize);
void FXAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::AudioSourceChannelInfo info(&mixBuffer, 0, buffer.getNumSamples());
sourceToBuffer(newSource, info, mixBuffer, buffer, ((1.0 * p) /2 * d));
sourceToBuffer(newSource2, info, mixBuffer, buffer, ((1.0 * i) / 2 * d));`
}
void FXAudioProcessor::sourceToBuffer(juce::AudioFormatReaderSource* source, juce::AudioSourceChannelInfo info, juce::AudioSampleBuffer mixBuffer, juce::AudioSampleBuffer buffer, float calcul)
{
source->getNextAudioBlock(info);
int mini = (mixBuffer.getNumChannels() < buffer.getNumChannels()) ? mixBuffer.getNumChannels() : buffer.getNumChannels();
for (int c = 0; c < mini; ++c)
buffer.addFrom(0, c, mixBuffer.getReadPointer(c), buffer.getNumSamples(), calcul);
}
void FXAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
{
mixBuffer.setSize(1, samplesPerBlock);
}
Now it plays fine (left speaker) but when it gets to the point to switch in stereo
void FXAudioProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
{
mixBuffer.setSize(2, samplesPerBlock);
}
somehow doesn’t work… on top of that by launching the plugin with the daw set up at 44100hz wich is the sample rate of the files too, everything plays fine but when it get to the point to set the project to 48000hz, files aren’t been resampled then obviously been played faster.
Been trying to find thoose past days step by step what i do wrong, would anybody get a clue??
Thanks a lot!