WIP clarify ambiguity with fractional seconds
They are *not* intended to stand-in for gavl_time_t Indeed, Time values should be handled as opaque
This commit is contained in:
parent
15214cc069
commit
c40ba74bc6
8 changed files with 18 additions and 17 deletions
|
|
@ -107,7 +107,7 @@ namespace time {
|
|||
class Seconds
|
||||
: public Format
|
||||
{
|
||||
TimeFract secs_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace time {
|
|||
* into the internal time scale used by GAVL and Lumiera internal time values.
|
||||
*/
|
||||
inline gavl_time_t
|
||||
rational2time (TimeFract const& fractionalSeconds)
|
||||
rational2time (FSecs const& fractionalSeconds)
|
||||
{
|
||||
return boost::rational_cast<gavl_time_t> (GAVL_TIME_SCALE * fractionalSeconds);
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ namespace time {
|
|||
* from a fraction of seconds, given as rational number.
|
||||
* An example would be to the time unit of a framerate.
|
||||
*/
|
||||
Time::Time (TimeFract const& fractionalSeconds)
|
||||
Time::Time (FSecs const& fractionalSeconds)
|
||||
: TimeValue(rational2time (fractionalSeconds))
|
||||
{ }
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace time {
|
|||
{
|
||||
|
||||
public:
|
||||
FixedFrameQuantiser (TimeFract frames_per_second);
|
||||
FixedFrameQuantiser (FSecs frames_per_second);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -183,8 +183,9 @@ namespace time {
|
|||
|
||||
/* ======= specific Time entities ==================== */
|
||||
|
||||
/** rational representation of fractional seconds */
|
||||
typedef boost::rational<gavl_time_t> TimeFract;
|
||||
/** rational representation of fractional seconds
|
||||
* @warning do not mix up gavl_time_t and FSecs */
|
||||
typedef boost::rational<long> FSecs;
|
||||
|
||||
/**
|
||||
* Lumiera's internal time value datatype.
|
||||
|
|
@ -223,7 +224,7 @@ namespace time {
|
|||
: TimeValue(calcResult)
|
||||
{ }
|
||||
|
||||
Time (TimeFract const& fractionalSeconds);
|
||||
Time (FSecs const& fractionalSeconds);
|
||||
|
||||
Time ( long millis
|
||||
, uint secs
|
||||
|
|
|
|||
|
|
@ -117,14 +117,14 @@ namespace meta {
|
|||
/* === TimeGrid shortcut builder functions === */
|
||||
|
||||
PGrid
|
||||
TimeGrid::build (Symbol gridID, TimeFract frames_per_second)
|
||||
TimeGrid::build (Symbol gridID, FSecs frames_per_second)
|
||||
{
|
||||
return build (gridID,frames_per_second, Time(0));
|
||||
}
|
||||
|
||||
|
||||
PGrid
|
||||
TimeGrid::build (Symbol gridID, TimeFract frames_per_second, Time origin)
|
||||
TimeGrid::build (Symbol gridID, FSecs frames_per_second, Time origin)
|
||||
{
|
||||
UNIMPLEMENTED ("build a trivial time grid");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace meta {
|
|||
using lib::Symbol;
|
||||
using lib::time::Time;
|
||||
using lib::time::TimeValue;
|
||||
using lib::time::TimeFract;
|
||||
using lib::time::FSecs;
|
||||
|
||||
|
||||
class TimeGrid;
|
||||
|
|
@ -80,8 +80,8 @@ namespace meta {
|
|||
// TODO define the TimeGrid API here
|
||||
|
||||
/* === shortcut builder functions === */
|
||||
static PGrid build (Symbol gridID, TimeFract frames_per_second);
|
||||
static PGrid build (Symbol gridID, TimeFract frames_per_second, Time origin);
|
||||
static PGrid build (Symbol gridID, FSecs frames_per_second);
|
||||
static PGrid build (Symbol gridID, FSecs frames_per_second, Time origin);
|
||||
|
||||
protected:
|
||||
TimeGrid (EntryID<TimeGrid> const&);
|
||||
|
|
@ -94,7 +94,7 @@ namespace meta {
|
|||
template<>
|
||||
struct Builder<TimeGrid>
|
||||
{
|
||||
TimeFract fps_;
|
||||
FSecs fps_;
|
||||
Time origin_;
|
||||
|
||||
/** when building a compound or variable grid,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace test {
|
|||
namespace { // Test definitions...
|
||||
|
||||
Time testOrigin (12,23);
|
||||
TimeFract testFps (5,4);
|
||||
FSecs testFps (5,4);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ namespace test{
|
|||
FrameNr count(qVal); // materialise this quantised time into..
|
||||
int n = count; // frame count, accessible as plain number
|
||||
|
||||
CHECK (TimeFract(n-1, 25) < org); // verify quantisation: the original time
|
||||
CHECK (org < TimeFract(n+1, 25)); // is properly bracketed by (n-1, n+2)
|
||||
CHECK (Time(FSecs(n-1, 25)) < org); // verify quantisation: the original time
|
||||
CHECK (org < Time(FSecs(n+1, 25))); // is properly bracketed by (n-1, n+2)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ namespace test{
|
|||
void
|
||||
checkMultipleGrids (TimeValue org)
|
||||
{
|
||||
TimeGrid::build("my_alternate_grid", TimeFract(30000,1001));
|
||||
TimeGrid::build("my_alternate_grid", FSecs(30000,1001));
|
||||
|
||||
QuTime palVal (org, "my_simple_grid");
|
||||
QuTime ntscVal (org, "my_alternate_grid");
|
||||
|
|
|
|||
Loading…
Reference in a new issue