summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-03-27 21:50:18 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-03-27 21:50:18 -0400
commit4abbabdcf9c6d6d98ba261d91846577a2fa2f05e (patch)
tree5a7134ccc9508a6f1da25ef3dc6d432bdc25a04f /gtk2_ardour/midi_time_axis.cc
parent78aa7a13fd5e5abac70637ce6641b7d2e73dd541 (diff)
Squashed commit of the following:
commit fdbae82077db53add90df7448a06869dac89acc6 Author: Paul Davis <paul@linuxaudiosystems.com> Date: Wed Mar 27 21:45:28 2013 -0400 mammoth changes in basic signal flow, total redesign of MIDI channel filtering and more. commit 59343a8283698e02bc0f622313b29e98f449e4c8 Author: Paul Davis <paul@linuxaudiosystems.com> Date: Wed Mar 27 01:58:53 2013 -0400 initial working version after changes to MIDI channel filtering. may affect metering input too. testing not yet finished this commit merges many deep changes in ardour's internal architecture, combined with a total redesign of how MIDI channel filtering works. data in a track used to flow from JACK port buffers to diskstream's ringbuffers and was then copied from the ringbuffers into a BufferSet for use during Route::process_output_buffers(). The butler thread would handle the movement of data between the ringbuffers and disk. with this commit, data now flows from JACK port buffers into the BufferSet used for Route processing, and is copied from the BufferSet into the diskstream's ringbuffers (the butler thread continues to handle interactions with disk as usual). this change allowed a dramatic consolidation of code and simplification of most aspects of Track/Route::roll() and Track/Route::no_roll(). in particular, see Route::fill_buffers_with_input() which now concisely describes how we move data from JACK port buffers into the BufferSet for all Route types (including Tracks). this work was initially motivated by changing MIDI channel filtering so that we can process capture and playback independently. there is now a very clean pathway for this - see MidiTrack::roll() (NOTE: This needs implementing in the no-roll case too - a TODO item). the channel selector for MIDI tracks has been moved out of the track header and is now accessible via the context menu. more work is likely here, to make it (more) obvious to the user when filtering is going on.
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc96
1 files changed, 55 insertions, 41 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 9fe3a77450..6c284fa0a0 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -66,6 +66,7 @@
#include "ghostregion.h"
#include "gui_thread.h"
#include "keyboard.h"
+#include "midi_channel_selector.h"
#include "midi_scroomer.h"
#include "midi_streamview.h"
#include "midi_region_view.h"
@@ -94,8 +95,8 @@ using namespace Gtkmm2ext;
using namespace Editing;
// Minimum height at which a control is displayed
-static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 162;
-static const uint32_t KEYBOARD_MIN_HEIGHT = 140;
+static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 130;
+static const uint32_t KEYBOARD_MIN_HEIGHT = 130;
MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
: AxisView(sess) // virtually inherited
@@ -110,6 +111,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, Canvas& can
, _meter_color_mode_item(0)
, _channel_color_mode_item(0)
, _track_color_mode_item(0)
+ , _channel_selector (0)
, _step_edit_item (0)
, controller_menu (0)
, _step_editor (0)
@@ -246,28 +248,19 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
_midi_controls_box.set_border_width (10);
if (!patch_manager.all_models().empty()) {
- _channel_selector.set_border_width(2);
- _channel_selector.show_all ();
-
- _midi_controls_box.resize(3, 2);
- _midi_controls_box.attach(_channel_selector, 0, 2, 0, 1);
-
- _midi_controls_box.attach(*manage(new HSeparator()), 0, 2, 1, 2);
+ _midi_controls_box.resize(2, 2);
_midnam_model_selector.set_size_request(22, 30);
_midnam_model_selector.set_border_width(2);
_midnam_model_selector.show ();
- _midi_controls_box.attach(_midnam_model_selector, 0, 1, 2, 3);
+ _midi_controls_box.attach(_midnam_model_selector, 0, 1, 0, 1);
_midnam_custom_device_mode_selector.set_size_request(10, 30);
_midnam_custom_device_mode_selector.set_border_width(2);
_midnam_custom_device_mode_selector.show ();
- _midi_controls_box.attach(_midnam_custom_device_mode_selector, 0, 1, 3, 4);
- } else {
- _midi_controls_box.attach(_channel_selector, 0, 1, 0, 1);
- _channel_selector.show_all ();
- }
+ _midi_controls_box.attach(_midnam_custom_device_mode_selector, 0, 1, 1, 2);
+ }
model_changed();
custom_device_mode_changed();
@@ -279,19 +272,11 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
controls_vbox.pack_start(_midi_controls_box, false, false);
- // restore channel selector settings
- _channel_selector.set_channel_mode(midi_track()->get_channel_mode(),
- midi_track()->get_channel_mask());
- _channel_selector.mode_changed.connect(
- sigc::mem_fun(*midi_track(), &MidiTrack::set_channel_mode));
- _channel_selector.mode_changed.connect(
- sigc::mem_fun(*this, &MidiTimeAxisView::set_channel_mode));
-
const string color_mode = gui_property ("color-mode");
if (!color_mode.empty()) {
_color_mode = ColorMode (string_2_enum(color_mode, _color_mode));
- if (_color_mode == ChannelColors) {
- _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+ if (_channel_selector && _color_mode == ChannelColors) {
+ _channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
}
}
@@ -334,6 +319,8 @@ MidiTimeAxisView::first_idle ()
MidiTimeAxisView::~MidiTimeAxisView ()
{
+ delete _channel_selector;
+
delete _piano_roll_header;
_piano_roll_header = 0;
@@ -468,11 +455,36 @@ MidiTimeAxisView::append_extra_display_menu_items ()
items.push_back (MenuElem (_("Note Range"), *range_menu));
items.push_back (MenuElem (_("Note Mode"), *build_note_mode_menu()));
+ items.push_back (MenuElem (_("Channel Selector"),
+ sigc::mem_fun(*this, &MidiTimeAxisView::toggle_channel_selector)));
+ color_mode_menu = build_color_mode_menu();
+ if (color_mode_menu) {
+ items.push_back (MenuElem (_("Color Mode"), *color_mode_menu));
+ }
+
items.push_back (SeparatorElem ());
}
void
+MidiTimeAxisView::toggle_channel_selector ()
+{
+ if (!_channel_selector) {
+ _channel_selector = new MidiChannelSelectorWindow (midi_track());
+
+ if (_color_mode == ChannelColors) {
+ _channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+ } else {
+ _channel_selector->set_default_channel_color ();
+ }
+
+ _channel_selector->show_all ();
+ } else {
+ _channel_selector->cycle_visibility ();
+ }
+}
+
+void
MidiTimeAxisView::build_automation_action_menu (bool for_selection)
{
using namespace Menu_Helpers;
@@ -493,7 +505,7 @@ MidiTimeAxisView::build_automation_action_menu (bool for_selection)
MenuList& automation_items = automation_action_menu->items();
- uint16_t selected_channels = _channel_selector.get_selected_channels();
+ uint16_t selected_channels = midi_track()->get_playback_channel_mask();
if (selected_channels != 0) {
@@ -537,7 +549,7 @@ MidiTimeAxisView::build_automation_action_menu (bool for_selection)
void
MidiTimeAxisView::change_all_channel_tracks_visibility (bool yn, Evoral::Parameter param)
{
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
for (uint8_t chn = 0; chn < 16; chn++) {
if (selected_channels & (0x0001 << chn)) {
@@ -564,7 +576,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
structure if there is more than 1 selected.
*/
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
int chn_cnt = 0;
for (uint8_t chn = 0; chn < 16; chn++) {
@@ -665,7 +677,7 @@ MidiTimeAxisView::add_single_channel_controller_item(Menu_Helpers::MenuList& ctl
{
using namespace Menu_Helpers;
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
for (uint8_t chn = 0; chn < 16; chn++) {
if (selected_channels & (0x0001 << chn)) {
@@ -706,7 +718,7 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
{
using namespace Menu_Helpers;
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
Menu* chn_menu = manage (new Menu);
MenuList& chn_items (chn_menu->items());
@@ -804,7 +816,7 @@ MidiTimeAxisView::build_controller_menu ()
combination covering the currently selected channels for this track
*/
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
/* count the number of selected channels because we will build a different menu
structure if there is more than 1 selected.
@@ -982,10 +994,12 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo
return;
}
- if (mode == ChannelColors) {
- _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
- } else {
- _channel_selector.set_default_channel_color();
+ if (_channel_selector) {
+ if (mode == ChannelColors) {
+ _channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+ } else {
+ _channel_selector->set_default_channel_color();
+ }
}
_color_mode = mode;
@@ -1168,7 +1182,7 @@ MidiTimeAxisView::set_note_selection (uint8_t note)
return;
}
- uint16_t chn_mask = _channel_selector.get_selected_channels();
+ uint16_t chn_mask = midi_track()->get_playback_channel_mask();
if (_view->num_selected_regionviews() == 0) {
_view->foreach_regionview (
@@ -1188,7 +1202,7 @@ MidiTimeAxisView::add_note_selection (uint8_t note)
return;
}
- const uint16_t chn_mask = _channel_selector.get_selected_channels();
+ const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
if (_view->num_selected_regionviews() == 0) {
_view->foreach_regionview (
@@ -1208,7 +1222,7 @@ MidiTimeAxisView::extend_note_selection (uint8_t note)
return;
}
- const uint16_t chn_mask = _channel_selector.get_selected_channels();
+ const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
if (_view->num_selected_regionviews() == 0) {
_view->foreach_regionview (
@@ -1228,7 +1242,7 @@ MidiTimeAxisView::toggle_note_selection (uint8_t note)
return;
}
- const uint16_t chn_mask = _channel_selector.get_selected_channels();
+ const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
if (_view->num_selected_regionviews() == 0) {
_view->foreach_regionview (
@@ -1272,7 +1286,7 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
the right ones.
*/
- const uint16_t selected_channels = _channel_selector.get_selected_channels();
+ const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
bool changed = false;
no_redraw = true;
@@ -1392,7 +1406,7 @@ MidiTimeAxisView::stop_step_editing ()
uint8_t
MidiTimeAxisView::get_channel_for_add () const
{
- uint16_t const chn_mask = _channel_selector.get_selected_channels ();
+ uint16_t const chn_mask = midi_track()->get_playback_channel_mask();
int chn_cnt = 0;
uint8_t channel = 0;