Synthesiser::setCurrentPlaybackSampleRate should be virtual?


#1

It is just a suggestion - should not be the Synthesiser::setCurrentPlaybackSampleRate virtual by default? Sometimes it would be handy to process some more specific stuff when sample rate changes. Yes I can do it in forked JUCE, but it is a proposal for original distribution. 

Please prove me wrong if I am missing something :)


#2

Yep, I guess I could do that.


#3

Cool, that would be awesome :)


#4

I think to make it consistent it would be cool to have the sample rate function virtual in SynthesiserVoice as well... While I am thinking about that this could be usefull at least the same as to have virtual method in Synthesiser class. 


#5

I already did that, didn't I?


#6

Yes, Jules, you made Synthesiser class method virtual. Thank you! I mean it would be cool to make SynthesiserVoice virtual as well. What do you think?


#7

To be accurate I mean this method: SynthesiserVoice::setCurrentPlaybackSampleRate(double newRate)


#8

Huh? Like I said, I made that method virtual in SynthesiserVoice too. If that's not what you mean, you need to explain more clearly what you're trying to say.


#9

Yes, you did it! Sorry, I just checked the commit log not the diff! angel  In commit log there is message "Made Synthesiser::setCurrentPlaybackSampleRate virtual." while the commit contains both changes - for Synthesiser and SynthesiserVioce. enlightened Thank you once again!


#10

Hm... Does the Synthesiser class have any getCurrentSamplePlaybackRate() function? It would be handy to have it or at least if the sampleRate variable would be protected...


#11

It's available to in the synthesiservoice class. That's generally where you need to do the processing, so seems like the best place for it, though I agree there's no reason why it couldn't also be added to the synthesiser class.


#12

Yeah, the SynthesiserVoice solution came on my mind as well. But in case of having no voices allocated it would be needed (although it won't happen much I assume...)


#13

But I didn't realize that SynthesiserVoice::getSampleRate() is protected. So there is no way to know at Synthesiser's child class its sample rate AFAIK. Or I am wrong?


#14

I was just doing some other work on the synthesiser class so have refactored this - have a look now.


#15

Yes, thank you very much, Jules!