mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 09:06:33 +01:00
get note display working in pianoroll PRH (needs set_visible_channel())
This commit is contained in:
parent
2ac2a4fd4c
commit
15079176ac
3 changed files with 23 additions and 16 deletions
|
|
@ -357,6 +357,21 @@ MidiView::set_region (std::shared_ptr<MidiRegion> mr)
|
||||||
set_model (_midi_region->midi_source (0)->model());
|
set_model (_midi_region->midi_source (0)->model());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
MidiView::pick_visible_channel () const
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
while (n < 16) {
|
||||||
|
if (_model->channels_present() & (1 << n)) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
++n;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiView::set_model (std::shared_ptr<MidiModel> m)
|
MidiView::set_model (std::shared_ptr<MidiModel> m)
|
||||||
{
|
{
|
||||||
|
|
@ -374,22 +389,7 @@ MidiView::set_model (std::shared_ptr<MidiModel> m)
|
||||||
|
|
||||||
//set_height (trackview.current_height());
|
//set_height (trackview.current_height());
|
||||||
|
|
||||||
if (_show_source) {
|
set_visible_channel (pick_visible_channel());
|
||||||
int n = 0;
|
|
||||||
|
|
||||||
while (n < 16) {
|
|
||||||
if (_model->channels_present() & (1 << n)) {
|
|
||||||
set_visible_channel (n);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++n;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n == 16) {
|
|
||||||
/* No channel data in model, use channel 0 (1) */
|
|
||||||
set_visible_channel (0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_model->ContentsChanged.connect (connections_requiring_model, invalidator (*this), std::bind (&MidiView::model_changed, this), gui_context());
|
_model->ContentsChanged.connect (connections_requiring_model, invalidator (*this), std::bind (&MidiView::model_changed, this), gui_context());
|
||||||
|
|
||||||
|
|
@ -5359,6 +5359,10 @@ MidiView::set_visibility_note_range (MidiViewBackground::VisibleNoteRange nvr, b
|
||||||
void
|
void
|
||||||
MidiView::set_visible_channel (int chn, bool clear_selection)
|
MidiView::set_visible_channel (int chn, bool clear_selection)
|
||||||
{
|
{
|
||||||
|
if (!_show_source) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_visible_channel = chn;
|
_visible_channel = chn;
|
||||||
VisibleChannelChanged(); /* EMIT SIGNAL */
|
VisibleChannelChanged(); /* EMIT SIGNAL */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger
|
||||||
|
|
||||||
int visible_channel() const { return _visible_channel; }
|
int visible_channel() const { return _visible_channel; }
|
||||||
void set_visible_channel (int, bool clear_selection = true);
|
void set_visible_channel (int, bool clear_selection = true);
|
||||||
|
int pick_visible_channel () const;
|
||||||
PBD::Signal<void()> VisibleChannelChanged;
|
PBD::Signal<void()> VisibleChannelChanged;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -2564,6 +2564,8 @@ Pianoroll::set_region (std::shared_ptr<ARDOUR::MidiRegion> r)
|
||||||
view->show_start (true);
|
view->show_start (true);
|
||||||
view->show_end (true);
|
view->show_end (true);
|
||||||
|
|
||||||
|
set_visible_channel (view->pick_visible_channel());
|
||||||
|
|
||||||
r->DropReferences.connect (object_connections, invalidator (*this), std::bind (&Pianoroll::unset, this, false), gui_context());
|
r->DropReferences.connect (object_connections, invalidator (*this), std::bind (&Pianoroll::unset, this, false), gui_context());
|
||||||
r->PropertyChanged.connect (object_connections, invalidator (*this), std::bind (&Pianoroll::region_prop_change, this, _1), gui_context());
|
r->PropertyChanged.connect (object_connections, invalidator (*this), std::bind (&Pianoroll::region_prop_change, this, _1), gui_context());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue