| 410 | |
| 411 | |
| 412 | FL_OPTIMIZATION_LEVEL_O0_BEGIN // Works around a compile bug in clang 19 |
| 413 | float get_position(uint32_t now) { |
| 414 | if (autoAdvance.value()) { |
| 415 | // Check if auto-advance was just enabled |
| 416 | // Auto-advance mode: increment smoothly from current position |
| 417 | float elapsedSeconds = float(now - lastUpdateTime) / 1000.0f; |
| 418 | float increment = elapsedSeconds * speed.value() * |
| 419 | 0.3f; // Make it 1/20th the original speed |
| 420 | currentPosition = fl::fmodf(currentPosition + increment, 1.0f); |
| 421 | lastUpdateTime = now; |
| 422 | return currentPosition; |
| 423 | } else { |
| 424 | // Manual mode: use the dual slider control |
| 425 | float combinedPosition = positionCoarse.value() + positionFine.value() + positionExtraFine.value(); |
| 426 | // Clamp to ensure we don't exceed 1.0 |
| 427 | if (combinedPosition > 1.0f) |
| 428 | combinedPosition = 1.0f; |
| 429 | return combinedPosition; |
| 430 | } |
| 431 | } |
| 432 | FL_OPTIMIZATION_LEVEL_O0_END |
| 433 | |
| 434 | void fillFrameBufferNoise() { |