Skip to content

Conversation

@nyanpasu64
Copy link
Collaborator

@nyanpasu64 nyanpasu64 commented Jul 4, 2025

This pull request aims to catch rare crashes when exporting WAV files, to help debug what's causing them.

Changes in this PR:

  • (internal) Fix bug where m_pWaveFile is not cleared if we fail to open a WAV file.
  • Add logging for WAV export events, to help identify cause of crashes

To test the logger, edit CSoundGen::~CSoundGen() to call LOGGER.dump().

We would fail to clear m_pWaveFile if we failed to start rendering. On
the next render attempt, this would cause the assertion
`ASSERT(m_pWaveFile == nullptr)` to fail.

Manually clear m_pWaveFile to prevent this from happening. If mmioOpen
fails, hmmioOut is nullptr and we don't need to call CloseFile().
The modulo logic is fiddly, but I confirmed it works with various log
item counts (by reducing LOG_SIZE to 4, pushing items with and without
overflow, and verifying the tail output is correct).
@Gumball2415
Copy link
Collaborator

if it's within the scope of the feature, is it also possible to include information regarding the tracker version and the OS?

@Gumball2415
Copy link
Collaborator

lgtm though, merging

@Gumball2415 Gumball2415 merged commit d5862bf into main Jul 8, 2025
8 checks passed
@nyanpasu64 nyanpasu64 deleted the log-wav-export branch July 8, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants