AudioSampleBuffer::AudioSampleBuffer(const AudioSampleBuffer & other) doesn't copy the buffer anymore ?


#1

Is it me or the copy constructor of AudioSampleBuffer ( AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer &  other)) used in a processBlock method doesn't copy the data anymore (since a couple of juce modules versions) ? 

More precisely, it seems to be because "allocateBytes" is 0 

 


#2

Hmm. Thanks, will investigate..


#3

FYI:

    /** Copies another buffer.

        This buffer will make its own copy of the other's data, unless the buffer was created
        using an external data buffer, in which case boths buffers will just point to the same
        shared block of data.
    */
    AudioSampleBuffer (const AudioSampleBuffer& other) noexcept;

#4

I have temporarly reverted this change (ASB) in my code, I havn't invastigated this thoroughly but in

release mode my code sometimes hangs (after using the AudioTransportSource )

In debug mode it works well.

I've looked for places where I use the revised copy constructor but didn't find any.

I'm interested if anyone else has the same issue.

 

 

 


#5

I've looked for places where I use the revised copy constructor but didn't find any.

you'd find it pretty quickly if you just make that constructor private and try to compile your app.


#6

Thanks that did the job.

I found that I had a function the returned the ASB thus implicitly calling the copy constructor.


#7

I'm not sure I understand the logic behind the "new" behaviour... I found it very convenient to just be able to write

AudioSampleBuffer B = A;

to create an independent copy of A, where A was, for instance, the buffer given to me in processBlock. Now, depending on how A was created (how am I supposed to know this? ) this may or may not create merely a reference to A. Moreover, if I write

AudioSampleBuffer B;

B = A;

I get a different result. I know, I know, copy constructor vs. assignment constructor etc., but this seems to have the potential for a lot of confusion... I'd expect the copy of a buffer to always have its own channel data.