13
0

add an option to control the maximum MIDI note height (not yet GUI exposed)

This commit is contained in:
Paul Davis 2023-02-05 11:36:24 -07:00
parent 0bce5d24de
commit 2756be4b62
4 changed files with 18 additions and 1 deletions

View File

@ -99,6 +99,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
color_handler ();
UIConfiguration::instance().ColorsChanged.connect(sigc::mem_fun(*this, &MidiStreamView::color_handler));
UIConfiguration::instance().ParameterChanged.connect(sigc::mem_fun(*this, &MidiStreamView::parameter_changed));
note_range_adjustment.set_page_size(_highest_note - _lowest_note);
note_range_adjustment.set_value(_lowest_note);
@ -111,6 +112,16 @@ MidiStreamView::~MidiStreamView ()
{
}
void
MidiStreamView::parameter_changed (string const & param)
{
if (param == X_("max-note-height")) {
apply_note_range_to_regions ();
} else {
StreamView::parameter_changed (param);
}
}
RegionView*
MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, bool recording)
{
@ -402,7 +413,8 @@ MidiStreamView::apply_note_range(uint8_t lowest, uint8_t highest, bool to_region
float uiscale = UIConfiguration::instance().get_ui_scale();
uiscale = expf (uiscale) / expf (1.f);
int const max_note_height = std::max<int> (20, 20 * uiscale);
const int mnh = UIConfiguration::instance().get_max_note_height();
int const max_note_height = std::max<int> (mnh, mnh * uiscale);
int const range = _highest_note - _lowest_note;
int const pixels_per_note = floor (child_height () / range);

View File

@ -116,6 +116,8 @@ public:
ArdourCanvas::Container* midi_underlay () const { return _midi_underlay; }
ArdourCanvas::Container* region_canvas () const { return _region_group; }
void parameter_changed (std::string const &);
protected:
void setup_rec_box ();
void update_rec_box ();

View File

@ -87,6 +87,8 @@
[link-region-and-track-selection]
[lock-gui-after-seconds]
lock
[max-note-height]
maximum note height theme appearance size visible range
[max-inline-controls]
plugins mixer-strip controls inline
[max-plugin-chart]

View File

@ -145,6 +145,7 @@ UI_CONFIG_VARIABLE (int, default_lower_midi_note, "default-lower-midi-note", 60)
UI_CONFIG_VARIABLE (int, default_upper_midi_note, "default-upper-midi-note", 71)
UI_CONFIG_VARIABLE (bool, ask_before_closing_last_window, "ask-before-closing-last-window", true)
UI_CONFIG_VARIABLE (std::string, freesound_dir, "freesound-dir", "")
UI_CONFIG_VARIABLE (int, max_note_height, "max-note-height", 20)
/* these are visibility-type selections in the New Track dialog that we should make persistent for the user's choices */
UI_CONFIG_VARIABLE (bool, show_on_cue_page, "show-on-cue-page", true)