Request: AudioBuffer::matchesShape method

Instead of doing

jassert (aBuffer.getNumChannels() == anotherBuffer.getNumChannels());
jassert (aBuffer.getNumSamples() == anotherBuffer.getNumSamples());

It may be nice to do

jassert (aBuffer.matchesShape (anotherBuffer));

I think what’s really missing is a structure AudioBufferSize, which contains the size + num channels. I wish I’d created one of those 15 years ago…


The more general concept would be multi-dimensional arrays, like popularised by numpy, where a contiguous block of memory is treated as a X on Y on Z array…

In Python you indeed do assert aBuffer.shape == anotherBuffer.shape

I like the idea… just not sure if the word “shape” is intuitive for this…? Just my penny’s worth.



I borrowed the term “shape” from numpy which calls it that and which I believe to have good taste.