FastLED 3.9.15
Loading...
Searching...
No Matches

◆ tick()

float animartrix_ring::SoundOrchestrator::tick ( fl::u32 nowMs,
float manualSpeedScalar )

Per-frame tick.

Pass the current millis() and a manual-speed scalar (so the existing "Time Speed" slider still composes). Returns the engine speed actually applied this tick.

Definition at line 233 of file sound_orchestrator.cpp.

233 {
234 if (mStateEnteredAtMs == 0) mStateEnteredAtMs = nowMs;
235
236 const SoundState newState = classify(nowMs);
237 if (newState != mState) {
238 mState = newState;
239 mStateEnteredAtMs = nowMs;
240 }
242
243 float speed;
244 switch (mState) {
245 case SoundState::Silence: speed = driveSilence(nowMs, manualSpeedScalar); break;
246 case SoundState::Disorganized: speed = driveDisorganized(nowMs, manualSpeedScalar); break;
247 case SoundState::BpmLocked: speed = driveBpmLocked(nowMs, manualSpeedScalar); break;
248 default: speed = manualSpeedScalar; break;
249 }
250
251 if (mEngine) mEngine->setSpeed(speed);
253 return speed;
254}
uint16_t speed
Definition Noise.ino:66
float driveBpmLocked(fl::u32 nowMs, float manualSpeedScalar)
void switchAnimationIfNeeded(SoundState newState, fl::u32 nowMs)
float driveSilence(fl::u32 nowMs, float manualSpeedScalar)
float driveDisorganized(fl::u32 nowMs, float manualSpeedScalar)

References animartrix_ring::BpmLocked, classify(), animartrix_ring::Disorganized, driveBpmLocked(), driveDisorganized(), driveSilence(), mEngine, mLastEngineSpeed, mState, mStateEnteredAtMs, animartrix_ring::Silence, speed, and switchAnimationIfNeeded().

+ Here is the call graph for this function: