diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2012-10-11 06:32:09 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2012-10-11 06:32:09 +0000 |
commit | 617720539880e62e838f6215c719e5129f98b140 (patch) | |
tree | bdf408afefb2106296d71c2515cbd0f608954db0 | |
parent | f61f973f87d7c20274be305a10a4493aea02e130 (diff) |
Make input filtering while recording work in GUI, too
git-svn-id: svn://localhost/ardour2/branches/3.0@13244 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/midi_channel_selector.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 22 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/gtk2_ardour/midi_channel_selector.h b/gtk2_ardour/midi_channel_selector.h index c5e6a5a378..d1a43ff9b7 100644 --- a/gtk2_ardour/midi_channel_selector.h +++ b/gtk2_ardour/midi_channel_selector.h @@ -81,6 +81,7 @@ public: sigc::signal<void, ARDOUR::ChannelMode, uint16_t> mode_changed; void set_channel_mode(ARDOUR::ChannelMode mode, uint16_t mask); + ARDOUR::ChannelMode get_channel_mode () const { return _channel_mode; } /** * @return each bit in the returned word represents a midi channel, eg. diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 5d972fa85e..ac982a3040 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -116,6 +116,13 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView & _note_group->raise_to_top(); PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys)); + + MidiTimeAxisView *time_axis = dynamic_cast<MidiTimeAxisView *>(&tv); + if (time_axis) { + _last_channel_mode = time_axis->channel_selector().get_channel_mode(); + _last_channel_selection = time_axis->channel_selector().get_selected_channels(); + } + Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context()); connect_to_diskstream (); @@ -153,6 +160,12 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView & _note_group->raise_to_top(); PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys)); + MidiTimeAxisView *time_axis = dynamic_cast<MidiTimeAxisView *>(&tv); + if (time_axis) { + _last_channel_mode = time_axis->channel_selector().get_channel_mode(); + _last_channel_selection = time_axis->channel_selector().get_selected_channels(); + } + connect_to_diskstream (); SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ()); @@ -3247,6 +3260,7 @@ MidiRegionView::midi_channel_mode_changed(ChannelMode mode, uint16_t mask) } _last_channel_selection = mask; + _last_channel_mode = mode; _patch_changes.clear (); display_patch_changes (); @@ -3701,6 +3715,14 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w) Evoral::MIDIEvent<MidiBuffer::TimeType> const ev (*i, false); assert (ev.buffer ()); + if(ev.is_channel_event()) { + if (_last_channel_mode == FilterChannels) { + if(((uint16_t(1) << ev.channel()) & _last_channel_selection) == 0) { + continue; + } + } + } + /* ev.time() is in session frames, so (ev.time() - converter.origin_b()) is frames from the start of the source, and so time_beats is in terms of the source. diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index ac0736949d..65d8855093 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -379,7 +379,9 @@ private: void show_verbose_cursor (std::string const &, double, double) const; void show_verbose_cursor (boost::shared_ptr<NoteType>) const; + ARDOUR::ChannelMode _last_channel_mode; uint16_t _last_channel_selection; + uint8_t _current_range_min; uint8_t _current_range_max; |