diff options
author | David Robillard <d@drobilla.net> | 2006-06-16 02:28:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-06-16 02:28:41 +0000 |
commit | 6a1f2919f20286b7d51de8e9c02107ab42f8e763 (patch) | |
tree | 5cd9cabfb69b5bd6d6a0239d3b22479a601aa961 | |
parent | e13e84677a9213fb54d641483a7fcf5ecf2feb0d (diff) |
Preliminary MMC sending
git-svn-id: svn://localhost/ardour2/branches/midi@614 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 14 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 15 |
3 files changed, 18 insertions, 13 deletions
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 8714eec9a9..3add2a150c 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -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); diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index f1c4b1e84d..e1fab1ccfe 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -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"; } } } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index c05f8f4054..30a23a70cd 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -147,6 +147,11 @@ void 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); @@ -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 */ } |