| 236 | } |
| 237 | |
| 238 | void AudioNodeScheduler::stop(double when) |
| 239 | { |
| 240 | // if the node is on the way to a terminal state do nothing |
| 241 | if (_playbackState >= SchedulingState::STOPPING) |
| 242 | return; |
| 243 | |
| 244 | // treat non-finite, and FLT_MAX as stop cancellation, if already playing |
| 245 | if (!isfinite(when) || when == std::numeric_limits<double>::max()) |
| 246 | { |
| 247 | // stop at a non-finite time means don't stop. |
| 248 | _stopWhen = std::numeric_limits<uint64_t>::max(); // cancel stop |
| 249 | if (_playbackState == SchedulingState::STOPPING) |
| 250 | { |
| 251 | // if in the process of stopping, set it back to scheduling to start immediately |
| 252 | _playbackState = SchedulingState::SCHEDULED; |
| 253 | _startWhen = 0; |
| 254 | } |
| 255 | |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | // clamp timing to now or the future |
| 260 | if (when < 0) |
| 261 | when = 0; |
| 262 | |
| 263 | // let the scheduler know when to activate the STOPPING state |
| 264 | _stopWhen = _epoch + static_cast<uint64_t>(when * _sampleRate); |
| 265 | } |
| 266 | |
| 267 | void AudioNodeScheduler::reset() |
| 268 | { |
no outgoing calls
no test coverage detected