summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-02 01:59:34 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-02 01:59:34 +0000
commit8b0354f91003582c4eafc4f2e1ef7ab2daba22e7 (patch)
tree344765bdf6c26782cf6c76f1a8aed23a82dda350 /libs
parent5d8933893c1bb889eb4ff95971b5a579bd7ea5da (diff)
Suspend transport timecode transmission during playhead drag. Should fix #3324.
git-svn-id: svn://localhost/ardour2/branches/3.0@7528 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h7
-rw-r--r--libs/ardour/ardour/session_event.h1
-rw-r--r--libs/ardour/session.cc5
-rw-r--r--libs/ardour/session_process.cc8
-rw-r--r--libs/ardour/session_transport.cc24
5 files changed, 41 insertions, 4 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 98bf0145c2..7d822e64bc 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -780,6 +780,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
bool step_editing() const { return (_step_editors > 0); }
+ void request_suspend_timecode_transmission ();
+ void request_resume_timecode_transmission ();
+ bool timecode_transmission_suspended () const;
+
protected:
friend class AudioEngine;
void set_block_size (nframes_t nframes);
@@ -1421,6 +1425,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void step_edit_status_change (bool);
uint32_t _step_editors;
+
+ /** true if timecode transmission by the transport is suspended, otherwise false */
+ mutable gint _suspend_timecode_transmission;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h
index e2027298fb..396f4e778b 100644
--- a/libs/ardour/ardour/session_event.h
+++ b/libs/ardour/ardour/session_event.h
@@ -36,6 +36,7 @@ struct SessionEvent {
RealTimeOperation,
AdjustPlaybackBuffering,
AdjustCaptureBuffering,
+ SetTimecodeTransmission,
/* only one of each of these events can be queued at any one time */
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 3bee1bc49e..6e557e6d49 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -154,8 +154,8 @@ Session::Session (AudioEngine &eng,
click_emphasis_data (0),
main_outs (0),
_metadata (new SessionMetadata()),
- _have_rec_enabled_track (false)
-
+ _have_rec_enabled_track (false),
+ _suspend_timecode_transmission (0)
{
playlists.reset (new SessionPlaylists);
@@ -4006,3 +4006,4 @@ Session::step_edit_status_change (bool yn)
StepEditStatusChange (val);
}
}
+
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 546963516e..f4f2c5ad0e 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -311,7 +311,7 @@ Session::process_with_events (nframes_t nframes)
return;
}
- if (!_exporting) {
+ if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (nframes);
}
@@ -762,7 +762,7 @@ Session::process_without_events (nframes_t nframes)
return;
}
- if (!_exporting) {
+ if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (nframes);
}
@@ -1099,6 +1099,10 @@ Session::process_event (SessionEvent* ev)
schedule_capture_buffering_adjustment ();
break;
+ case SessionEvent::SetTimecodeTransmission:
+ g_atomic_int_set (&_suspend_timecode_transmission, ev->yes_or_no ? 0 : 1);
+ break;
+
default:
fatal << string_compose(_("Programming error: illegal event type in process_event (%1)"), ev->type) << endmsg;
/*NOTREACHED*/
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 2897c5cd8f..b722bc04a7 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1568,3 +1568,27 @@ Session::send_mmc_locate (nframes64_t t)
timecode_time_subframes (t, time);
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (time));
}
+
+/** Ask the transport to not send timecode until further notice. The suspension
+ * will come into effect some finite time after this call, and timecode_transmission_suspended()
+ * should be checked by the caller to find out when.
+ */
+void
+Session::request_suspend_timecode_transmission ()
+{
+ SessionEvent* ev = new SessionEvent (SessionEvent::SetTimecodeTransmission, SessionEvent::Add, SessionEvent::Immediate, 0, 0, false);
+ queue_event (ev);
+}
+
+void
+Session::request_resume_timecode_transmission ()
+{
+ SessionEvent* ev = new SessionEvent (SessionEvent::SetTimecodeTransmission, SessionEvent::Add, SessionEvent::Immediate, 0, 0, true);
+ queue_event (ev);
+}
+
+bool
+Session::timecode_transmission_suspended () const
+{
+ return g_atomic_int_get (&_suspend_timecode_transmission) == 1;
+}