Repository navigation
feat: implement 'audio hold', 1 frame of audio is played continously in a loop - #42
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds an Audio Hold toolbar mode that loops one audio frame at the paused playhead, retargets during timeline navigation, keeps meters active, and disables during playback, project replacement, or manual deactivation. ChangesAudio Hold playback
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant btnAudioHold
participant setAudioHold
participant refreshAudioHold
participant AudioBuffer
participant updateMeterUI
User->>btnAudioHold: Enable Audio Hold
btnAudioHold->>setAudioHold: Toggle hold mode
setAudioHold->>refreshAudioHold: Start paused refresh
refreshAudioHold->>AudioBuffer: Slice one timeline frame
AudioBuffer-->>refreshAudioHold: Return frame buffer
refreshAudioHold-->>User: Loop held audio
updateMeterUI-->>User: Animate meters during hold
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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)
app.js (1)
2864-2882: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated pause-UI reset into a shared helper.
The
if (state.playing) { ... }block here duplicates thestate.playing=false/btnPlaytext+class / clipEls-pause logic already inpause()(lines 2756-2759). A shared helper (e.g.pausePlaybackUI()) would keep the two paths from drifting.♻️ Proposed refactor
+function pausePlaybackUI() { + state.playing = false; + els.btnPlay.textContent = "▶"; + els.btnPlay.classList.remove("on"); + for (const el of runtime.clipEls.values()) { if (!el.paused) el.pause(); } +} + function pause() { if (state.audioHold) setAudioHold(false); - state.playing = false; - els.btnPlay.textContent = "▶"; - els.btnPlay.classList.remove("on"); - for (const el of runtime.clipEls.values()) { if (!el.paused) el.pause(); } + pausePlaybackUI(); if (state.exporting) finishExport(false); } ... function setAudioHold(on) { on = !!on; if (on) { - if (state.playing) { - // Pause without going through pause() (that would clear hold). - state.playing = false; - els.btnPlay.textContent = "▶"; - els.btnPlay.classList.remove("on"); - for (const el of runtime.clipEls.values()) { if (!el.paused) el.pause(); } - } + // Pause without going through pause() (that would clear hold). + if (state.playing) pausePlaybackUI(); state.audioHold = true;🤖 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 `@app.js` around lines 2864 - 2882, Extract the duplicated playback pause reset from setAudioHold into a shared helper such as pausePlaybackUI(), including state.playing, btnPlay text/class, and runtime.clipEls pause logic. Update both setAudioHold and pause() to call this helper while preserving their existing hold-specific behavior.
🤖 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 `@app.js`:
- Around line 2864-2882: Update setAudioHold so the true branch exits without
changing state.audioHold or adding the "on" class when state.exporting or
state.rendering is active. Preserve the existing hold activation behavior when
neither operation is in progress, and keep the false branch’s clearing behavior
unchanged.
---
Nitpick comments:
In `@app.js`:
- Around line 2864-2882: Extract the duplicated playback pause reset from
setAudioHold into a shared helper such as pausePlaybackUI(), including
state.playing, btnPlay text/class, and runtime.clipEls pause logic. Update both
setAudioHold and pause() to call this helper while preserving their existing
hold-specific behavior.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2355df72-61b0-42d0-b862-bb47a530931d
📒 Files selected for processing (3)
README.mdapp.jsindex.html
What does this PR do?
Audio editing helper; when in pause mode, one frame of audio is being played in a loop. This way it is easy to find a cut point. Pressing play/pause cancels the effect.
Type of change
How was it verified?
node --check server.js && node --check app.js && node --check mcp-server.jspassesCLAUDE.md/README.mdif the schema, props, or API changedChecklist
Summary by CodeRabbit