summaryrefslogtreecommitdiff
path: root/libs/ardour/mtc_slave.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-14 16:10:01 +0000
committerDavid Robillard <d@drobilla.net>2009-10-14 16:10:01 +0000
commitbb9cc45cd22af67ac275a5e73accbe14fee664d8 (patch)
treee52977d3eae6ff07b856088041a080a2fa3e5b79 /libs/ardour/mtc_slave.cc
parent8c4ce1e2ce35571aed5a686671431fdfffae7f8c (diff)
Strip trailing whitespace and fix other whitespace errors (e.g. space/tab mixing). Whitespace changes only.
Vimmers, try let c_space_errors = 1 in your .vimrc to highlight this kind of stuff in red. I don't know the emacs equivalent... git-svn-id: svn://localhost/ardour2/branches/3.0@5773 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/mtc_slave.cc')
-rw-r--r--libs/ardour/mtc_slave.cc58
1 files changed, 29 insertions, 29 deletions
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index 587d6007b3..a97b8aa658 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2002-4 Paul Davis
+ Copyright (C) 2002-4 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ using namespace sigc;
using namespace MIDI;
using namespace PBD;
-MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
+MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p)
: session (s)
{
can_notify_on_unknown_rate = true;
@@ -93,14 +93,14 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
{
nframes_t now = session.engine().frame_time();
SMPTE::Time smpte;
-
+
smpte.hours = msg[3];
smpte.minutes = msg[2];
smpte.seconds = msg[1];
smpte.frames = msg[0];
last_mtc_fps_byte = msg[4];
-
+
switch (msg[4]) {
case MTC_24_FPS:
smpte.rate = 24;
@@ -126,7 +126,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
/* throttle error messages about unknown MTC rates */
if (can_notify_on_unknown_rate) {
error << string_compose (_("Unknown rate/drop value %1 in incoming MTC stream, session values used instead"),
- (int) msg[4])
+ (int) msg[4])
<< endmsg;
can_notify_on_unknown_rate = false;
}
@@ -135,42 +135,42 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full)
}
session.smpte_to_sample (smpte, mtc_frame, true, false);
-
+
if (was_full) {
-
- current.guard1++;
- current.position = mtc_frame;
- current.timestamp = 0;
- current.guard2++;
-
- session.request_locate (mtc_frame, false);
+
+ current.guard1++;
+ current.position = mtc_frame;
+ current.timestamp = 0;
+ current.guard2++;
+
+ session.request_locate (mtc_frame, false);
session.request_transport_speed (0);
- update_mtc_status (MIDI::Parser::MTC_Stopped);
+ update_mtc_status (MIDI::Parser::MTC_Stopped);
+
+ reset ();
- reset ();
-
} else {
-
+
/* We received the last quarter frame 7 quarter frames (1.75 mtc
frames) after the instance when the contents of the mtc quarter
frames were decided. Add time to compensate for the elapsed 1.75
frames.
- Also compensate for audio latency.
+ Also compensate for audio latency.
*/
mtc_frame += (long) (1.75 * session.frames_per_smpte_frame()) + session.worst_output_latency();
-
+
if (first_mtc_frame == 0) {
first_mtc_frame = mtc_frame;
first_mtc_time = now;
- }
-
+ }
+
current.guard1++;
current.position = mtc_frame;
current.timestamp = now;
current.guard2++;
}
-
+
last_inbound_frame = now;
}
@@ -178,7 +178,7 @@ void
MTC_Slave::handle_locate (const MIDI::byte* mmc_tc)
{
MIDI::byte mtc[5];
-
+
mtc[4] = last_mtc_fps_byte;
mtc[3] = mmc_tc[0] & 0xf; /* hrs only */
mtc[2] = mmc_tc[1];
@@ -257,7 +257,7 @@ MTC_Slave::ok() const
return true;
}
-bool
+bool
MTC_Slave::speed_and_position (double& speed, nframes_t& pos)
{
nframes_t now = session.engine().frame_time();
@@ -273,7 +273,7 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos)
pos = last.position;
return true;
}
-
+
/* no timecode for 1/4 second ? conclude that its stopped */
if (last_inbound_frame && now > last_inbound_frame && now - last_inbound_frame > session.frame_rate() / 4) {
@@ -317,9 +317,9 @@ MTC_Slave::speed_and_position (double& speed, nframes_t& pos)
elapsed = 0;
} else {
-
+
/* scale elapsed time by the current MTC speed */
-
+
if (last.timestamp && (now > last.timestamp)) {
elapsed = (nframes_t) floor (mtc_speed * (now - last.timestamp));
} else {
@@ -348,9 +348,9 @@ MTC_Slave::reset ()
be being updated as we call this. but this
supposed to be a realtime-safe call.
*/
-
+
port->input()->reset_mtc_state ();
-
+
last_inbound_frame = 0;
current.guard1++;
current.position = 0;