Cannot use AudioBuffer's constructor

I want to use the constructor AudioBuffer<Type>::AudioBuffer (int numChannelsToAllocate, int numSamplesToAllocate)
But when I wrote:
AudioBuffer<float> buffer(2, 256); it does not recognize that as a constructor, even though AudioBuffer<float> buffer; works
Could anyone tell me why this isn’t working?

What error message did you get?

The error message is “expected a type specifier”

Which compiler?


Could you paste the full error text please?

You can’t declare AudioBuffer with constructor parameters like that as a class member variable, you need to use {} for the initialization :

AudioBuffer<float> buf{ 2, 256 };
1 Like