Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Apps/KeyAsio/Converters/AsioToAudioConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Globalization;
using Avalonia.Data.Converters;

namespace KeyAsio.Converters;

public sealed class AsioToAudioConverter : IValueConverter
{
public static readonly AsioToAudioConverter Instance = new();

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value is string text ? text.Replace("ASIO", "Audio", StringComparison.Ordinal) : value;
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
1 change: 1 addition & 0 deletions src/Apps/KeyAsio/DependencyInjectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static IServiceCollection AddGuiModule(this IServiceCollection services)
services.AddSingleton<SettingsManager>();
services.AddSingleton<PresetManager>();
services.AddSingleton<IAudioDeviceOperationCoordinator, AudioDeviceOperationCoordinator>();
services.AddTransient<IWizardTestSoundService, WizardTestSoundService>();

services.AddTransient<MainWindow>();
services.AddTransient<MainWindowViewModel>();
Expand Down
31 changes: 11 additions & 20 deletions src/Apps/KeyAsio/Lang/SR.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions src/Apps/KeyAsio/Lang/SR.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,13 @@ You can change option later.</value>
<value>Efficient</value>
</data>
<data name="Preset_FastDescription" xml:space="preserve">
<value>Reduces system overhead, suitable for low-end devices or basic gameplay needs.</value>
<value>Standard resource usage to deliver the best listening experience, suitable for most gameplay scenarios.</value>
</data>
<data name="Preset_SelectionDescription" xml:space="preserve">
<value>Please choose an appropriate mode based on your device performance and usage needs.</value>
</data>
<data name="Preset_SelectionTitle" xml:space="preserve">
<value>Select Preset Mode</value>
</data>
<data name="Preset_Standard" xml:space="preserve">
<value>Balanced</value>
</data>
<data name="Preset_StandardDescription" xml:space="preserve">
<value>Balances resource usage to deliver the best listening experience, suitable for most gameplay scenarios.</value>
<value>Select Preset</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>About</value>
Expand Down Expand Up @@ -721,4 +715,7 @@ You can change option later.</value>
<data name="UpdateChannel_Alpha" xml:space="preserve">
<value>Alpha</value>
</data>
<data name="Wizard_SubTitle" xml:space="preserve">
<value>Configure KeyASIO in just a few steps.</value>
</data>
</root>
11 changes: 4 additions & 7 deletions src/Apps/KeyAsio/Lang/SR.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,7 @@
<value>デバイス性能と使用目的に応じて適切なモードを選択してください。</value>
</data>
<data name="Preset_SelectionTitle" xml:space="preserve">
<value>プリセットモードを選択</value>
</data>
<data name="Preset_Standard" xml:space="preserve">
<value>標準バランス</value>
</data>
<data name="Preset_StandardDescription" xml:space="preserve">
<value>リソース使用をバランスさせ、最適な聴覚体験を提供し、ほとんどのプレイ場面に適しています。</value>
<value>プリセットを選択</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>概要</value>
Expand Down Expand Up @@ -710,4 +704,7 @@
<data name="Wizard_Welcome_Title" xml:space="preserve">
<value>KeyASIO へようこそ</value>
</data>
<data name="Wizard_SubTitle" xml:space="preserve">
<value>いくつかの手順で KeyASIO を設定できます。</value>
</data>
</root>
13 changes: 5 additions & 8 deletions src/Apps/KeyAsio/Lang/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,13 @@ You can change option later.</value>
<value>Efficient</value>
</data>
<data name="Preset_FastDescription" xml:space="preserve">
<value>Reduces system overhead, suitable for low-end devices or basic gameplay needs.</value>
<value>Standard resource usage to deliver the best listening experience, suitable for most gameplay scenarios.</value>
</data>
<data name="Preset_SelectionDescription" xml:space="preserve">
<value>Please choose an appropriate mode based on your device performance and usage needs.</value>
</data>
<data name="Preset_SelectionTitle" xml:space="preserve">
<value>Select Preset Mode</value>
</data>
<data name="Preset_Standard" xml:space="preserve">
<value>Balanced</value>
</data>
<data name="Preset_StandardDescription" xml:space="preserve">
<value>Balances resource usage to deliver the best listening experience, suitable for most gameplay scenarios.</value>
<value>Select Preset</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>About</value>
Expand Down Expand Up @@ -727,4 +721,7 @@ You can change option later.</value>
<data name="UpdateChannel_Alpha" xml:space="preserve">
<value>Alpha</value>
</data>
<data name="Wizard_SubTitle" xml:space="preserve">
<value>Configure KeyASIO in just a few steps.</value>
</data>
</root>
13 changes: 5 additions & 8 deletions src/Apps/KeyAsio/Lang/SR.zh-hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,13 @@
<value>高效轻量</value>
</data>
<data name="Preset_FastDescription" xml:space="preserve">
<value>简化系统开销,适合低配设备或基本游玩需求。</value>
<value>标准资源占用,提供最佳听觉体验,适合大多数游玩场景。</value>
</data>
<data name="Preset_SelectionDescription" xml:space="preserve">
<value>请根据您的设备性能和使用需求选择合适的模式。</value>
</data>
<data name="Preset_SelectionTitle" xml:space="preserve">
<value>选择预设模式</value>
</data>
<data name="Preset_Standard" xml:space="preserve">
<value>标准均衡</value>
</data>
<data name="Preset_StandardDescription" xml:space="preserve">
<value>均衡资源占用,提供最佳听觉体验,适合大多数游玩场景。</value>
<value>选择预设</value>
</data>
<data name="Settings_About" xml:space="preserve">
<value>关于</value>
Expand Down Expand Up @@ -728,4 +722,7 @@
<data name="UpdateChannel_Alpha" xml:space="preserve">
<value>开发版 (Alpha)</value>
</data>
<data name="Wizard_SubTitle" xml:space="preserve">
<value>只需几个步骤,即可完成 KeyASIO 配置。</value>
</data>
</root>
43 changes: 5 additions & 38 deletions src/Apps/KeyAsio/Services/PresetManager.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using KeyAsio.Configuration;
using KeyAsio.Core.Audio;
using KeyAsio.Core.Audio.SampleProviders.BalancePans;
using KeyAsio.Lang;
using KeyAsio.Configuration;
using KeyAsio.ViewModels;
using Material.Icons;

namespace KeyAsio.Services;

public enum PresetMode
{
Standard,
Fast,
Extreme
}
Expand Down Expand Up @@ -47,13 +46,6 @@ public void Initialize()
{
AvailablePresets =
[
new PresetModel(
PresetMode.Standard,
SRKeys.Preset_Standard,
SRKeys.Preset_StandardDescription,
MaterialIconKind.ScaleBalance,
"SukiInformationColor"
),
new PresetModel(
PresetMode.Fast,
SRKeys.Preset_Fast,
Expand Down Expand Up @@ -82,21 +74,12 @@ public void Initialize()
}

// Fast
if (_appSettings.Sync.Scanning.GeneralScanInterval == 50 &&
_appSettings.Sync.Scanning.TimingScanInterval == 2 &&
_appSettings.Sync.Playback.LimiterType == LimiterType.Soft &&
_appSettings.Sync.Playback.BalanceMode == BalanceMode.ConstantPower)
{
return PresetMode.Fast;
}

// Standard
if (_appSettings.Sync.Scanning.GeneralScanInterval == 50 &&
_appSettings.Sync.Scanning.TimingScanInterval == 2 &&
_appSettings.Sync.Playback.LimiterType == LimiterType.Peak &&
_appSettings.Sync.Playback.BalanceMode == BalanceMode.ProMixFocus)
{
return PresetMode.Standard;
return PresetMode.Fast;
}

return null;
Expand All @@ -106,9 +89,6 @@ public async Task ApplyPreset(PresetMode mode, AudioSettingsViewModel audioSetti
{
switch (mode)
{
case PresetMode.Standard:
ApplyStandard();
break;
case PresetMode.Fast:
ApplyLightweight();
break;
Expand All @@ -120,26 +100,11 @@ public async Task ApplyPreset(PresetMode mode, AudioSettingsViewModel audioSetti
//await audioSettingsViewModel.ReloadAudioDevice();
}

private void ApplyStandard()
private void ApplyLightweight()
{
//_appSettings.Input.UseRawInput = true;

_appSettings.Sync.Playback.LimiterType = LimiterType.Peak;
_appSettings.Sync.Playback.BalanceMode = BalanceMode.ProMixFocus;

//_appSettings.Performance.EnableAvx512 = true;

_appSettings.Sync.Scanning.GeneralScanInterval = 50;
_appSettings.Sync.Scanning.TimingScanInterval = 2;

// todo: 平衡器算法、限频器算法、无视所有音量与声道变化等
}

private void ApplyLightweight()
{
_appSettings.Sync.Playback.LimiterType = LimiterType.Soft;
_appSettings.Sync.Playback.BalanceMode = BalanceMode.ConstantPower;

_appSettings.Sync.Scanning.GeneralScanInterval = 50;
_appSettings.Sync.Scanning.TimingScanInterval = 2;
}
Expand All @@ -151,5 +116,7 @@ private void ApplyExtreme()

_appSettings.Sync.Scanning.GeneralScanInterval = 50;
_appSettings.Sync.Scanning.TimingScanInterval = 1;

// todo: 平衡器算法、限频器算法、无视所有音量与声道变化等
}
}
Loading
Loading