Difference between samples per block and buffer size


#1

What is the difference between the samples per block value in the prepareToPlay function and the size of the buffer that is passed to the processBlock function?. I thought both where the same but on Fl Studio I get different values and I’m getting insane cpu values because of this.


#2

The one in prepareToPlay is an upper limit, so you can allocate enough space. Always work with the actual one in processBlock…


#3

Thanks! for the response! But I was debugging and I also discovered another issue, Fl Studio uses multiple block sizes that spike the cpu use.


#4

To measure CPU usage, you should a) use a release build and b) use a profiler, not the overall meter… it is a rough number for a start, but to actually trim your code, there is no way around the profiler and measuring the release build (XCode Instruments e.g.)

Sorry if I got you wrong, but since you said debugging, I was assuming you are looking at a debug build…


#5

Thank you, and yes I was using a debug build! I’ll try that