Repository navigation
jk: a pause during a cutscene keeps the sound in order and in sync - #15
Merged
Merged
Conversation
…penJKDF2 46ccc6d) The cutscene clocks are wall time, so after a pause the cutscene took the whole pause for lag and decoded every frame it had missed at once: the sound played out of order and looped, and the picture ended up ahead of it. jk_esp_park_point() now moves the cutscene clocks past the time it was parked (both park points: between frames and inside the engine's menus). The mixer also keeps running until the engine has actually parked (it can finish a frame after the pause request), so the sound stops with the picture. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
There was a problem hiding this comment.
🟡 Changes recommended
The clock adjustment double-counts the emulator menu interval when the cutscene is already paused with Space, causing the video to stall after resuming.
1 open issue
What changed in this PR
This PR addresses Jedi Knight cutscene audio corruption and synchronization drift when resuming from the emulator’s pause menu.
Changes:
- Measures engine park time and passes it to OpenJKDF2’s cutscene clock-adjustment hook.
- Keeps the mixer running until the engine actually parks, rather than stopping immediately on a pause request.
| File | Description |
|---|---|
components/jk/src/jk.cpp |
Adjusts cutscene timing after parking and aligns mixer suspension with the engine’s parked state. |
Review effort: Balanced
…is on) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
ESP-IDF Size Report for 'Tab5 Emu'
FLASH uses app .bin size or json2 flash sum. RAM sums DRAM+IRAM via idf_size. Percentages shown when totals are available. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Pausing Jedi Knight during a cutscene (from the emulator's pause menu) and resuming garbled the sound: out of order, partly looping. After a first fix, the sound was clean but the picture ended up noticeably ahead of it.
The cutscene keeps time by the wall clock, and the pause menu parks the engine without telling it. On resume, the cutscene took the whole pause for lag and decoded every frame it had missed back to back. That's seconds of audio at once, more than the 128-packet queue holds. Since #3 (cutscenes); not related to the espp update.
Fix
46ccc6d(esp32p4): addsjkCutscene_ESP32_SkipTime(us), which moves the cutscene's clocks forward, as the cutscene's own pause (space) does.jk_esp_park_point()calls it with the time it was parked. That covers both park points: between engine frames (the one a cutscene normally hits) and inside the engine's menu loops.g_parked), instead of stopping on the pause request. The engine can finish a frame after the request, and that frame's sound would otherwise fall behind its picture.Tested on the Tab5
Paused and resumed during cutscenes: the sound stays in order and in sync with the picture ("works perfectly").
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY