Repository navigation
TTS再生完了後もダッキングが残存する不具合を修正し、発話直前のみduckOthersを有効化するよう変更 - #6466
Conversation
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JasivPGu8vLpL5nbg4KCMW
📝 WalkthroughWalkthrough
Changes音声ダッキング制御
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant useTTS
participant AudioMode
participant Speech
useTTS->>AudioMode: 発話直前に duckOthers
useTTS->>Speech: Speech.speak
Speech-->>useTTS: 発話完了
useTTS->>AudioMode: 保留なしで mixWithOthers
useTTS->>AudioMode: アンマウント時に mixWithOthers
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hooks/useTTS.ts (1)
161-202: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win再生中の設定変更でダッキングが解除されたままになります。
backgroundEnabledの変更時に effect が常にmixWithOthersを設定します。発話中なら現在のduckOthersが解除され、その発話が終わるまで再設定されません。現在のダッキング状態を ref で保持し、設定変更時もその状態を維持してください。あわせて、発話中にbackgroundEnabledを切り替えてもduckOthersを維持する回帰テストを追加してください。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/hooks/useTTS.ts` around lines 161 - 202, Update the audio-mode effect and setDuckingActiveAsync in useTTS so the current ducking state is stored in a ref and reused when backgroundEnabled changes, preserving duckOthers during active speech instead of resetting to mixWithOthers. Update the ducking state whenever setDuckingActiveAsync toggles it, and add a regression test covering backgroundEnabled changes during speech while ducking remains enabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hooks/useTTS.test.ts`:
- Around line 650-665: Update the useTTS test around the duckOthers and first
mockSpeak calls to assert call order, verifying mockSetAudioModeAsync enables
duckOthers before the initial Speech.speak invocation. Preserve the existing
assertions for mixWithOthers and duckOthers call presence.
---
Outside diff comments:
In `@src/hooks/useTTS.ts`:
- Around line 161-202: Update the audio-mode effect and setDuckingActiveAsync in
useTTS so the current ducking state is stored in a ref and reused when
backgroundEnabled changes, preserving duckOthers during active speech instead of
resetting to mixWithOthers. Update the ducking state whenever
setDuckingActiveAsync toggles it, and add a regression test covering
backgroundEnabled changes during speech while ducking remains enabled.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f348aee-4b82-4d75-b3d2-2988ca5024a1
📒 Files selected for processing (2)
src/hooks/useTTS.test.tssrc/hooks/useTTS.ts
…序の検証を追加 Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JasivPGu8vLpL5nbg4KCMW
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/hooks/useTTS.test.ts`:
- Around line 735-737: Update the useTTS audio-mode assertions to also verify
interruptionModeAndroid is set to 'duckOthers', both for the initial state and
after changing backgroundEnabled, while preserving the existing interruptionMode
checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fa3274e4-37af-4ab6-bc7f-a35a398b0e01
📒 Files selected for processing (2)
src/hooks/useTTS.test.tssrc/hooks/useTTS.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/hooks/useTTS.ts
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JasivPGu8vLpL5nbg4KCMW
概要
変更の種類
変更内容
src/hooks/useTTS.ts:expo-audioの audio mode 既定をduckOthersからmixWithOthers(非ダッキング)に変更し、実際にSpeech.speak()を呼ぶ直前にのみduckOthersを有効化するsetDuckingActiveAsyncを追加mixWithOthersへ明示的に解除するようfinishPlayingを修正backgroundEnabled設定が変化しても、直近に要求したダッキング状態(duckingActiveRef)を維持したまま audio mode を再設定するよう修正し、設定変更で発話中のダッキングが誤って解除される不具合を防止(CodeRabbitレビュー指摘対応)src/hooks/useTTS.test.ts: 発話直前のダッキング有効化、全発話完了後の解除、pending 発話継続中は解除しないこと、アンマウント時の解除、Speech.speakより前にダッキングする呼び出し順序、発話中のbackgroundEnabled変化でダッキング(iOS/Android 双方の interruptionMode)を維持することを検証する回帰テストを追加テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
Summary by CodeRabbit