AudioSampleBuffer questions


#1

Just to make sure i have’nt gone insane i need some answers about AudioSampleBuffers.

clear() : Does that set all values in the buffer to zero ? Or does it delete the buffer (i think not but i could have gone insane).

addFrom() : This is the same as mixing ? It adds a value to the value that was there previously.

copyFrom() : This is the same as replacing ? It replaces the value with a new one.

clear() is the same as applyGain() with a gain of 0.0f

I just need to doublecheck 'cause i have a bug that is driving me insane.
I’ve been trying to track it down for 24 hours now and maybe i’ve misunderstood some functions.


#2

some explanation:

clear() : does set all value of the buffer to 0.0f

addFrom() : it will mix from a source buffer to the buffer is calling

copyFrom() : it will replace the buffer calling it with a source buffer

clear() is the same as applyGain() with a gain of 0.0f of course (but clear will be much more faster)


#3

[quote=“kraken”]some explanation:

clear() : does set all value of the buffer to 0.0f

addFrom() : it will mix from a source buffer to the buffer is calling

copyFrom() : it will replace the buffer calling it with a source buffer

clear() is the same as applyGain() with a gain of 0.0f of course (but clear will be much more faster)[/quote]
Ok,thanks. That’s what i thought. I have this weird FFT/iFFT problem i can’t track down.

Basically i have wavetable with 16 waves,the first and last is a sine wave. I can load new waves and it does a DFT of the wave and calculates all the waves in between. And the iDFT works for all waves except the one i just loaded!

It gets set to zero. It still calculates all the other waves correctly although with a wave that’s all zeroes. Weird stuff indeed.

So i needed a sanity check to see if the functions did what i thought they did. And according to you that is indeed the case.

Ok, back to the lab. Thanks again for the quick answer.

EDIT: Just found the bug!!! Not sure why it happens but at least i have a temporary solution for it. :slight_smile:


#4