resonance 1.0.1
Loading...
Searching...
No Matches
tick.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5class IBStream;
6class OBStream;
7
15constexpr int kTickInfinity = 0x2aaaaaab;
16
18constexpr int kTickMaximum = 0x2aaaaaaa;
19
21constexpr int kTickMinimum = -0x2aaaaaaa;
22
23namespace Sch {
24
70class Tick {
71public:
91 static int IsInRange(int nTick);
92
103
115 explicit Tick(int nTick) : mTick(nTick) {
116 IsInRange(nTick);
117 }
118
127 OBStream &saveGuts(OBStream &stream) const;
128
138
146 void Print(std::ostream &stream) const;
147
153 int mTick;
154};
155
156} // namespace Sch
Input half of the byte stream interface.
Definition ibstream.h:36
Output half of the byte stream interface.
Definition obstream.h:25
IBStream & restoreGuts(IBStream &stream)
Read the position back.
int mTick
The position, in MIDI ticks at 480 per quarter note.
Definition tick.h:153
Tick()
Start the position at kTickInfinity.
Definition tick.h:101
OBStream & saveGuts(OBStream &stream) const
Write the position.
Tick(int nTick)
Wrap a tick count, checking that it is finite.
Definition tick.h:115
void Print(std::ostream &stream) const
Write the position to a diagnostic stream as measure, beat, and tick.
static int IsInRange(int nTick)
Report whether a position is finite.
Scheduling of timed commands.
Definition activefilter.h:9
constexpr int kTickInfinity
Position the printer renders as positive infinity.
Definition tick.h:15
constexpr int kTickMaximum
Largest finite position, from the bound Sch::Tick::IsInRange() accepts.
Definition tick.h:18
constexpr int kTickMinimum
Smallest finite position, from the bound Sch::Tick::IsInRange() accepts.
Definition tick.h:21