AudioSampleBuffer::addFromWithRamp


#1

Jules,

Could you add a AudioSampleBuffer::addFromWithRamp method that takes an AudioSamplebuffer and start point, please?

There's an AddFrom with that signature, but I need to ramp it as well.

 

Bruce


#2

I'm failing to see why that'd be useful? It'd only save you a call to getSampleData(), your code wouldn't be significantly simpler (?)


#3

Ah. Here's the thing about the 'ramp' stuff: it's all or nothing. What seems more useful to me is to ramp for 'n' samples, then do a straight addFrom with the rest of the buffer (or however many samples).

So - to answer - it saves me having to get the pointers planes of samples and calculate a pointer offset for each one and build a new array of pointers with the right number of channels pointing at the new pointer positions.

Or am I missing something? What's the reasoning for AddFrom taking a buffer instead of pointers? isn't it the same situation?

Basically I almost always need to use a start position (even more so because I need to split an 'add with crossfade at the head' into two operations (while also doing a 'add with crossfade at the end' on other samples).

Bruce

Edit: I suppose since it's channel by channel, I just need to do a pointer offset of the start position for each one...

Edit again... I see your point. The two versions would be as below. I have to confess that wasn't a lot of work angel

            batch1.buffer->addFromWithRamp ((j * copyOffset) + i,           // dest chan

                                                batch1.startSample,         // dest start (we move this pointer as we mix)

                                                currentMix, i,              // Source buffer, Channel

                                                startPos, firstBatch,

                                                startGain, midGain);

            

            batch1.buffer->addFromWithRamp  ((j * copyOffset) + i,          // dest chan

                                             batch1.startSample,            // dest start (we move this pointer as we mix)

                                             currentMix.getSampleData (i, startPos),

                                             firstBatch,

                                             startGain, midGain);