diff --git a/libs/ardour/ardour/parameter_descriptor.h b/libs/ardour/ardour/parameter_descriptor.h index 234a29b0c6..3695eadc4f 100644 --- a/libs/ardour/ardour/parameter_descriptor.h +++ b/libs/ardour/ardour/parameter_descriptor.h @@ -50,7 +50,7 @@ struct LIBARDOUR_API ParameterDescriptor : public Evoral::ParameterDescriptor HZ, ///< Frequency in Hertz }; - static std::string midi_note_name (uint8_t, bool translate=true); + static std::string midi_note_name (uint8_t, bool translate = true, bool with_octave = true); /** Dual of midi_note_name, convert a note name into its midi note number. */ typedef std::map NameNumMap; diff --git a/libs/ardour/parameter_descriptor.cc b/libs/ardour/parameter_descriptor.cc index 17dbde3d3b..0a47c87a26 100644 --- a/libs/ardour/parameter_descriptor.cc +++ b/libs/ardour/parameter_descriptor.cc @@ -252,7 +252,7 @@ ParameterDescriptor::update_steps() } std::string -ParameterDescriptor::midi_note_name (const uint8_t b, bool translate) +ParameterDescriptor::midi_note_name (const uint8_t b, bool translate, bool with_octave) { char buf[16]; if (b > 127) { @@ -279,9 +279,14 @@ ParameterDescriptor::midi_note_name (const uint8_t b, bool translate) S_("Note|B") }; - /* MIDI note 0 is in octave -1 (in scientific pitch notation) */ - const int octave = b / 12 - 1; const size_t p = b % 12; + + /* MIDI note 0 is in octave -1 (in scientific pitch notation) */ + if (!with_octave) { + return translate ? notes[p] : en_notes[p]; + } + + const int octave = b / 12 - 1; snprintf (buf, sizeof (buf), "%s%d", translate ? notes[p] : en_notes[p], octave); return buf; }