diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-02 17:46:07 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-02 17:46:07 +0300 |
| commit | f3d057fec20aeef584cb6340c6a002280a019f15 (patch) | |
| tree | 018be28f954243414969e8b8970fb3f3be8da112 /internal/audio | |
| parent | 1fc2ade33b72dd299fc987943ddd09dee7c609ad (diff) | |
task 002: restore Gemini warning output
Diffstat (limited to 'internal/audio')
| -rw-r--r-- | internal/audio/fallbacks.go | 5 | ||||
| -rw-r--r-- | internal/audio/voices_test.go | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/internal/audio/fallbacks.go b/internal/audio/fallbacks.go index 0c3ed83..f22301f 100644 --- a/internal/audio/fallbacks.go +++ b/internal/audio/fallbacks.go @@ -6,7 +6,7 @@ import ( ) // RunWithVoiceFallbacks tries the selected Gemini voice first, then the remaining known voices. -func RunWithVoiceFallbacks(initialVoice string, generate func(voice string) error) (usedVoice string, err error) { +func RunWithVoiceFallbacks(initialVoice string, generate func(voice string) error, warnNoAudio func(voice string)) (usedVoice string, err error) { attempted := make([]string, 0, len(GeminiVoices)) var lastErr error @@ -22,6 +22,9 @@ func RunWithVoiceFallbacks(initialVoice string, generate func(voice string) erro } lastErr = err + if warnNoAudio != nil { + warnNoAudio(voice) + } } return "", fmt.Errorf("Gemini returned no audio for voices %s: %w", strings.Join(attempted, ", "), lastErr) diff --git a/internal/audio/voices_test.go b/internal/audio/voices_test.go index 3d936d1..6d79634 100644 --- a/internal/audio/voices_test.go +++ b/internal/audio/voices_test.go @@ -76,7 +76,7 @@ func TestRunWithVoiceFallbacks(t *testing.T) { return ErrGeminiNoAudioData } return nil - }) + }, nil) if err != nil { t.Fatalf("RunWithVoiceFallbacks() unexpected error: %v", err) } @@ -94,7 +94,7 @@ func TestRunWithVoiceFallbacks(t *testing.T) { usedVoice, err := RunWithVoiceFallbacks("Charon", func(voice string) error { attempted = append(attempted, voice) return sentinel - }) + }, nil) if !errors.Is(err, sentinel) { t.Fatalf("error = %v, want %v", err, sentinel) } @@ -111,7 +111,7 @@ func TestRunWithVoiceFallbacks(t *testing.T) { usedVoice, err := RunWithVoiceFallbacks("Charon", func(voice string) error { attempted = append(attempted, voice) return ErrGeminiNoAudioData - }) + }, nil) if !errors.Is(err, ErrGeminiNoAudioData) { t.Fatalf("error = %v, want wrapped ErrGeminiNoAudioData", err) } |
