399 void setIsPlaying (
bool isPlayingIn) { setFlag (flagIsPlaying, isPlayingIn); }
408 void setIsRecording (
bool isRecordingIn) { setFlag (flagIsRecording, isRecordingIn); }
414 void setIsLooping (
bool isLoopingIn) { setFlag (flagIsLooping, isLoopingIn); }
416 bool operator== (
const PositionInfo& other)
const noexcept
420 return std::make_tuple (i.getTimeInSamples(),
421 i.getTimeInSeconds(),
423 i.getEditOriginTime(),
424 i.getPpqPositionOfLastBarStart(),
427 i.getTimeSignature(),
436 return tie (*
this) == tie (other);
439 bool operator!= (
const PositionInfo& other)
const noexcept
441 return ! operator== (other);
445 bool getFlag (int64_t flagToCheck)
const
447 return (flagToCheck & flags) != 0;
450 void setFlag (int64_t flagToCheck,
bool value)
452 flags = (value ? flags | flagToCheck : flags & ~flagToCheck);
455 template <
typename Value>
456 Optional<Value> getOptional (int64_t flagToCheck, Value value)
const
458 return getFlag (flagToCheck) ? makeOptional (std::move (value)) : nullopt;
461 template <
typename Value>
462 void setOptional (int64_t flagToCheck, Value& value, Optional<Value> opt)
467 setFlag (flagToCheck, opt.hasValue());
472 flagTimeSignature = 1 << 0,
473 flagLoopPoints = 1 << 1,
474 flagFrameRate = 1 << 2,
475 flagTimeSeconds = 1 << 3,
476 flagLastBarStartPpq = 1 << 4,
477 flagPpqPosition = 1 << 5,
478 flagOriginTime = 1 << 6,
480 flagTimeSamples = 1 << 8,
481 flagBarCount = 1 << 9,
482 flagHostTimeNs = 1 << 10,
483 flagIsPlaying = 1 << 11,
484 flagIsRecording = 1 << 12,
485 flagIsLooping = 1 << 13
488 TimeSignature timeSignature;
489 LoopPoints loopPoints;
490 FrameRate frame = FrameRateType::fps23976;
491 double timeInSeconds = 0.0;
492 double lastBarStartPpq = 0.0;
493 double positionPpq = 0.0;
494 double originTime = 0.0;
495 double tempoBpm = 0.0;
496 int64_t timeInSamples = 0;
497 int64_t barCount = 0;
498 uint64_t hostTimeNs = 0;