summaryrefslogtreecommitdiff
path: root/libs/ardour/session_process.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-01-27 13:22:55 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-01-27 13:22:55 +0000
commit98ade9348a803996529758d782e1595f916122e3 (patch)
treecea55d938f10e6046e9cea8b7a3f5e6a6fbd412b /libs/ardour/session_process.cc
parent5e8403ff69b12353c9d71d72690a261bf5b7b059 (diff)
rework design of midi clock ticker to avoid expensive generalization that has turned out to have no particular use, and fix bug that caused incorrect ticks to be sent (or attempted) as the transport starts up
git-svn-id: svn://localhost/ardour2/branches/3.0@11359 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_process.cc')
-rw-r--r--libs/ardour/session_process.cc30
1 files changed, 23 insertions, 7 deletions
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 897b58ec8e..29f815d608 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -39,6 +39,7 @@
#include "ardour/graph.h"
#include "ardour/audio_port.h"
#include "ardour/tempo.h"
+#include "ardour/ticker.h"
#include "ardour/cycle_timer.h"
#include "midi++/manager.h"
@@ -57,6 +58,8 @@ using namespace std;
void
Session::process (pframes_t nframes)
{
+ framepos_t transport_at_start = _transport_frame;
+
MIDI::Manager::instance()->cycle_start(nframes);
_silent = false;
@@ -78,14 +81,27 @@ Session::process (pframes_t nframes)
_engine.main_thread()->drop_buffers ();
- // the ticker is for sending time information like MidiClock
- framepos_t transport_frames = transport_frame();
- Timecode::BBT_Time transport_bbt;
+ /* deliver MIDI clock. Note that we need to use the transport frame
+ * position at the start of process(), not the value at the end of
+ * it. We may already have ticked() because of a transport state
+ * change, for example.
+ */
+
try {
- _tempo_map->bbt_time_rt (transport_frames, transport_bbt);
- Timecode::Time transport_timecode;
- timecode_time(transport_frames, transport_timecode);
- tick (transport_frames, transport_bbt, transport_timecode); /* EMIT SIGNAL */
+ if (Config->get_send_midi_clock() && transport_speed() == 1.0f && midi_clock->has_midi_port()) {
+
+ /* As of january 26th 2012, MidiClockTicker::tick()
+ * doesn't actually these variables, so don't waste
+ * cycles computing them.
+ */
+
+ Timecode::BBT_Time transport_bbt;
+ Timecode::Time transport_timecode;
+ // _tempo_map->bbt_time_rt (transport_at_start, transport_bbt);
+ // timecode_time (transport_at_start, transport_timecode);
+
+ midi_clock->tick (transport_at_start, transport_bbt, transport_timecode);
+ }
} catch (...) {
/* don't bother with a message */
}