| 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. |
| 1008 | _previewDevice.Free(); |
| 1009 | _devicePreviewAnchorMs = 0; |
| 1010 | _devicePreviewLengthSec = 0.0f; |
| 1011 | _previewEax.Free(); |
| 1012 | _doPreview = false; |
| 1013 | LOG_DEBUG(Audio, "TerminatePreview"); |
| 1014 | } |
| 1015 | |
| 1016 | void SoundSystemOAL::StartEAXPreview() |
| 1017 | { |
| 1018 | if (!_enablePreview) |
| 1019 | return; |
| 1020 | |
| 1021 | // Cut anything else; this is a focused A/B test where the user |
| 1022 | // toggles EAX on/off. |
| 1023 | _previewSpeech.Free(); |
| 1024 | _previewEffect.Free(); |
| 1025 | _previewMusic.Free(); |
| 1026 | _previewCategory.Free(); |
| 1027 | _previewDevice.Free(); |
| 1028 | _previewEax.Free(); |
| 1029 | _doPreview = false; |
| 1030 | |
| 1031 | // Use one of the environments the game actually exposes at |
| 1032 | // runtime (SoundSystemOAL::ApplyEFXPreset maps SEPlain / SEForest / |
| 1033 | // SECity / SEMountains / SERoom — that's the full set of reverbs |
| 1034 | // shipping in stock missions). SERoom is the most audibly distinct |
| 1035 | // from the default outdoor SEPlain so the on/off diff is obvious; |
| 1036 | // toggling EAX off plays the sample dry, which is exactly the |
| 1037 | // contrast we want the user to hear. |
| 1038 | if (_canEAX && _eaxEnabled) |
| 1039 | SetEnvironment(SoundEnvironment{SERoom, 1.9f, 0.5f}); |
| 1040 | |
| 1041 | const ParamEntry& cfg = Pars >> "CfgSFX" >> "Preview" >> "effect"; |
| 1042 | RStringB name = cfg[0]; |
| 1043 | IWave* wave = CreateWave(name, true, false); |
| 1044 | _previewEax = wave; |
| 1045 | if (!wave) |
| 1046 | { |
| 1047 | LOG_WARN(Audio, "StartEAXPreview: failed to create wave '{}'", static_cast<const char*>(name)); |
| 1048 | return; |
| 1049 | } |
| 1050 | wave->SetKind(WaveEffect); |
| 1051 | wave->EnableAccommodation(false); |
| 1052 | wave->SetSticky(true); |
| 1053 | wave->SetVolume((float)cfg[1], cfg[2], true); |
| 1054 | // 3D position close to the listener so the effect's reverb tail |
| 1055 | // is fully audible (the EFX send is per-source distance-attenuated; |
nothing calls this directly
no test coverage detected