MCP: catch noteOff to see note-on+velocity=zero messages; more GUI tweaks
git-svn-id: svn://localhost/ardour2/branches/3.0@11966 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -193,9 +193,7 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cerr << "real lkeyval: " << ev->keyval << endl;
|
||||
Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (ev->keyval);
|
||||
cerr << "using keyval = " << ev->keyval << endl;
|
||||
|
||||
|
||||
bool result = AccelMap::change_entry (path,
|
||||
@@ -203,8 +201,6 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
|
||||
ModifierType (Keyboard::RelevantModifierKeyMask & ev->state),
|
||||
true);
|
||||
|
||||
cerr << "New binding to " << ev->keyval << " worked: " << result << endl;
|
||||
|
||||
if (result) {
|
||||
AccelKey key;
|
||||
(*i)[columns.binding] = ActionManager::get_key_representation (path, key);
|
||||
|
||||
@@ -96,6 +96,19 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p)
|
||||
function_key_scroller.show_all();
|
||||
}
|
||||
|
||||
CellRendererCombo*
|
||||
MackieControlProtocolGUI::make_action_renderer (Glib::RefPtr<TreeStore> model, Gtk::TreeModelColumnBase column)
|
||||
{
|
||||
CellRendererCombo* renderer = manage (new CellRendererCombo);
|
||||
renderer->property_model() = model;
|
||||
renderer->property_editable() = true;
|
||||
renderer->property_text_column() = 0;
|
||||
renderer->property_has_entry() = false;
|
||||
renderer->signal_edited().connect (sigc::bind (sigc::mem_fun(*this, &MackieControlProtocolGUI::action_changed), column));
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
{
|
||||
@@ -182,37 +195,38 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
|
||||
function_key_editor.append_column (_("Key"), function_key_columns.name);
|
||||
|
||||
CellRendererCombo* action_renderer = manage (new CellRendererCombo);
|
||||
action_renderer->property_model() = available_action_model;
|
||||
action_renderer->property_editable() = true;
|
||||
action_renderer->property_text_column() = 0;
|
||||
action_renderer->property_has_entry() = false;
|
||||
action_renderer->signal_edited().connect (sigc::mem_fun(*this, &MackieControlProtocolGUI::action_changed));
|
||||
|
||||
TreeViewColumn* col;
|
||||
CellRendererCombo* renderer;
|
||||
|
||||
col = manage (new TreeViewColumn (_("Plain"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.plain);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.plain);
|
||||
col = manage (new TreeViewColumn (_("Plain"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.plain);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
col = manage (new TreeViewColumn (_("Shift"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.shift);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.shift);
|
||||
col = manage (new TreeViewColumn (_("Shift"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.shift);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
col = manage (new TreeViewColumn (_("Control"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.control);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.control);
|
||||
col = manage (new TreeViewColumn (_("Control"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.control);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
col = manage (new TreeViewColumn (_("Option"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.option);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.option);
|
||||
col = manage (new TreeViewColumn (_("Option"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.option);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
col = manage (new TreeViewColumn (_("Cmd/Alt"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.cmdalt);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.cmdalt);
|
||||
col = manage (new TreeViewColumn (_("Cmd/Alt"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.cmdalt);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
col = manage (new TreeViewColumn (_("Shift+Control"), *action_renderer));
|
||||
col->add_attribute (action_renderer->property_text(), function_key_columns.shiftcontrol);
|
||||
renderer = make_action_renderer (available_action_model, function_key_columns.shiftcontrol);
|
||||
col = manage (new TreeViewColumn (_("Shift+Control"), *renderer));
|
||||
col->add_attribute (renderer->property_text(), function_key_columns.shiftcontrol);
|
||||
function_key_editor.append_column (*col);
|
||||
|
||||
/* now fill with data */
|
||||
@@ -221,41 +235,32 @@ MackieControlProtocolGUI::rebuild_function_key_editor ()
|
||||
|
||||
TreeModel::Row row;
|
||||
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F1";
|
||||
row[function_key_columns.number] = 0;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F2";
|
||||
row[function_key_columns.number] = 1;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F3";
|
||||
row[function_key_columns.number] = 2;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F4";
|
||||
row[function_key_columns.number] = 3;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F5";
|
||||
row[function_key_columns.number] = 4;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F6";
|
||||
row[function_key_columns.number] = 5;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F7";
|
||||
row[function_key_columns.number] = 6;
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = "F8";
|
||||
row[function_key_columns.number] = 7;
|
||||
for (uint32_t n = 0; n < 16; ++n) {
|
||||
|
||||
row = *(function_key_model->append());
|
||||
row[function_key_columns.name] = string_compose ("F%1", n+1);
|
||||
row[function_key_columns.number] = n;
|
||||
row[function_key_columns.control] = "c";
|
||||
row[function_key_columns.option] = "o";
|
||||
row[function_key_columns.shift] = "s";
|
||||
row[function_key_columns.cmdalt] = "ca";
|
||||
row[function_key_columns.shiftcontrol] = "sc";
|
||||
}
|
||||
|
||||
function_key_editor.set_model (function_key_model);
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustring &text)
|
||||
MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustring &text, TreeModelColumnBase col)
|
||||
{
|
||||
Gtk::TreePath path(sPath);
|
||||
Gtk::TreeModel::iterator row = function_key_model->get_iter(path);
|
||||
|
||||
cerr << sPath << " changed to " << text << endl;
|
||||
cerr << sPath << '-' << col.index() << " changed to " << text << endl;
|
||||
|
||||
if (row) {
|
||||
(*row).set_value (col.index(), text);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <gtkmm/comboboxtext.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/spinbutton.h>
|
||||
@@ -25,6 +26,10 @@
|
||||
#include <gtkmm/notebook.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
|
||||
namespace Gtk {
|
||||
class CellRendererCombo;
|
||||
}
|
||||
|
||||
class MackieControlProtocol;
|
||||
|
||||
#include "i18n.h"
|
||||
@@ -79,6 +84,7 @@ class MackieControlProtocolGUI : public Gtk::Notebook
|
||||
Glib::RefPtr<Gtk::TreeStore> available_action_model;
|
||||
|
||||
void rebuild_function_key_editor ();
|
||||
void action_changed (const Glib::ustring &sPath, const Glib::ustring &text);
|
||||
void action_changed (const Glib::ustring &sPath, const Glib::ustring &text, Gtk::TreeModelColumnBase);
|
||||
Gtk::CellRendererCombo* make_action_renderer (Glib::RefPtr<Gtk::TreeStore> model, Gtk::TreeModelColumnBase);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "ardour/route.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/tempo.h"
|
||||
#include "ardour/track.h"
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/audioengine.h"
|
||||
|
||||
@@ -1189,15 +1190,19 @@ MackieControlProtocol::transport_frame() const
|
||||
void
|
||||
MackieControlProtocol::add_down_select_button (int surface, int strip)
|
||||
{
|
||||
_down_select_buttons.push_back ((surface<<8)|(strip&0xf));
|
||||
_down_select_buttons.insert ((surface<<8)|(strip&0xf));
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocol::remove_down_select_button (int surface, int strip)
|
||||
{
|
||||
list<uint32_t>::iterator x = find (_down_select_buttons.begin(), _down_select_buttons.end(), (surface<<8)|(strip&0xf));
|
||||
DownButtonList::iterator x = find (_down_select_buttons.begin(), _down_select_buttons.end(), (surface<<8)|(strip&0xf));
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("removing surface %1 strip %2 from down select buttons\n", surface, strip));
|
||||
if (x != _down_select_buttons.end()) {
|
||||
_down_select_buttons.erase (x);
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface %1 strip %2 not found in down select buttons\n",
|
||||
surface, strip));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,7 +1235,7 @@ MackieControlProtocol::add_down_button (AutomationType a, int surface, int strip
|
||||
_down_buttons[a] = DownButtonList();
|
||||
}
|
||||
|
||||
_down_buttons[a].push_back ((surface<<8)|(strip&0xf));
|
||||
_down_buttons[a].insert ((surface<<8)|(strip&0xf));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1238,15 +1243,20 @@ MackieControlProtocol::remove_down_button (AutomationType a, int surface, int st
|
||||
{
|
||||
DownButtonMap::iterator m = _down_buttons.find (a);
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("removing surface %1 strip %2 from down buttons for %3\n", surface, strip, (int) a));
|
||||
|
||||
if (m == _down_buttons.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DownButtonList& l (m->second);
|
||||
list<uint32_t>::iterator x = find (l.begin(), l.end(), (surface<<8)|(strip&0xf));
|
||||
DownButtonList::iterator x = find (l.begin(), l.end(), (surface<<8)|(strip&0xf));
|
||||
|
||||
if (x != l.end()) {
|
||||
l.erase (x);
|
||||
} else {
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface %1 strip %2 not found in down buttons for %3\n",
|
||||
surface, strip, (int) a));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1283,6 +1293,14 @@ MackieControlProtocol::down_controls (AutomationType p)
|
||||
controls.push_back ((*r)->mute_control());
|
||||
}
|
||||
break;
|
||||
case RecEnableAutomation:
|
||||
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
|
||||
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (*r);
|
||||
if (trk) {
|
||||
controls.push_back (trk->rec_enable_control());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1300,7 +1318,7 @@ struct ButtonRangeSorter {
|
||||
};
|
||||
|
||||
void
|
||||
MackieControlProtocol::pull_route_range (list<uint32_t>& down, RouteList& selected)
|
||||
MackieControlProtocol::pull_route_range (DownButtonList& down, RouteList& selected)
|
||||
{
|
||||
ButtonRangeSorter cmp;
|
||||
|
||||
@@ -1308,10 +1326,12 @@ MackieControlProtocol::pull_route_range (list<uint32_t>& down, RouteList& select
|
||||
return;
|
||||
}
|
||||
|
||||
down.sort (cmp);
|
||||
list<uint32_t> ldown;
|
||||
ldown.insert (ldown.end(), down.begin(), down.end());
|
||||
ldown.sort (cmp);
|
||||
|
||||
uint32_t first = down.front();
|
||||
uint32_t last = down.back ();
|
||||
uint32_t first = ldown.front();
|
||||
uint32_t last = ldown.back ();
|
||||
|
||||
uint32_t first_surface = first>>8;
|
||||
uint32_t first_strip = first&0xf;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <set>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <pthread.h>
|
||||
@@ -295,7 +296,7 @@ class MackieControlProtocol
|
||||
|
||||
/* BUTTON HANDLING */
|
||||
|
||||
typedef std::list<uint32_t> DownButtonList;
|
||||
typedef std::set<uint32_t> DownButtonList;
|
||||
typedef std::map<ARDOUR::AutomationType,DownButtonList> DownButtonMap;
|
||||
DownButtonMap _down_buttons;
|
||||
DownButtonList _down_select_buttons;
|
||||
|
||||
@@ -297,7 +297,7 @@ Strip::notify_gain_changed (bool force_update)
|
||||
do_parameter_display (GainAutomation, pos);
|
||||
}
|
||||
|
||||
queue_display_reset (3000);
|
||||
queue_display_reset (2000);
|
||||
_last_gain_position_written = pos;
|
||||
|
||||
} else {
|
||||
@@ -369,7 +369,7 @@ Strip::notify_panner_changed (bool force_update)
|
||||
do_parameter_display (PanAzimuthAutomation, pos);
|
||||
}
|
||||
|
||||
queue_display_reset (3000);
|
||||
queue_display_reset (2000);
|
||||
_last_pan_position_written = pos;
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||
button.set_in_use (false);
|
||||
}
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 handling button %2\n", _index, button.id()));
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 handling button %2 press ? %3\n", _index, button.id(), (bs == press)));
|
||||
|
||||
int lock_mod = (MackieControlProtocol::MODIFIER_CONTROL|MackieControlProtocol::MODIFIER_SHIFT);
|
||||
int ms = _surface->mcp().modifier_state();
|
||||
@@ -430,11 +430,14 @@ Strip::handle_button (Button& button, ButtonState bs)
|
||||
boost::shared_ptr<AutomationControl> ac = _fader->control (false);
|
||||
if (ac) {
|
||||
do_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value()));
|
||||
queue_display_reset (3000);
|
||||
queue_display_reset (2000);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
_fader->set_in_use (false);
|
||||
_fader->stop_touch (_surface->mcp().transport_frame(), true, false);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -524,7 +527,7 @@ Strip::handle_fader (Fader& fader, float position)
|
||||
|
||||
fader.set_value (position, modified);
|
||||
fader.start_touch (_surface->mcp().transport_frame(), modified);
|
||||
queue_display_reset (3000);
|
||||
queue_display_reset (2000);
|
||||
|
||||
// must echo bytes back to slider now, because
|
||||
// the notifier only works if the fader is not being
|
||||
|
||||
@@ -319,6 +319,8 @@ Surface::connect_to_signals ()
|
||||
p->controller.connect_same_thread (*this, boost::bind (&Surface::handle_midi_controller_message, this, _1, _2));
|
||||
/* Button messages are NoteOn */
|
||||
p->note_on.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
|
||||
/* Button messages are NoteOn. libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
|
||||
p->note_off.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
|
||||
/* Fader messages are Pitchbend */
|
||||
p->channel_pitchbend[0].connect_same_thread (*this, boost::bind (&Surface::handle_midi_pitchbend_message, this, _1, _2, 0U));
|
||||
p->channel_pitchbend[1].connect_same_thread (*this, boost::bind (&Surface::handle_midi_pitchbend_message, this, _1, _2, 1U));
|
||||
|
||||
Reference in New Issue
Block a user