Should PositionableAudioSource have virtual setLooping()?


#1

PositionableAudioSource has a virtual bool isLooping() const = 0; - should it have a virtual setLooping?

In all implementations of it that I have, both Juce’s and mine, all instances of PositionableAudioSource do in fact have a setLooping method - but a non-virtual one. Since I use looping quite a bit, I have to have code like:[code]// Source is a class that implements PositionableAudioSource
// and has a method void setLooping(bool looping);
template
class MyPositionableAudioSource : public PositionableAudioSource {
public:
MyPositionableAudioSource(Source* source) : source_(source) {}

void setLooping(bool looping) {
source_->setLooping(looping); // Whole class must be generic for just this one line.
}
};[/code]

It doesn’t really make sense to have a getter but no setter for looping - particularly when everything else about PositionableAudioSource is settable! If PositionableAudioSource added a single linevirtual void setLooping(bool looping) {}then it’s almost certain that no existing code would be broken and this asymmetry would be fixed.


#2

Seems like a very reasonable request!


#3

Just a reminder here, hoping to see this tiny, itsy, barely noticeable change get in as part of something more important…

(It’s causing me some slight code agita - I end up with three layers of templating which would all go away… nothing I can’t handle, it’s just… ugly!)


#4

Already done, just not checked in yet, as I’m in the middle of messing about with some other classes… Will be doing a check-in asap!


#5

Damn, you’re fast! :smiley: I shouldn’t have bugged yaz.

This looks like a good week… I’m realizing that I can move my project forward to gcc 4.5 and VC 10 - and finally, finally use all those great C++0x features


#6

I’m jealous! I imagine it’ll be a long time before I can drop support for older compilers and start using those 0x features in Juce…


#7

:frowning: Yes, I was going to make some teasing comment about that but realized it’d be too close to the bone for you.

Well, you have the advantage of being master of your demesne, so it works out.

It’ll be… strange. The auto keyword will be great. I need lambdas - are these the lambdas I’m looking for?


#8

Delegating constructors and in-class member initialisers are my most wanted features, I think.


#9

No delegating constructors in gcc 4.5. :frowning: