| 2105 | } |
| 2106 | |
| 2107 | static void DrawAudioOptionsMenu() |
| 2108 | { |
| 2109 | float itemWidth = ImGui::GetContentRegionAvail().x - audioMenuItemOffset; |
| 2110 | ImGui::PushItemWidth( itemWidth ); |
| 2111 | |
| 2112 | ALCdevice* alDevice = soundSystemLocal.openalDevice; |
| 2113 | |
| 2114 | if ( alDevice == nullptr ) { |
| 2115 | if ( soundSystemLocal.s_noSound.GetBool() ) { |
| 2116 | ImGui::TextDisabled( "Sound is disabled with s_noSound, so there's nothing to show here!" ); |
| 2117 | } else { |
| 2118 | ImGui::TextDisabled( "!!! No OpenAL device is opened, so there is no sound !!!" ); |
| 2119 | } |
| 2120 | return; |
| 2121 | } |
| 2122 | |
| 2123 | ImGui::SeparatorText( "Settings that require restarting dhewm3" ); |
| 2124 | |
| 2125 | if ( ImGui::Combo( "Sound Device", &selAlDevice, [](void* data, int idx) -> const char* { |
| 2126 | const idStrList& devs = *static_cast< const idStrList* >(data); |
| 2127 | return devs[idx].c_str(); |
| 2128 | }, &alDevices, alDevices.Num() ) ) |
| 2129 | { |
| 2130 | if ( selAlDevice == 0 ) { |
| 2131 | idSoundSystemLocal::s_device.SetString( "default" ); |
| 2132 | } else { |
| 2133 | idSoundSystemLocal::s_device.SetString( alDevices[selAlDevice] ); |
| 2134 | } |
| 2135 | D3::ImGuiHooks::ShowWarningOverlay( "Changing the sound device only takes effect after restarting dhewm3!" ); |
| 2136 | } |
| 2137 | AddTooltip( "s_device" ); |
| 2138 | |
| 2139 | if ( !idSoundSystemLocal::EFXAvailable ) { |
| 2140 | ImGui::BeginDisabled(); |
| 2141 | bool b = false; |
| 2142 | ImGui::Checkbox( "Use EAX/EFX Reverb Effects", &b ); |
| 2143 | AddTooltip( "EFX effects are not available in your OpenAL implementation.\nConsider using OpenAL-Soft." ); |
| 2144 | ImGui::EndDisabled(); |
| 2145 | } else { |
| 2146 | bool useReverb = idSoundSystemLocal::s_useEAXReverb.GetBool(); |
| 2147 | if ( ImGui::Checkbox( "Use EAX/EFX Reverb Effects", &useReverb ) ) { |
| 2148 | idSoundSystemLocal::s_useEAXReverb.SetBool( useReverb ); |
| 2149 | if ( useReverb != idSoundSystemLocal::useEFXReverb ) { |
| 2150 | D3::ImGuiHooks::ShowWarningOverlay( "Enabling/disabling EFX only takes effect after restarting dhewm3!" ); |
| 2151 | } |
| 2152 | } |
| 2153 | AddTooltip( "s_useEAXReverb" ); |
| 2154 | } |
| 2155 | |
| 2156 | ImGui::SeparatorText( "Settings that take effect immediately" ); |
| 2157 | |
| 2158 | float vol = idSoundSystemLocal::s_volume.GetFloat(); // cvar is called s_volume_dB |
| 2159 | if ( vol == 0.0f && signbit(vol) != 0 ) { |
| 2160 | vol = 0.0f; // turn -0.0 into 0.0 |
| 2161 | } |
| 2162 | if ( ImGui::SliderFloat( "Volume", &vol, -40, 10, "%.1f" ) ) { |
| 2163 | idSoundSystemLocal::s_volume.SetFloat( vol ); |
| 2164 | } |
no test coverage detected