AudioSampleBuffer members protected


#1

Hi Jules, I have a subclass of AudioSampleBuffer that needs to change channels etc. Thus the members of AudioSampleBuffer needs to be protected rather than private (an alternative to this would be the possiblity to change what data the AudioSampleBuffer points to after it is constructed).

This is also applicable over JUCE generally, as JUCE is a framework library. It is rather likely, if not extremely likely, that somewhere, sometime a class needs to be subclassed. Private pretty much stops this cold.

TIA
/R


#2

Yeah, I see your point, but the AudioSampleBuffer is a bad example because it’s quite complicated in the way it uses its data, so I’d rather keep it out of sight.

Can you suggest a method that’d let you do what you want to do?


#3

[quote=“jules”]Yeah, I see your point, but the AudioSampleBuffer is a bad example because it’s quite complicated in the way it uses its data, so I’d rather keep it out of sight.

Can you suggest a method that’d let you do what you want to do?[/quote]

Sure:

Btw, the virtual is important, as I need to override it (I have extra data that is dependant on numSamples).


#4

Ok, I could add that method, but not the virtual - I’ve been trying to keep that class as a light, non-virtual container object. Surely you can do anything you need to do to the data before you call it?


#5

You’re right, it’s not necessary. I can do that update in an other method.


#6

Ok, well I’ve checked that new method in now…


#7