mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
push2: provide basic GUI control for pressure mode
This commit is contained in:
parent
b822d8be36
commit
2810e5619a
3 changed files with 64 additions and 1 deletions
|
|
@ -90,6 +90,7 @@ P2GUI::P2GUI (Push2& p)
|
||||||
, mode_label (_("Mode (Scale)"))
|
, mode_label (_("Mode (Scale)"))
|
||||||
, inkey_button (_("In-Key Mode"))
|
, inkey_button (_("In-Key Mode"))
|
||||||
, mode_packer (3, 3)
|
, mode_packer (3, 3)
|
||||||
|
, pressure_mode_label (_("Pressure Mode"))
|
||||||
{
|
{
|
||||||
set_border_width (12);
|
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);
|
table.attach (output_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0);
|
||||||
row++;
|
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);
|
hpacker.pack_start (table, true, true);
|
||||||
|
|
||||||
pad_table.set_spacings (3);
|
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 (mode_packer, _("Modes/Scales"));
|
||||||
pad_notebook.append_page (custom_packer, _("Custom"));
|
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_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));
|
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));
|
mode_selector.signal_changed().connect (sigc::mem_fun (*this, &P2GUI::reprogram_pad_scale));
|
||||||
|
|
@ -464,6 +474,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>
|
Glib::RefPtr<Gtk::ListStore>
|
||||||
P2GUI::build_mode_columns ()
|
P2GUI::build_mode_columns ()
|
||||||
{
|
{
|
||||||
|
|
@ -720,3 +747,24 @@ P2GUI::reprogram_pad_scale ()
|
||||||
|
|
||||||
p2.set_pad_scale (root, octave, mode, inkey);
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,21 @@ private:
|
||||||
Gtk::Table mode_packer;
|
Gtk::Table mode_packer;
|
||||||
Gtk::VBox custom_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_pad_scale ();
|
||||||
|
void reprogram_pressure_mode ();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1304,7 +1304,7 @@ Push2::pad_filter (MidiBuffer& in, MidiBuffer& out) const
|
||||||
|
|
||||||
matched = true;
|
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);
|
out.push_back (*ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1780,4 +1780,5 @@ Push2::set_pressure_mode (PressureMode pm)
|
||||||
}
|
}
|
||||||
|
|
||||||
write (msg);
|
write (msg);
|
||||||
|
cerr << "Sent PM message " << msg << endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue