13
0

Preliminary MMC sending

git-svn-id: svn://localhost/ardour2/branches/midi@614 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2006-06-16 02:28:41 +00:00
parent e13e84677a
commit 6a1f2919f2
3 changed files with 18 additions and 13 deletions

View File

@ -364,7 +364,7 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (option_actions, X_("SendMTC"), _("Send MTC"), mem_fun (*this, &ARDOUR_UI::toggle_send_mtc));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), mem_fun (*this, &ARDOUR_UI::toggle_send_mtc));
act = ActionManager::register_toggle_action (option_actions, X_("SendMMC"), _("Send MMC"), mem_fun (*this, &ARDOUR_UI::toggle_send_mmc));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_toggle_action (option_actions, X_("UseMMC"), _("Use MMC"), mem_fun (*this, &ARDOUR_UI::toggle_use_mmc));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -146,11 +146,15 @@ Session::set_send_mtc (bool yn)
void
Session::set_send_mmc (bool yn)
{
cerr << "set send mmc " << yn << endl;
if (_mmc_port == 0) {
cerr << "\tno 1\n";
return;
}
if (send_midi_machine_control == yn) {
cerr << "\tno 2\n";
return;
}
@ -159,6 +163,7 @@ Session::set_send_mmc (bool yn)
*/
if (_mmc_port) {
cerr << "\tyes\n";
send_mmc = yn;
}
@ -1030,6 +1035,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where)
SMPTE::Time smpte;
if (_mmc_port == 0 || !send_mmc) {
cerr << "Not delivering MMC " << _mmc_port << " - " << send_mmc << endl;
return;
}
@ -1079,11 +1085,13 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where)
mmc_buffer[nbytes++] = 0xf7; // terminate SysEx/MMC message
//Glib::Mutex::Lock lm (midi_lock);
assert(where >= _transport_frame);
// FIXME: timestamp correct? [DR]
if (_mmc_port->write (mmc_buffer, nbytes, where - _transport_frame) != nbytes) {
if (!_mmc_port->midimsg (mmc_buffer, sizeof (mmc_buffer), where - _transport_frame)) {
error << string_compose(_("MMC: cannot send command %1%2%3"), &hex, cmd, &dec) << endmsg;
} else {
cerr << "Sending MMC\n";
}
}
}

View File

@ -148,6 +148,11 @@ Session::realtime_stop (bool abort)
{
/* assume that when we start, we'll be moving forwards */
// FIXME: where should this really be? [DR]
//send_full_time_code();
deliver_mmc (MIDI::MachineControl::cmdStop, _transport_frame);
deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
if (_transport_speed < 0.0f) {
post_transport_work = PostTransportWork (post_transport_work | PostTransportStop | PostTransportReverse);
} else {
@ -384,12 +389,6 @@ Session::non_realtime_stop (bool abort)
last_stop_frame = _transport_frame;
/* FIXME
send_full_time_code();
deliver_mmc (MIDI::MachineControl::cmdStop, 0);
deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
*/
if (did_record) {
/* XXX its a little odd that we're doing this here
@ -885,9 +884,7 @@ Session::actually_start_transport ()
(*i)->realtime_set_speed ((*i)->speed(), true);
}
/* FIXME
send_mmc_in_another_thread (MIDI::MachineControl::cmdDeferredPlay, 0);
*/
deliver_mmc(MIDI::MachineControl::cmdDeferredPlay, _transport_frame);
TransportStateChange (); /* EMIT SIGNAL */
}