feat: Support for modifying playback pitch#507
Conversation
- Currently, we copy & pasted the Playback Speed setting design. - We're going to update the design of these 2 components & make the layout more reusable.
- Called this group "PlaybackParametersSetting" since both speed & pitch are set via the `PlaybackParameters` class in ExoPlayer.
- There was a chance when using `_debounceMultiplier={1}` where `Math.abs(debounceFrom.get() - value)` may not be exact due to the floating-point math being off.
- It was due to the initial fix to the issue where changing the pitch may result in playback breaking.
- This is only really effective when the slider is in a scrollable list. - This helps prevent accidentally activating the Playback Speed, Playback Pitch, and ReplayGain Pre-amp while scrolling the "Audio Effects" screen.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds pitch control to playback settings via new parameterized slider components, improves CachedSlider debouncing to respect step decimal precision and gesture activation, persists playbackPitch in the session store, and updates the audio settings screen and related assets. ChangesPlayback Pitch Control
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
mobile/src/modules/audio/_components/PlaybackParameterSlider.tsx (1)
27-34: 💤 Low valueRemove unnecessary
eslint-disablecomment.The dependency array
[props.onUpdate, fieldName]appears complete - all values used in the callback are listed. Theeslint-disable-next-line react-hooks/exhaustive-depscomment on line 32 may be unnecessary.♻️ Proposed cleanup
const setField = useCallback( (value: number) => { sessionStore.setState({ [fieldName]: value }); props.onUpdate(value); }, - // eslint-disable-next-line react-hooks/exhaustive-deps [props.onUpdate, fieldName], );🤖 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 `@mobile/src/modules/audio/_components/PlaybackParameterSlider.tsx` around lines 27 - 34, Remove the unnecessary eslint-disable comment above the useCallback for setField: the dependency array already includes props.onUpdate and fieldName which are the only external values used, so delete the "// eslint-disable-next-line react-hooks/exhaustive-deps" line and keep the useCallback as-is (setField -> sessionStore.setState({ [fieldName]: value }); props.onUpdate(value);) to let the linter validate the deps for setField.
🤖 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 `@mobile/src/modules/audio/_components/PlaybackParameterSlider.tsx`:
- Around line 24-25: The slider's local shared value cachedValue (created via
useSharedValue) is only initialized from storedValue and won't update if
useSessionStore's storedValue changes; inside PlaybackParameterSlider.tsx add a
useEffect that watches storedValue (and cachedValue) and calls
cachedValue.set(storedValue) so the shared value stays in sync with external
updates from useSessionStore.
---
Nitpick comments:
In `@mobile/src/modules/audio/_components/PlaybackParameterSlider.tsx`:
- Around line 27-34: Remove the unnecessary eslint-disable comment above the
useCallback for setField: the dependency array already includes props.onUpdate
and fieldName which are the only external values used, so delete the "//
eslint-disable-next-line react-hooks/exhaustive-deps" line and keep the
useCallback as-is (setField -> sessionStore.setState({ [fieldName]: value });
props.onUpdate(value);) to let the linter validate the deps for setField.
🪄 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 Plus
Run ID: 94b4f25a-c96a-4d50-85db-8485b6fb4f29
⛔ Files ignored due to path filters (1)
mobile/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
mobile/package.jsonmobile/src/components/Form/Slider.tsxmobile/src/modules/audio/_components/PlaybackParameterSettings.tsxmobile/src/modules/audio/_components/PlaybackParameterSlider.tsxmobile/src/modules/audio/_components/PlaybackSpeedSetting.tsxmobile/src/modules/audio/_screens.tsxmobile/src/modules/audio/replayGain/components/PreAmpSlider.tsxmobile/src/modules/i18n/translations/en.jsonmobile/src/resources/icons/VoiceSelection.tsxmobile/src/stores/Session/constants.tsmobile/src/stores/Session/store.tsmobile/src/utils/number.ts
💤 Files with no reviewable changes (1)
- mobile/src/modules/audio/_components/PlaybackSpeedSetting.tsx
Why
This PR adds support for modifying the pitch of the current track. This setting appears in the "Audio Effects" screen when we navigate to it via the "Playback Options" sheet.
Other Changes
_debounceMultipler = 1due to floating point math.Checklist
pnpm sync:licenses.pnpm android:prod.Summary by CodeRabbit
New Features
Refactor
Removed