diff --git a/Source/AppScaffolding/LibationScaffolding.cs b/Source/AppScaffolding/LibationScaffolding.cs index 917ac9d7..cab6c2c7 100644 --- a/Source/AppScaffolding/LibationScaffolding.cs +++ b/Source/AppScaffolding/LibationScaffolding.cs @@ -89,7 +89,8 @@ public static void RunPostConfigMigrations(Configuration config) Migrations.migrate_to_v6_6_9(config); Migrations.migrate_to_v11_5_0(config); - } + Migrations.migrate_to_v11_6_5(config); + } /// Initialize logging. Wire-up events. Run after migration public static void RunPostMigrationScaffolding(Variety variety, Configuration config) @@ -413,7 +414,16 @@ class FilterState_6_6_9 public List Filters { get; set; } = new(); } - public static void migrate_to_v11_5_0(Configuration config) + public static void migrate_to_v11_6_5(Configuration config) + { + //Settings migration for unsupported sample rates (#1116) + if (config.MaxSampleRate < AAXClean.SampleRate.Hz_8000) + config.MaxSampleRate = AAXClean.SampleRate.Hz_8000; + else if (config.MaxSampleRate < AAXClean.SampleRate.Hz_48000) + config.MaxSampleRate = AAXClean.SampleRate.Hz_48000; + } + + public static void migrate_to_v11_5_0(Configuration config) { // Read file, but convert old format to new (with Name field) as necessary. if (!File.Exists(QuickFilters.JsonFile)) diff --git a/Source/LibationAvalonia/ViewModels/Settings/AudioSettingsVM.cs b/Source/LibationAvalonia/ViewModels/Settings/AudioSettingsVM.cs index f8f96dfb..148ca1da 100644 --- a/Source/LibationAvalonia/ViewModels/Settings/AudioSettingsVM.cs +++ b/Source/LibationAvalonia/ViewModels/Settings/AudioSettingsVM.cs @@ -25,7 +25,9 @@ public class AudioSettingsVM : ViewModelBase public NAudio.Lame.EncoderQuality SelectedEncoderQuality { get; set; } public AvaloniaList> SampleRates { get; } - = new(Enum.GetValues().Select(v => new EnumDiaplay(v, $"{(int)v} Hz"))); + = new(Enum.GetValues() + .Where(r => r >= SampleRate.Hz_8000 && r <= SampleRate.Hz_48000) + .Select(v => new EnumDiaplay(v, $"{(int)v} Hz"))); public AvaloniaList EncoderQualities { get; } = new( diff --git a/Source/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs b/Source/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs index 32c1fc5e..bc5ca171 100644 --- a/Source/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs +++ b/Source/LibationWinForms/Dialogs/SettingsDialog.AudioSettings.cs @@ -41,6 +41,7 @@ private void Load_AudioSettings(Configuration config) maxSampleRateCb.Items.AddRange( Enum.GetValues() + .Where(r => r >= AAXClean.SampleRate.Hz_8000 && r <= AAXClean.SampleRate.Hz_48000) .Select(v => new EnumDiaplay(v, $"{(int)v} Hz")) .ToArray());