Synthesise Question


I’m wondering what does this line exactly do and why is it necessary. Can I not just have return true; ?

return dynamic_cast<SynthSound*>(sound) != nullptr;

#include “SynthVoice.h”





bool SynthVoice::canPlaySound (SynthesiserSound* sound){
return dynamic_cast<SynthSound*>(sound) != nullptr;


Yeah, you could just return true if you can be sure your synthesiser only deals with one particular synth sound type.


Thanks. What do you mean by synth type? like if I’m using several synth sound classes? would you ever need to use more than one?


Maybe, if you would be doing a synth that can play different sounds on the bass notes and different sounds on the treble notes or something. But it doesn’t seem to be a particularly common thing to need to use multiple sound classes.


I see thank you