35 public zrythm::dsp::Position
40 Q_PROPERTY (
double ticks READ getTicks WRITE setTicks NOTIFY ticksChanged)
42 signed_frame_t frames READ getFrames WRITE setFrames NOTIFY framesChanged)
44 double ticksPerSixteenthNote READ getTicksPerSixteenthNote CONSTANT)
48 QObject * parent =
nullptr,
49 const Position * pos =
nullptr,
50 bool realtime_updateable =
false);
51 ~PositionProxy ()
override;
52 Q_DISABLE_COPY_MOVE (PositionProxy)
56 Q_SIGNAL
void framesChanged ();
58 double getTicks ()
const {
return ticks_; }
59 void setTicks (
double ticks);
60 Q_SIGNAL
void ticksChanged ();
62 static double getTicksPerSixteenthNote ()
64 return TICKS_PER_SIXTEENTH_NOTE_DBL;
66 Position get_position ()
const
68 return *
dynamic_cast<const Position *
> (
this);
71 Q_INVOKABLE
void addTicks (
double ticks) { setTicks (getTicks () + ticks); }
73 Q_INVOKABLE QString getStringDisplay (
83 from_frames (frames, ticks_per_frame);
84 has_update_.store (
true, std::memory_order_release);
89 has_update_.store (
true, std::memory_order_release);
95 has_update_.store (
true, std::memory_order_release);
101 has_update_.store (
true, std::memory_order_release);
104 void set_position_rtsafe (
const Position &pos)
111 has_update_.store (
true, std::memory_order_release);
121 has_update_.store (
true, std::memory_order_release);
124 bool processUpdates ()
override;
126 friend void init_from (
139 return (lhs <=> rhs) == 0;
143 std::atomic<bool> has_update_{
false };
144 bool realtime_updateable_;
void add_frames(signed_frame_t frames, TicksPerFrame ticks_per_frame)
Adds the frames to the position and updates the rest of the fields, and makes sure the frames are sti...