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

Method stop

src/core/AudioNode.cpp:238–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238void 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
267void AudioNodeScheduler::reset()
268{

Callers 3

uninitializeMethod · 0.45
suspendMethod · 0.45
playMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected