summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-09-17 18:26:03 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-09-17 18:26:03 -0600
commitbd229936ec2cb30fe3360f2d83ffc7197fd6fb97 (patch)
tree84e41e048d76541d5d491ccefe8c7feaa14f4d5c /libs/ardour/session.cc
parentfc3e7623e7a4c7fdeebf84c4d47eaf04d9bc744d (diff)
add finite state machine to control/manage transport state
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index d61a53cd52..6935150ab6 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -49,6 +49,7 @@
#include "pbd/convert.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
+#include "pbd/i18n.h"
#include "pbd/md5.h"
#include "pbd/pthread_utils.h"
#include "pbd/search_path.h"
@@ -116,7 +117,9 @@
#include "ardour/speakers.h"
#include "ardour/tempo.h"
#include "ardour/ticker.h"
+#include "ardour/transport_fsm.h"
#include "ardour/transport_master.h"
+#include "ardour/transport_master_manager.h"
#include "ardour/track.h"
#include "ardour/types_convert.h"
#include "ardour/user_bundle.h"
@@ -129,8 +132,6 @@
#include "LuaBridge/LuaBridge.h"
-#include "pbd/i18n.h"
-
#include <glibmm/checksum.h>
namespace ARDOUR {
@@ -189,7 +190,6 @@ Session::Session (AudioEngine &eng,
, _base_sample_rate (0)
, _nominal_sample_rate (0)
, _current_sample_rate (0)
- , transport_sub_state (0)
, _record_status (Disabled)
, _transport_sample (0)
, _seek_counter (0)
@@ -251,6 +251,7 @@ Session::Session (AudioEngine &eng,
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
, _n_lua_scripts (0)
, _butler (new Butler (*this))
+ , _transport_fsm (TransportFSM::create (*this))
, _post_transport_work (0)
, _locations (new Locations (*this))
, _ignore_skips_updates (false)
@@ -606,9 +607,13 @@ Session::immediately_post_engine ()
_process_graph.reset (new Graph (*this));
}
- /* every time we reconnect, recompute worst case output latencies */
+ /* Restart transport FSM */
+
+ _transport_fsm->backend()->start ();
- _engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));
+ /* every time we reconnect, do stuff ... */
+
+ _engine.Running.connect_same_thread (*this, boost::bind (&Session::engine_running, this));
if (synced_to_engine()) {
_engine.transport_stop ();
@@ -848,7 +853,6 @@ Session::destroy ()
case SessionEvent::Skip:
case SessionEvent::PunchIn:
case SessionEvent::PunchOut:
- case SessionEvent::StopOnce:
case SessionEvent::RangeStop:
case SessionEvent::RangeLocate:
remove = false;
@@ -880,6 +884,9 @@ Session::destroy ()
delete _selection;
_selection = 0;
+ _transport_fsm->backend()->stop ();
+ _transport_fsm.reset ();
+
DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n");
#ifndef NDEBUG
@@ -1584,6 +1591,7 @@ Session::hookup_io ()
*/
AudioEngine::instance()->reconnect_ports ();
+ TransportMasterManager::instance().reconnect_ports ();
/* Anyone who cares about input state, wake up and do something */
@@ -2015,7 +2023,7 @@ void
Session::_locations_changed (const Locations::LocationList& locations)
{
/* There was some mass-change in the Locations object.
- *
+ *
* We might be re-adding a location here but it doesn't actually matter
* for all the locations that the Session takes an interest in.
*/