I have old Oboe code that I’m moving to Juce. It processes buffers in a different way than Juce (I guess).
For example, a stereo channel on Oboe is ABABABABABAB where A is a float from the first channel and B is a float from the second channel.
On juce, it looks like there are separate buffers for each channel:
void processBlock (juce::AudioSampleBuffer& buffer, juce::MidiBuffer&) override
{
auto* audioData = buffer.getReadPointer(0);
//I'd like to pass audioData for some old oboe code to fill, but it would have to be in the format ABABABABAB
Is there a way that I can get the juce buffer in this desired format that oboe uses?
That is, they are split audio buffers. If you need to handle your data as interleaved buffers like ABABABABAB... , you will need to have some helper buffers and do some conversions between the split and interleaved channel formats.
You can just use prepareToPlay… Because you’re interleaving samples in this case, you can just allocate a buffer of blocksize * 2 samples in prepareToPlay, and you should be golden…
The maximumExpectedSamplesPerBlock value is a strong hint about the maximum number of samples that will be provided in each block. You may want to use this value to resize internal buffers. You should program defensively in case a buggy host exceeds this value. The actual block sizes that the host uses may be different each time the callback happens: completely variable block sizes can be expected from some hosts.
Is it frequent to have an host that exceeds the block size value provided in prepareToPlay?