AudioSampleBuffer::setSample performance worse than using a write pointer?


#1

i notice that all the Juce audio demos i have seen write to the AudioSampleBuffer by getting a write pointer and then stepping the pointer forward while the block is written. 

is there a big performance bonus for doing it this way?  if i just wanna avoid the pointers and use AudioSampleBuffer::setSample, is that going to be significantly slower?

 

 

 


#2

If you look inside setSample, you'll see there's a lot of asserting and recalculation of addresses each time you call it. So yes, there's a big overhead, but it may not be a problem for your code in a release build.