Get middle C octave convention of the host

It there a clean way to get the octave number convention used by the host?
I would like to show a key name in the plugin interface that matches the DAW piano roll.
For example middle C #60 would be C3 in Juce Host, C4 in Reaper, C5 for FL Studio…

I did not find anything in the documentation that would let me get that info directly, and I guess this would probably vary from one wrapper to another. From what I have seen so far it looks like the only solution is to infer it from PluginHostType, but I would love to be proven wrong here.
By any chance, would there be a list somewhere indicating the middle C octave convention for all existing DAWs?

Here is what I ended up doing, in case anyone faces the same situation:

int getHostDefaultOctaveNumForMiddleC() {
	auto host = juce::PluginHostType::PluginHostType();
	if (
		host.isAbletonLive() ||
		host.isBitwigStudio() ||
		host.isGarageBand() ||
		host.isJUCEPluginHost() ||
		host.isLogic() ||
		host.isProTools() ||
		host.isReason() ||
		host.isSteinberg() ||
		) {
		// Yamaha convention, middle of a 76 keys keyboard
		// lowest octave: -2
		return 3;
	else if (
		host.isTracktion() ||
		host.isViennaEnsemblePro() ||
		) {
		// Roland convention, middle of a 88 keys keyboard
		// lowest octave: -1
		return 4;
	else if (
		host.isRenoise() ||
		host.isSonar() || // cakewalk
		host.isFruityLoops() // FL
		) {
		// lowest octave: 0
		return 5;
	else if (juce::JUCEApplicationBase::isStandaloneApp()) {
		// standalone, let's choose Akai MPC/MPD convention
		return 4;
	else {
		// unknown host
		//return -1;
		return 3; // go with the mass

This works as long as the user did not change the default Middle C setting of his DAW…

1 Like