MCPcopy Create free account
hub / github.com/LabSound/LabSound / AudioNodeScheduler

Class AudioNodeScheduler

include/LabSound/core/AudioNodeScheduler.h:30–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28class ContextRenderLock;
29
30class AudioNodeScheduler
31{
32public:
33 explicit AudioNodeScheduler() = delete;
34 explicit AudioNodeScheduler(float sampleRate);
35 ~AudioNodeScheduler() = default;
36
37 // Scheduling
38 void start(double when);
39 void stop(double when);
40
41 // called when the sound is finished, or noteOff/stop time has been reached
42 void finish(ContextRenderLock&);
43 void reset();
44
45 SchedulingState playbackState() const { return _playbackState; }
46 bool hasFinished() const { return _playbackState == SchedulingState::FINISHED; }
47
48 bool update(ContextRenderLock&, int epoch_length);
49
50 SchedulingState _playbackState = SchedulingState::UNSCHEDULED;
51
52 // epoch is a long count at sample rate; 136 years at 48kHz
53
54 uint64_t _epoch = 0; // the epoch rendered currently in the busses
55 uint64_t _epochLength = 0; // number of frames in current epoch
56
57 // start and stop epoch (absolute, not relative)
58 uint64_t _startWhen = std::numeric_limits<uint64_t>::max();
59 uint64_t _stopWhen = std::numeric_limits<uint64_t>::max();
60
61 int _renderOffset = 0; // where rendering starts in the current frame
62 int _renderLength = 0; // number of rendered frames in the current frame
63
64 float _sampleRate = 1;
65
66 std::function<void()> _onEnded;
67
68 std::function<void(double when)> _onStart;
69};
70
71} // namespace
72

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected