EngineBehaviour::getMiddleCOctave() Not Used Where it Ought to Be

tracktion_EngineBehaviour.h defines getMiddleOctave(), which returns the magic number 4, while juce_MidiMessage.cpp, when calling MidiMessage::getMidiNoteName(), uses the magic number 3 to determine the middle c octave value.

tracktion_EngineBehaviour also defines setMiddleOctave() which I think only gives the compiler’s optimiser a little exercise:

    virtual void setMiddleCOctave (int /*newOctave*/)                               {}

Now I’m putting together that Track Engine and JUCE are not the same thing when it comes to bug fixes etc… I guess that it might not be possible to juce_MidiMessage.cpp, and that within the context of calling MidiMessage::getDescription() there won’t be an instance of engine anyways, but…

Three things:

  1. If the return value is always 4 (or possibly 3, or 5(!)) could this be a static function?
  2. Could we let setMiddleCOctave() do it’s thing?
  3. Could there be an option in Projucer to set the default value for the middle C octave with a Preprocessor Directive? It would be nice to have the confidence in setting this system wide if it’s a stable value, and the ability to change it everywhere at once should the need arise.

P.S. I wasn’t sure where to put this post since it’s sort of at the intersection of Tracktion Engine and JUCE.

The idea is you subclass EngineBehaviour and return the value you want. For legacy reasons, Tracktion uses 4 by default, but it is configurable. If in your app you want 3, override getMiddleCOctave and return 3. It can’t be a static function, or there would be no way to override.