From 6be06d26afc004da5a94d59755cacd8e303e3e59 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 28 Oct 2026 15:10:32 -0400 Subject: [PATCH] Default rate was a bit slow even for being slow. Fixed to a more sane starting point. --- cmd/fenrir/main_test.go | 2 +- config/settings/settings.toml | 4 ++-- internal/app/attributes_test.go | 2 +- internal/app/quick_settings_test.go | 14 +++++++------- internal/app/speech_selection_test.go | 2 +- internal/config/config.go | 2 +- internal/config/config_test.go | 4 ++-- internal/config/startup_test.go | 2 +- internal/preferences/settings_test.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/fenrir/main_test.go b/cmd/fenrir/main_test.go index 73f1380e..79ce1f89 100644 --- a/cmd/fenrir/main_test.go +++ b/cmd/fenrir/main_test.go @@ -46,7 +46,7 @@ func TestCLIWithoutOpeningDevices(t *testing.T) { text string }{ {[]string{"--help"}, 0, "keypad 7/8/9"}, - {[]string{"--help"}, 0, "(default -20)"}, + {[]string{"--help"}, 0, "Speech Dispatcher rate (-100 to 100)"}, {[]string{"-f", "--help"}, 0, "stay in the foreground"}, {[]string{"-f", "--version"}, 0, "fenrir " + version.Label()}, {[]string{"--version"}, 0, "fenrir " + version.Label()}, diff --git a/config/settings/settings.toml b/config/settings/settings.toml index 0be39be5..584157b9 100644 --- a/config/settings/settings.toml +++ b/config/settings/settings.toml @@ -23,8 +23,8 @@ hardware_device = "" hardware_baud_rate = 0 enabled = true # Shared -100 to 100 scale; hardware drivers map it to native ranges. -# -20 corresponds to 0.4 on Python Fenrir's 0.0 to 1.0 scale. -rate = -20 +# 0 is the synthesizer's normal rate. +rate = 0 # Empty choices use the server default. Voice names are module-specific. module = "" language = "" diff --git a/internal/app/attributes_test.go b/internal/app/attributes_test.go index 477a3700..c93a7613 100644 --- a/internal/app/attributes_test.go +++ b/internal/app/attributes_test.go @@ -271,7 +271,7 @@ func TestAttributeSessionToggleQuickSaveAndFreshStartup(t *testing.T) { t.Fatal(err) } saved, _, err := config.Load(path, nil) - if err != nil || saved.Reading.Attributes != mode || saved.Reading.AttributeFormat != "fenrirBold" || saved.Presentation.Speech.Rate != -10 { + if err != nil || saved.Reading.Attributes != mode || saved.Reading.AttributeFormat != "fenrirBold" || saved.Presentation.Speech.Rate != 10 { t.Fatal("temporary toggle persisted", saved, err) } settings = saved diff --git a/internal/app/quick_settings_test.go b/internal/app/quick_settings_test.go index 7b27c591..146e2c75 100644 --- a/internal/app/quick_settings_test.go +++ b/internal/app/quick_settings_test.go @@ -90,14 +90,14 @@ func TestHardwareQuickSettingsOnlyOfferSupportedControls(t *testing.T) { menu.selectSpeech = func(config.Speech, func(error, bool)) { t.Fatal("hardware numeric adjustment tried reopening the device") } - for _, want := range []string{"speech pitch 0", "speech volume 100", "speech rate -20"} { + for _, want := range []string{"speech pitch 0", "speech volume 100", "speech rate 0"} { menu.command(command.NextQuickEntry, &settings, voice) if got := voice.messages[len(voice.messages)-1]; got != want { t.Fatal(driver, got, want) } } menu.command(command.NextQuickValue, &settings, voice) - if settings.Presentation.Speech.Rate != -10 || voice.parameters[len(voice.parameters)-1].Rate != -10 { + if settings.Presentation.Speech.Rate != 10 || voice.parameters[len(voice.parameters)-1].Rate != 10 { t.Fatal(settings, voice.parameters) } } @@ -125,7 +125,7 @@ func TestQuickChangesSurviveMenuCancelAndExplicitSaveThenQuit(t *testing.T) { t.Fatal(err) } saved, _, err := config.Load(path, nil) - if err != nil || saved.Presentation.Speech.Rate != -10 || saved.Presentation.Speech.Pitch != -10 || !saved.Reading.Automatic || saved.Reading.Mode != "table" || !reflect.DeepEqual(saved.General, base.General) { + if err != nil || saved.Presentation.Speech.Rate != 10 || saved.Presentation.Speech.Pitch != -10 || !saved.Reading.Automatic || saved.Reading.Mode != "table" || !reflect.DeepEqual(saved.General, base.General) { t.Fatal(saved, err) } if !strings.Contains(strings.Join(voice.messages, "|"), "Settings saved.") { @@ -209,7 +209,7 @@ func TestSessionMuteDoesNotPersistAcrossRestart(t *testing.T) { if err != nil || settings.Presentation.Speech.Enabled != trial.enabled { t.Fatal("session mute changed saved speech enablement", settings.Presentation.Speech, err) } - if trial.save && settings.Presentation.Speech.Rate != -10 { + if trial.save && settings.Presentation.Speech.Rate != 10 { t.Fatal("quick speech adjustment was not saved", settings.Presentation.Speech) } } @@ -278,7 +278,7 @@ func TestSessionAutomaticReadingDoesNotPersistAcrossRestart(t *testing.T) { if err != nil || settings.Reading.Automatic != trial.automatic || !settings.Presentation.Speech.Enabled { t.Fatal("session reading toggle changed saved startup behavior", settings, err) } - if trial.save && settings.Presentation.Speech.Rate != -10 { + if trial.save && settings.Presentation.Speech.Rate != 10 { t.Fatal("quick adjustment was not saved", settings.Presentation.Speech) } } @@ -306,7 +306,7 @@ func TestSaveFailureKeepsRunningQuickSettings(t *testing.T) { case <-time.After(time.Second): t.Fatal("save hung") } - if saver.busy || settings.Presentation.Speech.Rate != -10 || voice.messages[len(voice.messages)-1] != "Failed to save settings." { + if saver.busy || settings.Presentation.Speech.Rate != 10 || voice.messages[len(voice.messages)-1] != "Failed to save settings." { t.Fatal(settings, voice.messages) } } @@ -342,7 +342,7 @@ func TestQuickCategoriesRememberSelectionAndWrap(t *testing.T) { t.Fatalf("%s: got %q, want %q", trial.id, got, trial.want) } } - if menu := new_quick_settings("speech-dispatcher"); !menu.command(command.CurrentQuickEntry, &settings, voice) || voice.messages[len(voice.messages)-1] != "speech rate -20" { + if menu := new_quick_settings("speech-dispatcher"); !menu.command(command.CurrentQuickEntry, &settings, voice) || voice.messages[len(voice.messages)-1] != "speech rate 0" { t.Fatal("new session did not reset selection", voice.messages) } } diff --git a/internal/app/speech_selection_test.go b/internal/app/speech_selection_test.go index f06a0ca1..e6f9ab82 100644 --- a/internal/app/speech_selection_test.go +++ b/internal/app/speech_selection_test.go @@ -199,7 +199,7 @@ func TestMenuSelectionFailurePreservesDiskAndCommittedSaveSurvivesClose(t *testi t.Fatal("failure changed disk/live", outcome) } } else { - if outcome != nil || a.settings.live.Presentation.Speech.Voice != "Base Voice" || a.settings.live.Presentation.Speech.Rate != -10 || a.settings.resetBase.Presentation.Speech.Rate != -20 || a.settings.resetBase.Presentation.Speech.Voice != "Base Voice" { + if outcome != nil || a.settings.live.Presentation.Speech.Voice != "Base Voice" || a.settings.live.Presentation.Speech.Rate != 10 || a.settings.resetBase.Presentation.Speech.Rate != 0 || a.settings.resetBase.Presentation.Speech.Voice != "Base Voice" { t.Fatal("committed selection or newer numeric override lost", outcome, a.settings.live, a.settings.resetBase) } } diff --git a/internal/config/config.go b/internal/config/config.go index c7991efa..0be1e79f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -163,7 +163,7 @@ type Reading struct { } func Defaults() Settings { - return Settings{Screen: Screen{IgnoredVTs: []int{}}, Review: Review{LineBreak: true, EndOfScreen: true, LeaveReviewOnCursorChange: true, LeaveReviewOnScreenChange: true}, Prompt: Prompt{ExactMatches: []string{}, CustomPatterns: []string{}}, Version: 3, Presentation: Presentation{DateTime: DateTime{TimeFormat: "locale", DateFormat: "locale"}, Progress: Progress{Enabled: true}, Sound: Sound{Enabled: true, Volume: 0.7, Driver: "pulse", Theme: "default", Device: "default"}, Speech: Speech{Enabled: true, Rate: -20, Volume: 100, Driver: "speech-dispatcher"}}, Keyboard: Keyboard{MultiPressTimeoutMS: int(input.DefaultMultiPressTimeout / time.Millisecond), Layout: "desktop", CharacterEcho: true}, Reading: Reading{Emoticons: true, RepeatedSymbolsMin: 4, Spellcheck: true, SpellcheckSound: true, Attributes: "none", AttributeFormat: presentation.Default_attribute_format, Indentation: "none", RaisePitchForCapitals: true, Automatic: true, CursorEcho: true, Mode: "cursor", PunctuationProfile: "default", PunctuationLevel: "some"}, Clipboard: Clipboard{NumberOfClipboards: 200, ExportPath: "/tmp/fenrirClipboard"}, General: General{ScriptPath: "/usr/share/fenrirscreenreader/scripts", ScriptKeys: []string{"KEY_COMPOSE"}}, Scripts: Scripts{Workers: 2, QueueLimit: 16, OutputBytes: 1 << 20}, Remote: Remote{Enabled: true, EnableCommandRemote: true, EnableSettingsRemote: true}} + return Settings{Screen: Screen{IgnoredVTs: []int{}}, Review: Review{LineBreak: true, EndOfScreen: true, LeaveReviewOnCursorChange: true, LeaveReviewOnScreenChange: true}, Prompt: Prompt{ExactMatches: []string{}, CustomPatterns: []string{}}, Version: 3, Presentation: Presentation{DateTime: DateTime{TimeFormat: "locale", DateFormat: "locale"}, Progress: Progress{Enabled: true}, Sound: Sound{Enabled: true, Volume: 0.7, Driver: "pulse", Theme: "default", Device: "default"}, Speech: Speech{Enabled: true, Rate: 0, Volume: 100, Driver: "speech-dispatcher"}}, Keyboard: Keyboard{MultiPressTimeoutMS: int(input.DefaultMultiPressTimeout / time.Millisecond), Layout: "desktop", CharacterEcho: true}, Reading: Reading{Emoticons: true, RepeatedSymbolsMin: 4, Spellcheck: true, SpellcheckSound: true, Attributes: "none", AttributeFormat: presentation.Default_attribute_format, Indentation: "none", RaisePitchForCapitals: true, Automatic: true, CursorEcho: true, Mode: "cursor", PunctuationProfile: "default", PunctuationLevel: "some"}, Clipboard: Clipboard{NumberOfClipboards: 200, ExportPath: "/tmp/fenrirClipboard"}, General: General{ScriptPath: "/usr/share/fenrirscreenreader/scripts", ScriptKeys: []string{"KEY_COMPOSE"}}, Scripts: Scripts{Workers: 2, QueueLimit: 16, OutputBytes: 1 << 20}, Remote: Remote{Enabled: true, EnableCommandRemote: true, EnableSettingsRemote: true}} } func (s Settings) Validate() error { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 3af5135e..b4eb0233 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -79,7 +79,7 @@ func TestSettingsSelectionDoesNotHideInvalidOrExplicitMissingFiles(t *testing.T) t.Fatal(err) } settings, selected, err = Load("", []string{userPath, systemPath}) - if err != nil || selected != userPath || settings.Presentation.Sound.Enabled || settings.Presentation.Speech.Rate != -20 { + if err != nil || selected != userPath || settings.Presentation.Sound.Enabled || settings.Presentation.Speech.Rate != 0 { t.Fatalf("user selection merged system values: %+v %s %v", settings, selected, err) } if err := os.WriteFile(userPath, []byte("invalid = true"), 0600); err != nil { @@ -151,7 +151,7 @@ func TestShippedExampleMatchesDefaults(t *testing.T) { func TestSpeechParameterDefaultsAndBounds(t *testing.T) { for _, data := range []string{"version=1\n", "version=2\n", "version=3\n"} { settings, err := Decode([]byte(data)) - if err != nil || settings.Presentation.Speech.Rate != -20 || settings.Presentation.Speech.Pitch != 0 || settings.Presentation.Speech.Volume != 100 { + if err != nil || settings.Presentation.Speech.Rate != 0 || settings.Presentation.Speech.Pitch != 0 || settings.Presentation.Speech.Volume != 100 { t.Fatal(settings, err) } } diff --git a/internal/config/startup_test.go b/internal/config/startup_test.go index 07bd106e..4e94db16 100644 --- a/internal/config/startup_test.go +++ b/internal/config/startup_test.go @@ -27,7 +27,7 @@ func TestStartupSaveDestinationAndLegacySettingsIgnored(t *testing.T) { if err := os.WriteFile(legacyPath, legacy, 0600); err != nil { t.Fatal(err) } - requested, destination, rate := "", userPath, -20 + requested, destination, rate := "", userPath, 0 if scenario != "defaults" { system := Defaults() system.Presentation.Speech.Rate = 30 diff --git a/internal/preferences/settings_test.go b/internal/preferences/settings_test.go index 1eaffa17..7817671c 100644 --- a/internal/preferences/settings_test.go +++ b/internal/preferences/settings_test.go @@ -52,7 +52,7 @@ func TestSettingsFormCoversSchemaAndReturnsIsolatedDraft(t *testing.T) { if err != nil { t.Fatal(err) } - if draft.Presentation.Speech.Enabled || draft.Presentation.Speech.Rate != -19 || !base.Presentation.Speech.Enabled || base.Presentation.Speech.Rate != -20 { + if draft.Presentation.Speech.Enabled || draft.Presentation.Speech.Rate != 1 || !base.Presentation.Speech.Enabled || base.Presentation.Speech.Rate != 0 { t.Fatal("draft isolation", draft, base) } }