From 170bb58487248a69052a1c7c45c1fdac139a9a65 Mon Sep 17 00:00:00 2001 From: maj00r Date: Tue, 17 Nov 2026 03:11:16 +0100 Subject: [PATCH] feat(settings): the simulator's OpenAL Soft options in the sound category A new "Sound device and effects" section sets the eu07.ini keys the simulator reads for OpenAL Soft: sound.openal.renderer (device), sound.outputmode, sound.hrtf, sound.hrtf.profile, sound.resampler, sound.limiter, sound.frequency, sound.doppler, sound.efx.lowpass and sound.efx.airabsorption. The lists of devices, HRTF data sets and resamplers come from the OpenAL library in the game folder (OpenAL32.dll / libopenal.so.1), read in the background through NativeLibrary and function pointers (AllowUnsafeBlocks); without it, or with an older library, the lists hold the file's value and the library's choice. Names with spaces are written in quotes, an empty name takes its line out, and a key the file lacks is written only when it differs from the simulator's default, so saving with these left alone adds nothing. sound.maxsources is left out: OpenAL Soft gives at least 256 sources whatever is asked, so it would be a setting that does nothing; a line the file has stays as it is. A device name code page 1250 cannot hold, the encoding of eu07.ini, is not offered, as it would reach the simulator as question marks. HRTF data sets and resamplers are offered only with ASCII names, since the simulator looks those up by the library's own spelling. A value a slider can't show, outside its range or between its ticks, is kept by the page's shown-unlike bookkeeping until the slider is moved. Strings in en and pl with descriptions, labels in cz, hu and ru. --- StarterNG.Tests/SettingsStoreTests.cs | 71 ++++++++ .../Domain/Settings/SimulatorSettings.cs | 23 +++ StarterNG/Infrastructure/OpenAlProbe.cs | 159 ++++++++++++++++++ .../Settings/SettingsSerializer.cs | 61 +++++++ StarterNG/StarterNG.csproj | 2 + StarterNG/Views/Settings.Sound.cs | 87 ++++++++++ StarterNG/Views/Settings.axaml | 80 +++++++++ StarterNG/Views/Settings.axaml.cs | 3 + StarterNG/startercfg/lang/cz.xml | 20 +++ StarterNG/startercfg/lang/en.xml | 30 ++++ StarterNG/startercfg/lang/hu.xml | 20 +++ StarterNG/startercfg/lang/pl.xml | 30 ++++ StarterNG/startercfg/lang/ru.xml | 20 +++ 13 files changed, 606 insertions(+) create mode 100644 StarterNG/Infrastructure/OpenAlProbe.cs create mode 100644 StarterNG/Views/Settings.Sound.cs diff --git a/StarterNG.Tests/SettingsStoreTests.cs b/StarterNG.Tests/SettingsStoreTests.cs index 68c1730..5cd9eeb 100644 --- a/StarterNG.Tests/SettingsStoreTests.cs +++ b/StarterNG.Tests/SettingsStoreTests.cs @@ -1520,4 +1520,75 @@ public class SettingsStoreTests Assert.Null(LineFor(installation, "blackbox")); } + + [Fact] + public void The_sound_device_options_left_alone_add_nothing_to_the_file() + { + var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "width 1920\n")); + installation.SettingsStore.Load(); + + installation.SettingsStore.Save(); + + string saved = SavedLines(installation); + foreach (var key in new[] { "sound.openal.renderer", "sound.outputmode", "sound.hrtf", "sound.hrtf.profile", + "sound.resampler", "sound.limiter", "sound.frequency", "sound.maxsources", + "sound.doppler", "sound.efx.lowpass", "sound.efx.airabsorption" }) + Assert.Null(LineFor(installation, key)); + Assert.Contains("width 1920\n", saved); + } + + [Fact] + public void The_sound_device_options_survive_a_round_trip_with_names_in_quotes() + { + var installation = WithHome(); + installation.SettingsStore.Load(); + var s = installation.SettingsStore.Settings; + s.AudioDevice = "OpenAL Soft on Speakers (Realtek(R) Audio)"; + s.AudioOutputMode = "headphones"; + s.AudioHrtf = "on"; + s.AudioHrtfProfile = "Built-In HRTF"; + s.AudioResampler = "Cubic"; + s.AudioLimiter = "off"; + s.AudioFrequency = 48000; + s.AudioDoppler = 0.5; + s.AudioLowpass = true; + s.AudioAirAbsorption = 1.0; + + installation.SettingsStore.Save(); + + Assert.Equal("sound.openal.renderer \"OpenAL Soft on Speakers (Realtek(R) Audio)\"", + LineFor(installation, "sound.openal.renderer")); + Assert.Equal("sound.resampler Cubic", LineFor(installation, "sound.resampler")); + Assert.Empty(BareSimulatorKeys(installation)); + + var again = WithHome(new InMemoryFileSystem().WithFile(UserIni, installation.Files.ReadAllText(UserIni))); + again.SettingsStore.Load(); + var read = again.SettingsStore.Settings; + Assert.Equal(s.AudioDevice, read.AudioDevice); + Assert.Equal("headphones", read.AudioOutputMode); + Assert.Equal("on", read.AudioHrtf); + Assert.Equal("Built-In HRTF", read.AudioHrtfProfile); + Assert.Equal("Cubic", read.AudioResampler); + Assert.Equal("off", read.AudioLimiter); + Assert.Equal(48000, read.AudioFrequency); + Assert.Equal(0.5, read.AudioDoppler, 6); + Assert.True(read.AudioLowpass); + Assert.Equal(1.0, read.AudioAirAbsorption, 6); + } + + [Fact] + public void A_sound_name_set_back_to_the_librarys_choice_takes_its_line_out() + { + var installation = WithHome(new InMemoryFileSystem() + .WithFile(UserIni, "sound.openal.renderer \"Old Device\"\nsound.resampler Cubic\n")); + installation.SettingsStore.Load(); + Assert.Equal("Old Device", installation.SettingsStore.Settings.AudioDevice); + + installation.SettingsStore.Settings.AudioDevice = ""; + installation.SettingsStore.Settings.AudioResampler = ""; + installation.SettingsStore.Save(); + + Assert.Null(LineFor(installation, "sound.openal.renderer")); + Assert.Null(LineFor(installation, "sound.resampler")); + } } diff --git a/StarterNG/Domain/Settings/SimulatorSettings.cs b/StarterNG/Domain/Settings/SimulatorSettings.cs index b62bf3e..c8b573d 100644 --- a/StarterNG/Domain/Settings/SimulatorSettings.cs +++ b/StarterNG/Domain/Settings/SimulatorSettings.cs @@ -161,6 +161,29 @@ public sealed class SimulatorSettings public int VehiclesVolume = 100; public int PositionalVolume = 100; public int AmbientVolume = 100; + + // OpenAL Soft options of the simulator; the defaults leave the choice to the library, as the + // simulator did before it had these keys. + /// sound.openal.renderer: the output device, empty for the system's default. + public string AudioDevice = ""; + /// sound.outputmode: auto, mono, stereo, stereo-basic, uhj, headphones, quad, 5.1, 6.1, 7.1. + public string AudioOutputMode = "auto"; + /// sound.hrtf: auto, on, off. + public string AudioHrtf = "auto"; + /// sound.hrtf.profile: the HRTF data set, empty for the library's choice. + public string AudioHrtfProfile = ""; + /// sound.resampler: empty for the library's default. + public string AudioResampler = ""; + /// sound.limiter: auto, on, off. + public string AudioLimiter = "auto"; + /// sound.frequency: the mixing rate in Hz, 0 for the device's. + public int AudioFrequency; + /// sound.doppler: the strength of the Doppler effect. + public double AudioDoppler = 0.25; + /// sound.efx.lowpass: soundproofing also muffles the high frequencies. + public bool AudioLowpass; + /// sound.efx.airabsorption: 0-10, the high frequencies fade with distance. + public double AudioAirAbsorption; public bool SkipPipeline; public int PythonScreenUpdateRate = 200; public bool DebugLogVisible; diff --git a/StarterNG/Infrastructure/OpenAlProbe.cs b/StarterNG/Infrastructure/OpenAlProbe.cs new file mode 100644 index 0000000..bf37047 --- /dev/null +++ b/StarterNG/Infrastructure/OpenAlProbe.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace StarterNG.Infrastructure; + +/// What the simulator's OpenAL library offers for its sound settings. +public sealed record AudioChoices(IReadOnlyList Devices, IReadOnlyList HrtfProfiles, IReadOnlyList Resamplers) +{ + public static AudioChoices None { get; } = new(Array.Empty(), Array.Empty(), Array.Empty()); +} + +/// +/// Asks the OpenAL library beside the simulator, the one it plays through, for the output devices, +/// the HRTF data sets and the resamplers. The data sets and the resamplers are known only with a +/// device open, so the default one is opened for a moment. An older library (OpenAL Soft before +/// 1.19 lists no resamplers), or none at all, gives what it can and empty lists for the rest. +/// +public static unsafe class OpenAlProbe +{ + private const int AlcDeviceSpecifier = 0x1005; + private const int AlcAllDevicesSpecifier = 0x1013; + private const int AlcNumHrtfSpecifiers = 0x1994; + private const int AlcHrtfSpecifier = 0x1995; + private const int AlNumResamplers = 0x1210; + private const int AlResamplerName = 0x1213; + + /// The file of the library in the simulator's folder. + public static string LibraryFile => OperatingSystem.IsWindows() ? "OpenAL32.dll" : "libopenal.so.1"; + + public static AudioChoices Read(string gameFolder) + { + // The library stays loaded: OpenAL Soft keeps threads of its own, unloading it under them is not safe. + if (!NativeLibrary.TryLoad(Path.Combine(gameFolder, LibraryFile), out IntPtr library)) + return AudioChoices.None; + try + { + return new Api(library).Read(); + } + catch (EntryPointNotFoundException) + { + return AudioChoices.None; + } + } + + /// The entry points of one library; the extension ones are null where it lacks them. + private sealed class Api + { + private readonly delegate* unmanaged[Cdecl] _alcIsExtensionPresent; + private readonly delegate* unmanaged[Cdecl] _alcGetString; + private readonly delegate* unmanaged[Cdecl] _alcOpenDevice; + private readonly delegate* unmanaged[Cdecl] _alcCloseDevice; + private readonly delegate* unmanaged[Cdecl] _alcCreateContext; + private readonly delegate* unmanaged[Cdecl] _alcMakeContextCurrent; + private readonly delegate* unmanaged[Cdecl] _alcDestroyContext; + private readonly delegate* unmanaged[Cdecl] _alcGetIntegerv; + private readonly delegate* unmanaged[Cdecl] _alGetInteger; + private readonly delegate* unmanaged[Cdecl] _alcGetStringiSOFT; + private readonly delegate* unmanaged[Cdecl] _alGetStringiSOFT; + + public Api(IntPtr library) + { + _alcIsExtensionPresent = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcIsExtensionPresent"); + _alcGetString = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcGetString"); + _alcOpenDevice = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcOpenDevice"); + _alcCloseDevice = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcCloseDevice"); + _alcCreateContext = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcCreateContext"); + _alcMakeContextCurrent = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcMakeContextCurrent"); + _alcDestroyContext = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcDestroyContext"); + _alcGetIntegerv = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alcGetIntegerv"); + _alGetInteger = (delegate* unmanaged[Cdecl])NativeLibrary.GetExport(library, "alGetInteger"); + // OpenAL Soft exports its extension functions too; a library without them leaves these null. + NativeLibrary.TryGetExport(library, "alcGetStringiSOFT", out IntPtr getStringi); + _alcGetStringiSOFT = (delegate* unmanaged[Cdecl])getStringi; + NativeLibrary.TryGetExport(library, "alGetStringiSOFT", out IntPtr alGetStringi); + _alGetStringiSOFT = (delegate* unmanaged[Cdecl])alGetStringi; + } + + public AudioChoices Read() + { + int deviceList = HasExtension("ALC_ENUMERATE_ALL_EXT\0"u8) ? AlcAllDevicesSpecifier : AlcDeviceSpecifier; + List devices = NameList(_alcGetString(IntPtr.Zero, deviceList)); + + IntPtr device = _alcOpenDevice(null); + if (device == IntPtr.Zero) + return new AudioChoices(devices, Array.Empty(), Array.Empty()); + try + { + return new AudioChoices(devices, HrtfProfiles(device), Resamplers(device)); + } + finally + { + _alcCloseDevice(device); + } + } + + private bool HasExtension(ReadOnlySpan name) + { + fixed (byte* text = name) + return _alcIsExtensionPresent(IntPtr.Zero, text) != 0; + } + + private List HrtfProfiles(IntPtr device) + { + var names = new List(); + if (_alcGetStringiSOFT == null) + return names; + int count = 0; + _alcGetIntegerv(device, AlcNumHrtfSpecifiers, 1, &count); + for (int index = 0; index < count; index++) + names.Add(Utf8(_alcGetStringiSOFT(device, AlcHrtfSpecifier, index))); + return names; + } + + private List Resamplers(IntPtr device) + { + var names = new List(); + if (_alGetStringiSOFT == null) + return names; + IntPtr context = _alcCreateContext(device, null); + if (context == IntPtr.Zero) + return names; + try + { + _alcMakeContextCurrent(context); + int count = _alGetInteger(AlNumResamplers); + for (int index = 0; index < count; index++) + names.Add(Utf8(_alGetStringiSOFT(AlResamplerName, index))); + } + finally + { + _alcMakeContextCurrent(IntPtr.Zero); + _alcDestroyContext(context); + } + return names; + } + } + + private static string Utf8(byte* text) => text == null ? "" : Marshal.PtrToStringUTF8((IntPtr)text) ?? ""; + + /// A list of null-terminated names ending with an empty one, as OpenAL gives the devices. + private static List NameList(byte* list) + { + var names = new List(); + if (list == null) + return names; + while (*list != 0) + { + int length = 0; + while (list[length] != 0) + length++; + names.Add(Encoding.UTF8.GetString(list, length)); + list += length + 1; + } + return names; + } +} diff --git a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs index 50a9a48..b574f77 100644 --- a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs +++ b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs @@ -194,6 +194,7 @@ public sealed class SettingsSerializer s.VehiclesVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.vehicle", 1.0) * 100), 0, 100); s.PositionalVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.positional", 1.0) * 100), 0, 100); s.AmbientVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.ambient", 1.0) * 100), 0, 100); + ReadAudioDevice(c, s); s.SkipPipeline = c.GetBool("gfx.skippipeline", false); s.PythonScreenUpdateRate = c.Has("python.updatetime") ? Clamp(c.GetInt("python.updatetime", 200), 0, 10000) @@ -412,6 +413,7 @@ public sealed class SettingsSerializer c.SetDouble("sound.volume.vehicle", s.VehiclesVolume / 100.0); c.SetDouble("sound.volume.positional", s.PositionalVolume / 100.0); c.SetDouble("sound.volume.ambient", s.AmbientVolume / 100.0); + WriteAudioDevice(c, s); c.SetBool("gfx.skippipeline", s.SkipPipeline); c.SetInt("python.updatetime", s.PythonScreenUpdateRate); @@ -457,6 +459,65 @@ public sealed class SettingsSerializer return Clamp((int)Math.Round(value > 4 ? value : value * 100), 25, 200); } + // The OpenAL Soft options. The names (devices, HRTF data sets, resamplers) can hold spaces, so + // the simulator takes them in quotes. + private static void ReadAudioDevice(ConfigFile c, SimulatorSettings s) + { + s.AudioDevice = Unquoted(c.GetString("sound.openal.renderer", "")); + s.AudioOutputMode = FirstTokenOr(c, "sound.outputmode", "auto"); + s.AudioHrtf = FirstTokenOr(c, "sound.hrtf", "auto"); + s.AudioHrtfProfile = Unquoted(c.GetString("sound.hrtf.profile", "")); + s.AudioResampler = Unquoted(c.GetString("sound.resampler", "")); + s.AudioLimiter = FirstTokenOr(c, "sound.limiter", "auto"); + s.AudioFrequency = Clamp(c.GetInt("sound.frequency", 0), 0, 192000); + s.AudioDoppler = Math.Clamp(c.GetDouble("sound.doppler", 0.25), 0.0, 10.0); + s.AudioLowpass = c.GetBool("sound.efx.lowpass", false); + s.AudioAirAbsorption = Math.Clamp(c.GetDouble("sound.efx.airabsorption", 0.0), 0.0, 10.0); + } + + // A key the file lacks is written only when the value differs from the simulator's default, so + // saving with these left alone adds nothing an older simulator would not know. + private static void WriteAudioDevice(ConfigFile c, SimulatorSettings s) + { + SetName(c, "sound.openal.renderer", s.AudioDevice); + SetUnlessDefault(c, "sound.outputmode", s.AudioOutputMode, "auto"); + SetUnlessDefault(c, "sound.hrtf", s.AudioHrtf, "auto"); + SetName(c, "sound.hrtf.profile", s.AudioHrtfProfile); + SetName(c, "sound.resampler", s.AudioResampler); + SetUnlessDefault(c, "sound.limiter", s.AudioLimiter, "auto"); + if (c.Has("sound.frequency") || s.AudioFrequency != 0) c.SetInt("sound.frequency", s.AudioFrequency); + if (c.Has("sound.doppler") || Math.Abs(s.AudioDoppler - 0.25) > 1e-9) c.SetDouble("sound.doppler", s.AudioDoppler); + if (c.Has("sound.efx.lowpass") || s.AudioLowpass) c.SetBool("sound.efx.lowpass", s.AudioLowpass); + if (c.Has("sound.efx.airabsorption") || s.AudioAirAbsorption != 0.0) c.SetDouble("sound.efx.airabsorption", s.AudioAirAbsorption); + } + + private static void SetUnlessDefault(ConfigFile c, string key, string value, string fallback) + { + if (c.Has(key) || value != fallback) + c.Set(key, value); + } + + // An empty name is the library's choice: the line goes, rather than staying with a name in it. + private static void SetName(ConfigFile c, string key, string name) + { + if (name.Length > 0) + c.Set(key, name.Contains(' ') ? $"\"{name}\"" : name); + else if (c.Has(key)) + c.Remove(key); + } + + private static string Unquoted(string value) + { + value = value.Trim(); + return value.Length >= 2 && value[0] == '"' && value[^1] == '"' ? value[1..^1] : value; + } + + private static string FirstTokenOr(ConfigFile c, string key, string fallback) + { + string token = FirstToken(c, key); + return token.Length > 0 ? token : fallback; + } + private static string FirstToken(ConfigFile c, string key) { var tokens = c.GetTokens(key); diff --git a/StarterNG/StarterNG.csproj b/StarterNG/StarterNG.csproj index ca073c5..761939e 100644 --- a/StarterNG/StarterNG.csproj +++ b/StarterNG/StarterNG.csproj @@ -6,6 +6,8 @@ true net9.0 enable + + true true app.manifest Assets\starter.ico diff --git a/StarterNG/Views/Settings.Sound.cs b/StarterNG/Views/Settings.Sound.cs new file mode 100644 index 0000000..c34d197 --- /dev/null +++ b/StarterNG/Views/Settings.Sound.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Avalonia.Controls; +using StarterNG.Application; +using StarterNG.Domain.Settings; +using StarterNG.Infrastructure; +using StarterNG.Infrastructure.Adapters; + +namespace StarterNG.Views; + +// The OpenAL Soft options of the sound category. The lists of devices, HRTF data sets and +// resamplers come from the simulator's own OpenAL library, read in the background; until then, +// and where the library cannot say, a list holds the library's choice and the value of the file. +public partial class Settings +{ + // eu07.ini is written in code page 1250: a name it cannot hold (a device named in Cyrillic, say) + // would reach the simulator as question marks, so such a name is not offered. + private static readonly Encoding StrictCodePage1250 = + Encoding.GetEncoding(LegacyText.CodePage1250.CodePage, EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback); + + private async void ReadAudioChoices() + { + string root = AppServices.Current.Paths.Root; + AudioChoices choices = await Task.Run(() => OpenAlProbe.Read(root)); + // Adding items leaves the selection alone, so this marks nothing as changed. + AddNames(AudioDeviceCb, choices.Devices, FitsTheFile); + // The simulator finds a device named in code page 1250 too, but an HRTF data set or a + // resampler only by the library's own spelling, so of those only plain ASCII is offered. + AddNames(AudioHrtfProfileCb, choices.HrtfProfiles, PlainAscii); + AddNames(AudioResamplerCb, choices.Resamplers, PlainAscii); + } + + private static void AddNames(ComboBox cb, IReadOnlyList names, Func offered) + { + foreach (string name in names) + if (name.Length > 0 && offered(name) && IndexOfTag(cb, name) < 0) + cb.Items.Add(new ComboBoxItem { Tag = name, Content = name }); + } + + private static bool PlainAscii(string name) => Ascii.IsValid(name); + + private static bool FitsTheFile(string name) + { + try + { + StrictCodePage1250.GetByteCount(name); + return true; + } + catch (EncoderFallbackException) + { + return false; + } + } + + private void ShowSound(SimulatorSettings s) + { + SelectOrAddTag(AudioDeviceCb, s.AudioDevice, s.AudioDevice); + SelectOrAddTag(AudioOutputModeCb, s.AudioOutputMode, s.AudioOutputMode); + SelectOrAddTag(AudioHrtfCb, s.AudioHrtf, s.AudioHrtf); + SelectOrAddTag(AudioHrtfProfileCb, s.AudioHrtfProfile, s.AudioHrtfProfile); + SelectOrAddTag(AudioResamplerCb, s.AudioResampler, s.AudioResampler); + SelectOrAddTag(AudioLimiterCb, s.AudioLimiter, s.AudioLimiter); + string frequency = s.AudioFrequency.ToString(Invariant); + SelectOrAddTag(AudioFrequencyCb, frequency, frequency + " Hz"); + AudioDopplerSlider.Value = s.AudioDoppler; + AudioLowpassCb.IsChecked = s.AudioLowpass; + AudioAirAbsorptionSlider.Value = s.AudioAirAbsorption; + } + + private void CaptureSound(SimulatorSettings s) + { + s.AudioDevice = SelectedTag(AudioDeviceCb) ?? ""; + s.AudioOutputMode = SelectedTag(AudioOutputModeCb) ?? "auto"; + s.AudioHrtf = SelectedTag(AudioHrtfCb) ?? "auto"; + s.AudioHrtfProfile = SelectedTag(AudioHrtfProfileCb) ?? ""; + s.AudioResampler = SelectedTag(AudioResamplerCb) ?? ""; + s.AudioLimiter = SelectedTag(AudioLimiterCb) ?? "auto"; + s.AudioFrequency = TagInt(AudioFrequencyCb, 0); + // A value the slider can't show (past its end, between its ticks) is kept by the + // shown-unlike bookkeeping of the page until the slider is moved. + s.AudioDoppler = AudioDopplerSlider.Value; + s.AudioLowpass = IsChecked(AudioLowpassCb); + s.AudioAirAbsorption = AudioAirAbsorptionSlider.Value; + } +} diff --git a/StarterNG/Views/Settings.axaml b/StarterNG/Views/Settings.axaml index 1e4886b..5be943c 100644 --- a/StarterNG/Views/Settings.axaml +++ b/StarterNG/Views/Settings.axaml @@ -537,6 +537,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/StarterNG/Views/Settings.axaml.cs b/StarterNG/Views/Settings.axaml.cs index 6dce6ff..225d0de 100644 --- a/StarterNG/Views/Settings.axaml.cs +++ b/StarterNG/Views/Settings.axaml.cs @@ -100,6 +100,7 @@ public partial class Settings : UserControl, ISettingsCapture BuildPresetButtons(); BuildMonitorRates(); ReadGraphicsCards(); + ReadAudioChoices(); App.Loc.LanguageChanged += UpdateCardText; App.Loc.LanguageChanged += _keyRows.UpdateTexts; @@ -436,6 +437,7 @@ public partial class Settings : UserControl, ISettingsCapture LogMissingVehicleFilesCb.IsChecked = s.LogMissingVehicleFiles; ShowGraphics(s); + ShowSound(s); GpuCb.SelectedIndex = s.Gpu == GpuPreference.System ? 1 : 0; SelectResolution(s.Width, s.Height); bufferScale.Value = s.BufferScalePercent; @@ -869,6 +871,7 @@ public partial class Settings : UserControl, ISettingsCapture s.LogMissingVehicleFiles = IsChecked(LogMissingVehicleFilesCb); CaptureGraphics(s); + CaptureSound(s); s.Gpu = SelectedGpu(); ReadResolution(s); s.BufferScalePercent = (int)bufferScale.Value; diff --git a/StarterNG/startercfg/lang/cz.xml b/StarterNG/startercfg/lang/cz.xml index 9bbfc85..1ab2f5f 100644 --- a/StarterNG/startercfg/lang/cz.xml +++ b/StarterNG/startercfg/lang/cz.xml @@ -518,6 +518,26 @@ Hlasitost vozidel Hlasitost prostorových zvuků Hlasitost okolí + Zvukové zařízení a efekty + Výstupní zařízení + Výchozí systémové + Rozložení reproduktorů + Automaticky + Stereo (jednoduché panorama) + Stereo (UHJ, širší) + Sluchátka (HRTF) + Zapnuto + Vypnuto + Sada dat HRTF + Volba knihovny + Převzorkování + Výchozí knihovny + Omezovač výstupu + Vzorkovací frekvence mixu + Frekvence zařízení + Dopplerův jev + Tlumené zvuky mimo kabinu + Pohlcování vzduchem Pokročilé Komprimovat textury TGA diff --git a/StarterNG/startercfg/lang/en.xml b/StarterNG/startercfg/lang/en.xml index db28d6a..8fe7988 100644 --- a/StarterNG/startercfg/lang/en.xml +++ b/StarterNG/startercfg/lang/en.xml @@ -544,6 +544,36 @@ Vehicles volume Positional sounds volume Ambient volume + Sound device and effects + Output device + The device the simulator plays through. The system default follows the device chosen in the system, also when it changes during the game. + System default + Speaker layout + How the sound is mixed: for headphones, stereo speakers or a surround set. Automatic takes what the device reports. + Automatic + Stereo (simple panning) + Stereo (UHJ, wider) + Headphones (HRTF) + Head-related sound for headphones: sources behind, above and below can be told apart. Automatic turns it on where the device is headphones. + On + Off + HRTF data set + Which head model HRTF uses, of those the library has. A different one may suit your ears better. + Library's choice + Resampler + How sounds are converted to the device's rate and pitched. The better ones sound cleaner and cost a little more processor time. + Library default + Output limiter + Keeps loud moments from clipping by turning the whole mix down for a moment. + Mixing rate + The sample rate the sound is mixed at. The device's own rate avoids converting it once more. + Device rate + Doppler effect + How much the pitch of a passing vehicle changes. 0 turns the effect off, 1 is the physical one. + Muffled sounds outside the cab + Sounds heard through the cab walls lose their high tones as well as their loudness. + Air absorption + Distant sounds lose their high tones, as in the open air. 0 turns it off, 1 is the natural amount. Advanced Compress TGA textures diff --git a/StarterNG/startercfg/lang/hu.xml b/StarterNG/startercfg/lang/hu.xml index e65ecd9..c7eef1f 100644 --- a/StarterNG/startercfg/lang/hu.xml +++ b/StarterNG/startercfg/lang/hu.xml @@ -518,6 +518,26 @@ Járművek hangereje Térbeli hangok hangereje Környezeti hangok hangereje + Hangeszköz és effektek + Kimeneti eszköz + Rendszer alapértelmezése + Hangszóró-elrendezés + Automatikus + Sztereó (egyszerű panoráma) + Sztereó (UHJ, szélesebb) + Fejhallgató (HRTF) + Be + Ki + HRTF-adatkészlet + A könyvtár választása + Újramintavételezés + A könyvtár alapértelmezése + Kimeneti limiter + Keverési mintavételi frekvencia + Az eszköz frekvenciája + Doppler-hatás + Tompított hangok a fülkén kívülről + Levegő általi elnyelés Speciális TGA textúrák tömörítése diff --git a/StarterNG/startercfg/lang/pl.xml b/StarterNG/startercfg/lang/pl.xml index 5ab0d59..f93405f 100644 --- a/StarterNG/startercfg/lang/pl.xml +++ b/StarterNG/startercfg/lang/pl.xml @@ -544,6 +544,36 @@ Głośność pojazdów Głośność dźwięków pozycjonowanych Głośność otoczenia + Urządzenie i efekty dźwięku + Urządzenie wyjściowe + Urządzenie, przez które gra symulator. Domyślne systemowe idzie za urządzeniem wybranym w systemie, także gdy zmieni się ono w trakcie gry. + Domyślne systemowe + Układ głośników + Jak dźwięk jest miksowany: na słuchawki, głośniki stereo albo zestaw dookólny. Automatycznie bierze to, co zgłasza urządzenie. + Automatycznie + Stereo (proste panoramowanie) + Stereo (UHJ, szersze) + Słuchawki (HRTF) + Dźwięk przestrzenny na słuchawki: źródła z tyłu, z góry i z dołu dają się odróżnić. Automatycznie włącza go, gdy urządzeniem są słuchawki. + Włączone + Wyłączone + Zestaw danych HRTF + Którego modelu głowy używa HRTF, spośród tych, które ma biblioteka. Inny może lepiej pasować do twoich uszu. + Wybór biblioteki + Przepróbkowanie + Jak dźwięki są przeliczane na częstotliwość urządzenia i zmieniają wysokość. Lepsze brzmią czyściej i kosztują trochę więcej czasu procesora. + Domyślne biblioteki + Ogranicznik wyjścia + Chroni głośne chwile przed przesterowaniem, na moment ściszając cały miks. + Częstotliwość miksowania + Częstotliwość próbkowania, z jaką dźwięk jest miksowany. Własna częstotliwość urządzenia oszczędza jeszcze jednego przeliczenia. + Częstotliwość urządzenia + Efekt Dopplera + Jak bardzo zmienia się wysokość dźwięku przejeżdżającego pojazdu. 0 wyłącza efekt, 1 to wartość fizyczna. + Stłumione dźwięki spoza kabiny + Dźwięki słyszane przez ściany kabiny tracą wysokie tony, a nie tylko głośność. + Pochłanianie przez powietrze + Odległe dźwięki tracą wysokie tony, jak na otwartej przestrzeni. 0 wyłącza, 1 to naturalna wartość. Zaawansowane Kompresuj tekstury TGA diff --git a/StarterNG/startercfg/lang/ru.xml b/StarterNG/startercfg/lang/ru.xml index 6e499d3..9284429 100644 --- a/StarterNG/startercfg/lang/ru.xml +++ b/StarterNG/startercfg/lang/ru.xml @@ -518,6 +518,26 @@ Громкость подвижного состава Громкость позиционных звуков Громкость окружения + Звуковое устройство и эффекты + Устройство вывода + Системное по умолчанию + Конфигурация динамиков + Автоматически + Стерео (простое панорамирование) + Стерео (UHJ, шире) + Наушники (HRTF) + Вкл. + Выкл. + Набор данных HRTF + Выбор библиотеки + Передискретизация + По умолчанию библиотеки + Ограничитель выхода + Частота микширования + Частота устройства + Эффект Доплера + Приглушённые звуки вне кабины + Поглощение воздухом Дополнительно Сжимать текстуры TGA