| 321 | } |
| 322 | |
| 323 | void AudioPage::AudioProvider::TickPreviewLoop() |
| 324 | { |
| 325 | if (!GSoundsys) |
| 326 | return; |
| 327 | if (m_previewActiveRow < 0) |
| 328 | return; |
| 329 | uint32_t now = Poseidon::Foundation::GlobalTickCount(); |
| 330 | uint32_t elapsed = now - m_previewLoopTick; |
| 331 | const uint32_t kDwellMs = 250; |
| 332 | const uint32_t kLoopGapMs = 5000; |
| 333 | // Music is looping internally (Repeat=0 in StartCategoryPreview) |
| 334 | // so it doesn't need a 5 s replay — once started it just keeps |
| 335 | // playing. Effects + Speech are one-shot and benefit from the |
| 336 | // periodic replay so the user doesn't need to re-touch the slider. |
| 337 | uint32_t threshold = |
| 338 | m_previewStartedThisFocus ? (m_previewActiveRow == kRowMusic ? UINT32_MAX : kLoopGapMs) : kDwellMs; |
| 339 | if (elapsed < threshold) |
| 340 | return; |
| 341 | bool fired = false; |
| 342 | switch (m_previewActiveRow) |
| 343 | { |
| 344 | case kRowMusic: |
| 345 | GSoundsys->StartCategoryPreview(WaveMusic); |
| 346 | fired = true; |
| 347 | break; |
| 348 | case kRowEffects: |
| 349 | GSoundsys->StartCategoryPreview(WaveEffect); |
| 350 | fired = true; |
| 351 | break; |
| 352 | case kRowSpeech: |
| 353 | GSoundsys->StartCategoryPreview(WaveSpeech); |
| 354 | fired = true; |
| 355 | break; |
| 356 | case kRowEax: |
| 357 | GSoundsys->StartEAXPreview(); |
| 358 | fired = true; |
| 359 | break; |
| 360 | // Output device intentionally NOT auto-started on focus — the |
| 361 | // device preview is gated on first value change so opening Audio |
| 362 | // doesn't spam audio when the user is just navigating. |
| 363 | default: |
| 364 | break; |
| 365 | } |
| 366 | if (fired) |
| 367 | { |
| 368 | m_previewStartedThisFocus = true; |
| 369 | m_previewLoopTick = now; |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | void AudioPage::AudioProvider::OnRowAction(int row, Display& host) |
| 374 | { |
no test coverage detected