The code presented there uses numSamples from the audio buffer to synch the generated MIDI notes:
// we use the buffer to get timing information
auto numSamples = buffer.getNumSamples
However, when I run the arpeggiator VST3 plugin (whether within the JUCE plugin host or Bitwig), the return value for buffer.getNumSamples is always zero, which
I assume should not be the case.
Could this be because the plugin type is not set up correctly in ArpeggiatorTutorial.jucer ? If so, what should the settings be for Plugin characteristics/VST3 Category/VST (legacy) category etc?
Similar problem for me, but sampleRate is also zero. I stepped thru all the standalone app init code with a debugger and saw that since there are no audio channels, it forces sampleRate/bufferSize to zeroes. Changing “Options” on the standalone app doesn’t help either, as they are clobbered when saving. Workaround seemed to be successful: forced a mono audio input channel in Arpeggiator() constructor. “Options” can be set and saved. ~~ Using Juce 5.4.3, Win10, VS2017, VST3.
I start the Visual Studio debugger which runs the standalone .exe app that is built with the project and wrapped around the plugin. There is a button “Options” at the upper left which lets you set up the audio/MIDI configuration. The audio controls don’t work unless the plugin has at least one audio input.
In Projucer I just checked MIDI in, MIDI out, MIDI effect.
The issue seems to involve the following code in juce_AudioDeviceManager.cpp (near line 527):
if (inputChannels.isZero() && outputChannels.isZero())
{
if (treatAsChosenDevice)
updateXml();
return {};
}
For a test, I added a “#ifndef XX_ALLOW_ZERO_AUDIO_CHANNELS” around this code and defined the macro in AppConfig.h to turn it off. That seems to work successfully.
As a MidiEffect is often used on the effects chain of the instrument that it is playing, you’d want audio passthrough in this case.
Currently, when you select that the plugin is a MidiEffect, JUCE disables audio input and output, disabling the ability for the instrument’s audio to pass through the effect, effectively muting the instrument.