Hi @t0m, I had some work to do but now I’m returning to Juce and C++ programming…
I have migrate from vst2 to vst3, but the configurations you tell me to do, don’t produce different effects for different channels: if i use:
buffer.getWritePointer(1);
the sound is not effected, if I use
buffer.getWritePointer(0);
the sound is effected but in both stereo channels…
Am I missing something?
I used the buffer.copyFrom() method but the pointer at the right channel seems to be empty…
In the demo there is code to clear all unused input buffers, in case it contains garbage, that would kill your hearing if it is still there at the end of processBlock…
There is a long explanation (worth reading) to these two lines:
for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
You can remove them, because you copied the left channel into the right channel, so you don’t have to clean them (and especially not after the copy)…
If you’ve made sure that all the calls to getTotalNumInputChannels() and getTotalNumOutputChannels() in the AudioProcessor class are doing what you expect (the code in the examples assume these will return the same number, which is not true in your case, so you need to check) then the code I posted on the 1st Feb will turn your mono input into stereo output. Try doing this yourself with a much simpler example first.
If you run your host from the terminal/cmd, you will see the printout.
b. If you know the result and want to make sure, it is always what you expect, type
jassert (getTotalNumOutputChannels() == 2);
In this case your programm will stop executing, if the result is not 2, so you can use your debugger to figure out why (e.g. by inspecting the call stack) and fix things.
{
const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels();
DBG ("Number output channels: " + String (getTotalNumOutputChannels()));
// In case we have more outputs than inputs, this code clears any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
// This is here to avoid people getting screaming feedback
// when they first compile a plugin, but obviously you don't need to keep
// this code if your algorithm always overwrites all the output channels.
//for (int i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
// buffer.clear (i, 0, buffer.getNumSamples());
// This is the place where you'd normally do the guts of your plugin's
// audio processing...
const int numSamples = buffer.getNumSamples();
buffer.copyFrom(1, 0, buffer, 0, 0, numSamples);
float* channelDataL = buffer.getWritePointer (0);
float* channelDataR = buffer.getWritePointer (1);
pitch1.setShift(0.5);
pitch1.setEffectMix(0.5);
pitch2.setShift(0.5);
pitch2.setEffectMix(0.5);
for (int i = 0; i < numSamples; ++i)
{
channelDataR[i] = pitch2.tick(channelDataR[i]);
}
}
I receive from debugger “mums channels 2”, But no sound on buffer.getWritePointer(1); …
And stereo sound on writePointer 0…
Please take the JUCE Demo Plugin, modify it as I have described, and check that you get the expected mono to stereo behaviour. If this works we can rule out all sorts of problems: we would know that it’s not a misconfigured host or JUCE project. At the moment you have an unknown function call, pitch2.tick, which could be doing anything, so it’s very difficult to help.
I’ve included even .withOutput stereo true…
And I have already modified the the demo plugin…
The call pitch2.tick(STKFloat); is a method from STK C++ libraries developed by Stanford University and translated to JUCE by @danlin.
No… it has the same behavior of my complete programs…
The best result I had was that both write pointers (0 and 1) returned mono effect (in another audio plugin). If you need the code I can post it.
Does Cubase 9 elements support a mono-input stereo-output track? Have you tried testing in the JUCE demo host? Here it’s very easy to route your audio correctly.