2008-06-02 17:41:35 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published
|
|
|
|
by the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
#define Timecode_IS_AROUND_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours)
|
|
|
|
#define Timecode_IS_ZERO( sm ) (!(sm).frames && !(sm).seconds && !(sm).minutes && !(sm).hours && !(sm.subframes))
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
#include "control_protocol/timecode.h"
|
2009-05-13 20:13:27 -04:00
|
|
|
#include "ardour/rc_configuration.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
namespace Timecode {
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
float Time::default_rate = 30.0;
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
/** Increment @a timecode by exactly one frame (keep subframes value).
|
2008-06-02 17:41:35 -04:00
|
|
|
* Realtime safe.
|
|
|
|
* @return true if seconds wrap.
|
|
|
|
*/
|
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
increment( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
|
|
|
if (Timecode_IS_AROUND_ZERO(timecode) && timecode.subframes) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// We have a zero transition involving only subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.subframes = subframes_per_frame - timecode.subframes;
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
return SECONDS;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.negative = false;
|
|
|
|
wrap = decrement( timecode, subframes_per_frame );
|
|
|
|
if (!Timecode_IS_ZERO( timecode )) {
|
|
|
|
timecode.negative = true;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
switch ((int)ceil(timecode.rate)) {
|
2008-06-02 17:41:35 -04:00
|
|
|
case 24:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 23) {
|
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 25:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 24) {
|
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 30:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.drop) {
|
|
|
|
if (timecode.frames == 29) {
|
|
|
|
if ( ((timecode.minutes + 1) % 10) && (timecode.seconds == 59) ) {
|
|
|
|
timecode.frames = 2;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 29) {
|
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 60:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 59) {
|
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wrap == SECONDS) {
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.seconds == 59) {
|
|
|
|
timecode.seconds = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = MINUTES;
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.minutes == 59) {
|
|
|
|
timecode.minutes = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = HOURS;
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.hours++;
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.minutes++;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.seconds++;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames++;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
/** Decrement @a timecode by exactly one frame (keep subframes value)
|
2008-06-02 17:41:35 -04:00
|
|
|
* Realtime safe.
|
|
|
|
* @return true if seconds wrap. */
|
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
decrement( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative || Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
|
|
|
wrap = increment( timecode, subframes_per_frame );
|
|
|
|
timecode.negative = true;
|
2008-06-02 17:41:35 -04:00
|
|
|
return wrap;
|
2009-10-26 10:38:58 -04:00
|
|
|
} else if (Timecode_IS_AROUND_ZERO(timecode) && timecode.subframes) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// We have a zero transition involving only subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.subframes = subframes_per_frame - timecode.subframes;
|
|
|
|
timecode.negative = true;
|
2008-06-02 17:41:35 -04:00
|
|
|
return SECONDS;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
switch ((int)ceil(timecode.rate)) {
|
2008-06-02 17:41:35 -04:00
|
|
|
case 24:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 0) {
|
|
|
|
timecode.frames = 23;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 25:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 0) {
|
|
|
|
timecode.frames = 24;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 30:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.drop) {
|
|
|
|
if ((timecode.minutes % 10) && (timecode.seconds == 0)) {
|
|
|
|
if (timecode.frames <= 2) {
|
|
|
|
timecode.frames = 29;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
2009-10-26 10:38:58 -04:00
|
|
|
} else if (timecode.frames == 0) {
|
|
|
|
timecode.frames = 29;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 0) {
|
|
|
|
timecode.frames = 29;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 60:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.frames == 0) {
|
|
|
|
timecode.frames = 59;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = SECONDS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wrap == SECONDS) {
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.seconds == 0) {
|
|
|
|
timecode.seconds = 59;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = MINUTES;
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.minutes == 0) {
|
|
|
|
timecode.minutes = 59;
|
2008-06-02 17:41:35 -04:00
|
|
|
wrap = HOURS;
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.hours--;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.minutes--;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.seconds--;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames--;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (Timecode_IS_ZERO( timecode )) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to lowest absolute subframe value in this frame (set to 0 :-) ) */
|
|
|
|
void
|
2009-10-26 10:38:58 -04:00
|
|
|
frames_floor( Time& timecode )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.subframes = 0;
|
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
/** Increment @a timecode by one subframe */
|
2008-06-02 17:41:35 -04:00
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
increment_subframes( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
|
|
|
timecode.negative = false;
|
|
|
|
wrap = decrement_subframes( timecode, subframes_per_frame );
|
|
|
|
if (!Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = true;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.subframes++;
|
|
|
|
if (timecode.subframes >= subframes_per_frame) {
|
|
|
|
timecode.subframes = 0;
|
|
|
|
increment( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
return FRAMES;
|
|
|
|
}
|
|
|
|
return NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
/** Decrement @a timecode by one subframe */
|
2008-06-02 17:41:35 -04:00
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
decrement_subframes( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
|
|
|
timecode.negative = false;
|
|
|
|
wrap = increment_subframes( timecode, subframes_per_frame );
|
|
|
|
timecode.negative = true;
|
2008-06-02 17:41:35 -04:00
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.subframes <= 0) {
|
|
|
|
timecode.subframes = 0;
|
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = true;
|
|
|
|
timecode.subframes = 1;
|
2008-06-02 17:41:35 -04:00
|
|
|
return FRAMES;
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
decrement( timecode, subframes_per_frame );
|
|
|
|
timecode.subframes = 79;
|
2008-06-02 17:41:35 -04:00
|
|
|
return FRAMES;
|
|
|
|
}
|
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.subframes--;
|
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
return NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to next whole second (frames == 0 or frames == 2) */
|
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
increment_seconds( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
|
|
|
// Clear subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
frames_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// Wrap second if on second boundary
|
2009-10-26 10:38:58 -04:00
|
|
|
wrap = increment(timecode, subframes_per_frame);
|
2008-06-02 17:41:35 -04:00
|
|
|
// Go to lowest absolute frame value
|
2009-10-26 10:38:58 -04:00
|
|
|
seconds_floor( timecode );
|
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Go to highest possible frame in this second
|
2009-10-26 10:38:58 -04:00
|
|
|
switch ((int)ceil(timecode.rate)) {
|
2008-06-02 17:41:35 -04:00
|
|
|
case 24:
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 23;
|
2008-06-02 17:41:35 -04:00
|
|
|
break;
|
|
|
|
case 25:
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 24;
|
2008-06-02 17:41:35 -04:00
|
|
|
break;
|
|
|
|
case 30:
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 29;
|
2008-06-02 17:41:35 -04:00
|
|
|
break;
|
|
|
|
case 60:
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 59;
|
2008-06-02 17:41:35 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increment by one frame
|
2009-10-26 10:38:58 -04:00
|
|
|
wrap = increment( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to lowest (absolute) frame value in this second
|
|
|
|
* Doesn't care about positive/negative */
|
|
|
|
void
|
2009-10-26 10:38:58 -04:00
|
|
|
seconds_floor( Time& timecode )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Clear subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
frames_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
// Go to lowest possible frame in this second
|
2009-10-26 10:38:58 -04:00
|
|
|
switch ((int)ceil(timecode.rate)) {
|
2008-06-02 17:41:35 -04:00
|
|
|
case 24:
|
|
|
|
case 25:
|
|
|
|
case 30:
|
|
|
|
case 60:
|
2009-10-26 10:38:58 -04:00
|
|
|
if (!(timecode.drop)) {
|
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if ((timecode.minutes % 10) && (timecode.seconds == 0)) {
|
|
|
|
timecode.frames = 2;
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.frames = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to next whole minute (seconds == 0, frames == 0 or frames == 2) */
|
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
increment_minutes( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
|
|
|
// Clear subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
frames_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// Wrap if on minute boundary
|
2009-10-26 10:38:58 -04:00
|
|
|
wrap = increment_seconds( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
// Go to lowest possible value in this minute
|
2009-10-26 10:38:58 -04:00
|
|
|
minutes_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
|
|
|
// Go to highest possible second
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.seconds = 59;
|
2008-06-02 17:41:35 -04:00
|
|
|
// Wrap minute by incrementing second
|
2009-10-26 10:38:58 -04:00
|
|
|
wrap = increment_seconds( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to lowest absolute value in this minute */
|
|
|
|
void
|
2009-10-26 10:38:58 -04:00
|
|
|
minutes_floor( Time& timecode )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
// Go to lowest possible second
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.seconds = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
// Go to lowest possible frame
|
2009-10-26 10:38:58 -04:00
|
|
|
seconds_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to next whole hour (minute = 0, second = 0, frame = 0) */
|
|
|
|
Wrap
|
2009-10-26 10:38:58 -04:00
|
|
|
increment_hours( Time& timecode, uint32_t subframes_per_frame )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
|
|
|
Wrap wrap = NONE;
|
|
|
|
|
|
|
|
// Clear subframes
|
2009-10-26 10:38:58 -04:00
|
|
|
frames_floor(timecode);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (timecode.negative) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// Wrap if on hour boundary
|
2009-10-26 10:38:58 -04:00
|
|
|
wrap = increment_minutes( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
// Go to lowest possible value in this hour
|
2009-10-26 10:38:58 -04:00
|
|
|
hours_floor( timecode );
|
2008-06-02 17:41:35 -04:00
|
|
|
} else {
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.minutes = 59;
|
|
|
|
wrap = increment_minutes( timecode, subframes_per_frame );
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Go to lowest absolute value in this hour */
|
|
|
|
void
|
2009-10-26 10:38:58 -04:00
|
|
|
hours_floor( Time& timecode )
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2009-10-26 10:38:58 -04:00
|
|
|
timecode.minutes = 0;
|
|
|
|
timecode.seconds = 0;
|
|
|
|
timecode.frames = 0;
|
|
|
|
timecode.subframes = 0;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
if (Timecode_IS_ZERO(timecode)) {
|
|
|
|
timecode.negative = false;
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
} // namespace Timecode
|