X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fardour%2Fsession_transport.cc;h=d032e31b93febad22c2b8b90147888ab71d19ea4;hb=90f3128d73bc32288d8ce99e81255ea02f54ffbc;hp=17a6806c526e18d458e3e018f49df30de1fc350b;hpb=bca0450c188cdac82fbc74d05b5d72aff9115646;p=ardour.git diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 17a6806c52..d032e31b93 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -49,11 +49,10 @@ using namespace sigc; using namespace PBD; void -Session::request_input_change_handling (boost::shared_ptr ds) +Session::request_input_change_handling () { if (!(_state_of_the_state & (InitialConnecting|Deletion))) { Event* ev = new Event (Event::InputConfigurationChange, Event::Add, Event::Immediate, 0, 0.0); - ev->diskstream = ds; queue_event (ev); } } @@ -135,6 +134,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); @@ -197,27 +201,9 @@ Session::butler_transport_work () } if (post_transport_work & PostTransportInputChange) { - { - RCUWriter input_writer (diskstreams_input_pending); - boost::shared_ptr input_list = input_writer.get_copy (); - RCUWriter dswriter (diskstreams); - boost::shared_ptr ds = dswriter.get_copy(); - - for (DiskstreamList::iterator i = input_list->begin(); i != input_list->end(); ++i) { - - /* make the change */ - - (*i)->non_realtime_input_change (); - - /* now transfer it back onto the regular diskstreams list */ - - ds->push_back (*i); - } - - input_list->clear(); + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { + (*i)->non_realtime_input_change (); } - - diskstreams_input_pending.flush (); } if (post_transport_work & PostTransportSpeed) { @@ -424,16 +410,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) return; } } + #ifdef LEAVE_TRANSPORT_UNADJUSTED } #endif last_stop_frame = _transport_frame; - 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 @@ -644,7 +627,12 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w return; } + // Update SMPTE time + // [DR] FIXME: find out exactly where this should go below _transport_frame = target_frame; + smpte_time(_transport_frame, transmitting_smpte_time); + outbound_mtc_smpte_frame = _transport_frame; + next_quarter_frame_to_send = 0; if (_transport_speed && (!with_loop || loop_changing)) { /* schedule a declick. we'll be called again when its done */ @@ -658,7 +646,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w } } - if (transport_rolling() && !Config->get_auto_play() && !with_roll && !(synced_to_jack() && play_loop)) { + if (transport_rolling() && (!auto_play_legal || !Config->get_auto_play()) && !with_roll && !(synced_to_jack() && play_loop)) { realtime_stop (false); } @@ -726,8 +714,14 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w } loop_changing = false; + + _send_smpte_update = true; } +/** Set the transport speed. + * @param speed New speed + * @param abort + */ void Session::set_transport_speed (float speed, bool abort) { @@ -743,6 +737,8 @@ Session::set_transport_speed (float speed, bool abort) if (transport_rolling() && speed == 0.0) { + /* we are rolling and we want to stop */ + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr dsl = diskstreams.reader(); @@ -763,6 +759,8 @@ Session::set_transport_speed (float speed, bool abort) } else if (transport_stopped() && speed == 1.0) { + /* we are stopped and we want to start rolling at speed 1 */ + if (!get_record_enabled() && Config->get_stop_at_session_end() && _transport_frame >= current_end_frame()) { return; } @@ -835,6 +833,8 @@ Session::set_transport_speed (float speed, bool abort) } } + +/** Stop the transport. */ void Session::stop_transport (bool abort) { @@ -920,11 +920,14 @@ Session::actually_start_transport () (*i)->realtime_set_speed ((*i)->speed(), true); } - send_mmc_in_another_thread (MIDI::MachineControl::cmdDeferredPlay, 0); - + deliver_mmc(MIDI::MachineControl::cmdDeferredPlay, _transport_frame); + TransportStateChange (); /* EMIT SIGNAL */ } +/** Do any transport work in the audio thread that needs to be done after the + * transport thread is finished. Audio thread, realtime safe. + */ void Session::post_transport () { @@ -943,7 +946,7 @@ Session::post_transport () if (post_transport_work & PostTransportLocate) { - if (((Config->get_slave_source() == None && Config->get_auto_play()) && !_exporting) || (post_transport_work & PostTransportRoll)) { + if (((Config->get_slave_source() == None && (auto_play_legal && Config->get_auto_play())) && !_exporting) || (post_transport_work & PostTransportRoll)) { start_transport (); } else { @@ -1268,3 +1271,19 @@ Session::update_latency_compensation_proxy (void* ignored) { update_latency_compensation (false, false); } + +void +Session::allow_auto_play (bool yn) +{ + auto_play_legal = yn; +} + +void +Session::reset_jack_connection (jack_client_t* jack) +{ + JACK_Slave* js; + + if (_slave && ((js = dynamic_cast (_slave)) != 0)) { + js->reset_client (jack); + } +}