| 28 | class ContextRenderLock; |
| 29 | |
| 30 | class AudioNodeScheduler |
| 31 | { |
| 32 | public: |
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected