mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Fix MIDI controller feedback.
Make control surfaces menu less weird. git-svn-id: svn://localhost/ardour2/branches/3.0@4625 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
22088e77a7
commit
1f9c3f34d9
6 changed files with 32 additions and 32 deletions
|
|
@ -715,20 +715,27 @@ ARDOUR_UI::build_control_surface_menu ()
|
||||||
|
|
||||||
/* !!! this has to match the top level entry from ardour.menus */
|
/* !!! this has to match the top level entry from ardour.menus */
|
||||||
|
|
||||||
string ui = "<menubar name='Main' action='MainMenu'>\n<menu name='Options' action='Options'>\n<menu action='ControlSurfaces'><separator/>\n";
|
string ui = "<menubar name='Main' action='MainMenu'>\n"
|
||||||
|
"<menu name='Options' action='Options'>\n"
|
||||||
|
"<menu action='ControlSurfaces'><separator/>\n";
|
||||||
|
|
||||||
for (i = ControlProtocolManager::instance().control_protocol_info.begin(); i != ControlProtocolManager::instance().control_protocol_info.end(); ++i) {
|
for (i = ControlProtocolManager::instance().control_protocol_info.begin();
|
||||||
|
i != ControlProtocolManager::instance().control_protocol_info.end(); ++i) {
|
||||||
|
|
||||||
if (!(*i)->mandatory) {
|
if (!(*i)->mandatory) {
|
||||||
|
|
||||||
|
// Enable surface
|
||||||
|
|
||||||
string action_name = "Toggle";
|
string action_name = "Toggle";
|
||||||
action_name += legalize_for_path ((*i)->name);
|
action_name += legalize_for_path ((*i)->name);
|
||||||
action_name += "Surface";
|
action_name += "Surface";
|
||||||
|
|
||||||
string action_label = (*i)->name;
|
string action_label = (*i)->name;
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), action_label.c_str(),
|
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
|
||||||
(bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol), *i)));
|
editor->editor_actions, action_name.c_str(), action_label.c_str(), (bind (
|
||||||
|
mem_fun (*this, &ARDOUR_UI::toggle_control_protocol),
|
||||||
|
*i)));
|
||||||
|
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
|
||||||
|
|
@ -742,27 +749,21 @@ ARDOUR_UI::build_control_surface_menu ()
|
||||||
ui += action_name;
|
ui += action_name;
|
||||||
ui += "'/>\n";
|
ui += "'/>\n";
|
||||||
|
|
||||||
|
// Enable feedback
|
||||||
|
|
||||||
if ((*i)->supports_feedback) {
|
if ((*i)->supports_feedback) {
|
||||||
|
|
||||||
string submenu_name = action_name;
|
|
||||||
|
|
||||||
submenu_name += "SubMenu";
|
|
||||||
|
|
||||||
ActionManager::register_action (editor->editor_actions, submenu_name.c_str(), _("Controls"));
|
|
||||||
|
|
||||||
action_name += "Feedback";
|
action_name += "Feedback";
|
||||||
|
string feedback_label = action_label + " " + _("Feedback");
|
||||||
|
|
||||||
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (editor->editor_actions, action_name.c_str(), _("Feedback"),
|
Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
|
||||||
(bind (mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback),
|
editor->editor_actions, action_name.c_str(), feedback_label.c_str(), (bind (
|
||||||
*i,
|
mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback),
|
||||||
"Editor",
|
*i, "Editor", action_name)));
|
||||||
action_name)));
|
|
||||||
|
ui += "<menuitem action='";
|
||||||
ui += "<menu action='";
|
|
||||||
ui += submenu_name;
|
|
||||||
ui += "'>\n<menuitem action='";
|
|
||||||
ui += action_name;
|
ui += action_name;
|
||||||
ui += "'/>\n</menu>\n";
|
ui += "'/>\n";
|
||||||
|
|
||||||
if ((*i)->protocol) {
|
if ((*i)->protocol) {
|
||||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,6 @@ Session::change_midi_ports ()
|
||||||
* This resets the MTC code, the next quarter frame message that is sent will be
|
* This resets the MTC code, the next quarter frame message that is sent will be
|
||||||
* the first one with the beginning of this cycle as the new start point.
|
* the first one with the beginning of this cycle as the new start point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
Session::send_full_time_code(nframes_t nframes)
|
Session::send_full_time_code(nframes_t nframes)
|
||||||
{
|
{
|
||||||
|
|
@ -835,8 +834,7 @@ Session::send_full_time_code(nframes_t nframes)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Send MTC (quarter-frame) messages for this cycle.
|
||||||
/** Sends MTC (quarter-frame) messages for this cycle.
|
|
||||||
* Must be called exactly once per cycle from the audio thread. Realtime safe.
|
* Must be called exactly once per cycle from the audio thread. Realtime safe.
|
||||||
* This function assumes the state of full SMPTE is sane, eg. the slave is
|
* This function assumes the state of full SMPTE is sane, eg. the slave is
|
||||||
* expecting quarter frame messages and has the right frame of reference (any
|
* expecting quarter frame messages and has the right frame of reference (any
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,12 @@ JACK_MidiPort::cycle_start (nframes_t nframes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JACK_MidiPort::cycle_end ()
|
||||||
|
{
|
||||||
|
flush(jack_port_get_buffer(_jack_output_port, _nframes_this_cycle));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
JACK_MidiPort::write(byte * msg, size_t msglen, timestamp_t timestamp)
|
JACK_MidiPort::write(byte * msg, size_t msglen, timestamp_t timestamp)
|
||||||
{
|
{
|
||||||
|
|
@ -102,8 +108,7 @@ JACK_MidiPort::write(byte * msg, size_t msglen, timestamp_t timestamp)
|
||||||
non_process_thread_fifo.get_write_vector (&vec);
|
non_process_thread_fifo.get_write_vector (&vec);
|
||||||
|
|
||||||
if (vec.len[0] + vec.len[1] < 1) {
|
if (vec.len[0] + vec.len[1] < 1) {
|
||||||
error << "no space in FIFO for non-process thread MIDI write"
|
error << "no space in FIFO for non-process thread MIDI write" << endmsg;
|
||||||
<< endmsg;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public:
|
||||||
virtual int selectable() const { return -1; }
|
virtual int selectable() const { return -1; }
|
||||||
|
|
||||||
virtual void cycle_start(nframes_t nframes);
|
virtual void cycle_start(nframes_t nframes);
|
||||||
|
virtual void cycle_end();
|
||||||
|
|
||||||
static std::string typestring;
|
static std::string typestring;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,7 @@ GenericMidiControlProtocol::_send_feedback ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
_port->write (buf, (int32_t) (end - buf), 0);
|
||||||
//_port->write (buf, (int32_t) (end - buf));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,6 @@ MIDIControllable::stop_learning ()
|
||||||
void
|
void
|
||||||
MIDIControllable::drop_external_control ()
|
MIDIControllable::drop_external_control ()
|
||||||
{
|
{
|
||||||
cerr << "Dropping existing control using " << connections << " connections\n";
|
|
||||||
|
|
||||||
if (connections > 0) {
|
if (connections > 0) {
|
||||||
midi_sense_connection[0].disconnect ();
|
midi_sense_connection[0].disconnect ();
|
||||||
}
|
}
|
||||||
|
|
@ -286,8 +284,6 @@ MIDIControllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr << "MIDI bound with " << connections << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -303,7 +299,7 @@ MIDIControllable::send_feedback ()
|
||||||
msg[1] = control_additional;
|
msg[1] = control_additional;
|
||||||
msg[2] = (byte) (controllable.get_value() * 127.0f);
|
msg[2] = (byte) (controllable.get_value() * 127.0f);
|
||||||
|
|
||||||
//_port.write (msg, 3);
|
_port.write (msg, 3, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MIDI::byte*
|
MIDI::byte*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue