summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-08-25 21:05:23 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-09-27 14:59:31 -0500
commit2810e5619a1926a286c6192143ada4973066efd8 (patch)
treedb1db70bf3a78993d3e4f99ce728d4342704be31 /libs/surfaces
parentb822d8be366f39663b2fc50e128557b4d3f18f42 (diff)
push2: provide basic GUI control for pressure mode
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/push2/gui.cc48
-rw-r--r--libs/surfaces/push2/gui.h14
-rw-r--r--libs/surfaces/push2/push2.cc3
3 files changed, 64 insertions, 1 deletions
diff --git a/libs/surfaces/push2/gui.cc b/libs/surfaces/push2/gui.cc
index dba7bb909a..54bf723288 100644
--- a/libs/surfaces/push2/gui.cc
+++ b/libs/surfaces/push2/gui.cc
@@ -90,6 +90,7 @@ P2GUI::P2GUI (Push2& p)
, mode_label (_("Mode (Scale)"))
, inkey_button (_("In-Key Mode"))
, mode_packer (3, 3)
+ , pressure_mode_label (_("Pressure Mode"))
{
set_border_width (12);
@@ -131,6 +132,10 @@ P2GUI::P2GUI (Push2& p)
table.attach (output_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
row++;
+ table.attach (pressure_mode_label, 0, 1, row, row+1, AttachOptions (0), AttachOptions (0));
+ table.attach (pressure_mode_selector, 1, 2, row, row+1, AttachOptions (FILL|EXPAND), AttachOptions (0));
+ row++;
+
hpacker.pack_start (table, true, true);
pad_table.set_spacings (3);
@@ -163,6 +168,11 @@ P2GUI::P2GUI (Push2& p)
pad_notebook.append_page (mode_packer, _("Modes/Scales"));
pad_notebook.append_page (custom_packer, _("Custom"));
+ pressure_mode_selector.set_model (build_pressure_mode_columns());
+ pressure_mode_selector.pack_start (pressure_mode_columns.name);
+ pressure_mode_selector.set_active ((int) p2.pressure_mode());
+ pressure_mode_selector.signal_changed().connect (sigc::mem_fun (*this, &P2GUI::reprogram_pressure_mode));
+
root_note_octave_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &P2GUI::reprogram_pad_scale));
root_note_selector.signal_changed().connect (sigc::mem_fun (*this, &P2GUI::reprogram_pad_scale));
mode_selector.signal_changed().connect (sigc::mem_fun (*this, &P2GUI::reprogram_pad_scale));
@@ -465,6 +475,23 @@ P2GUI::build_pad_table ()
}
Glib::RefPtr<Gtk::ListStore>
+P2GUI::build_pressure_mode_columns ()
+{
+ Glib::RefPtr<Gtk::ListStore> store = ListStore::create (pressure_mode_columns);
+ TreeModel::Row row;
+
+ row = *store->append();
+ row[pressure_mode_columns.name] = _("AfterTouch (Channel Pressure)");
+ row[pressure_mode_columns.mode] = Push2::AfterTouch;
+
+ row = *store->append();
+ row[pressure_mode_columns.name] = _("Polyphonic Pressure (Note Pressure)");
+ row[pressure_mode_columns.mode] = Push2::PolyPressure;
+
+ return store;
+}
+
+Glib::RefPtr<Gtk::ListStore>
P2GUI::build_mode_columns ()
{
Glib::RefPtr<Gtk::ListStore> store = ListStore::create (mode_columns);
@@ -720,3 +747,24 @@ P2GUI::reprogram_pad_scale ()
p2.set_pad_scale (root, octave, mode, inkey);
}
+
+void
+P2GUI::reprogram_pressure_mode ()
+{
+ Gtk::TreeModel::iterator iter = pressure_mode_selector.get_active();
+ Push2::PressureMode pm;
+
+ if (iter) {
+ Gtk::TreeModel::Row row = *iter;
+ if (row) {
+ pm = row[pressure_mode_columns.mode];
+ } else {
+ pm = Push2::AfterTouch;
+ }
+ } else {
+ pm = Push2::AfterTouch;
+ }
+
+ cerr << "Reprogram pm to " << pm << endl;
+ p2.set_pressure_mode (pm);
+}
diff --git a/libs/surfaces/push2/gui.h b/libs/surfaces/push2/gui.h
index b472698fee..8d8829c260 100644
--- a/libs/surfaces/push2/gui.h
+++ b/libs/surfaces/push2/gui.h
@@ -143,7 +143,21 @@ private:
Gtk::Table mode_packer;
Gtk::VBox custom_packer;
+ struct PressureModeColumns : public Gtk::TreeModel::ColumnRecord {
+ PressureModeColumns() {
+ add (mode);
+ add (name);
+ }
+ Gtk::TreeModelColumn<Push2::PressureMode> mode;
+ Gtk::TreeModelColumn<std::string> name;
+ };
+ PressureModeColumns pressure_mode_columns;
+ Glib::RefPtr<Gtk::ListStore> build_pressure_mode_columns ();
+ Gtk::ComboBox pressure_mode_selector;
+ Gtk::Label pressure_mode_label;
+
void reprogram_pad_scale ();
+ void reprogram_pressure_mode ();
};
}
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc
index d91cf5cfe8..caa3f1e102 100644
--- a/libs/surfaces/push2/push2.cc
+++ b/libs/surfaces/push2/push2.cc
@@ -1304,7 +1304,7 @@ Push2::pad_filter (MidiBuffer& in, MidiBuffer& out) const
matched = true;
}
- } else if ((*ev).is_pitch_bender() || (*ev).is_aftertouch() || (*ev).is_channel_pressure()) {
+ } else if ((*ev).is_pitch_bender() || (*ev).is_poly_pressure() || (*ev).is_channel_pressure()) {
out.push_back (*ev);
}
}
@@ -1780,4 +1780,5 @@ Push2::set_pressure_mode (PressureMode pm)
}
write (msg);
+ cerr << "Sent PM message " << msg << endl;
}