| 987 | // Always tear down anything in flight — even mid-speech / mid-effect |
| 988 | // — so a value change *during* the running preview cuts the previous |
| 989 | // sequence and restarts cleanly from the top. The 200ms scheduled |
| 990 | // delay below absorbs slider-drag bursts: each tick during a drag |
| 991 | // pushes _previewTime forward, so the chain only kicks in once the |
| 992 | // user pauses for ~200ms. |
| 993 | TerminatePreview(); |
| 994 | _doPreview = true; |
| 995 | _previewTime = GlobalTickCount() + 200; |
| 996 | LOG_DEBUG(Audio, "StartPreview: scheduled at tick {}", _previewTime); |
| 997 | } |
| 998 | |
| 999 | void SoundSystemOAL::TerminatePreview() |
| 1000 | { |
| 1001 | _previewSpeech.Free(); |
| 1002 | _previewEffect.Free(); |
| 1003 | _previewMusic.Free(); |
| 1004 | _previewCategory.Free(); |
| 1005 | // _previewDevice is also cut so a focus-leave from the Output Device |
| 1006 | // row stops audio. Reset the anchor — re-focusing and re-clicking |
| 1007 | // starts a brand new wall-clock-tracked session from offset 0. |