Preliminary MMC sending
authorDavid Robillard <d@drobilla.net>
Fri, 16 Jun 2006 02:28:41 +0000 (02:28 +0000)
committerDavid Robillard <d@drobilla.net>
Fri, 16 Jun 2006 02:28:41 +0000 (02:28 +0000)
git-svn-id: svn://localhost/ardour2/branches/midi@614 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui_ed.cc
libs/ardour/session_midi.cc
libs/ardour/session_transport.cc

index 8714eec9a98afa6d8d11df3076efc143e377b90c..3add2a150cba6e63826115fbed4ce19ec3af6df5 100644 (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);
index f1c4b1e84df76dfbd21be4afa08918411a28605a..e1fab1ccfe11238e0e53330ce6ebc2efa2368395 100644 (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";
                }
        }
 }
index c05f8f40546119b0e57c2df13ecaf2fecceef86e..30a23a70cd66d9051d039b62f992e7819ba7f45f 100644 (file)
@@ -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 */
 }