Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeboy crashes LMMS #6649

Closed
anytizer opened this issue Feb 17, 2023 · 6 comments · Fixed by #6680
Closed

Freeboy crashes LMMS #6649

anytizer opened this issue Feb 17, 2023 · 6 comments · Fixed by #6680
Labels

Comments

@anytizer
Copy link
Contributor

Attachment: freeboy-crash.zip

If a second note plays earlier than first note finishes, freeboy crashes LMMS.

lmms: -/lmms/plugins/FreeBoy/game-music-emu/gme/Gb_Apu.cpp:131: void Gb_Apu::run_until(blip_time_t): Assertion `end_time >= last_time' failed.

@anytizer anytizer added the bug label Feb 17, 2023
@messmerd
Copy link
Member

I've identified the cause of this and I'm working on a fix.

@zonkmachine
Copy link
Member

I've identified the cause of this and I'm working on a fix.

I'm pretty sure this is a duplicate of #5734 which apparently have a proposed fix in #6053

@messmerd
Copy link
Member

@zonkmachine No, this bug is different from those

@RiedleroD
Copy link
Contributor

so I understand that this crashes debug builds, but what's the effect in release builds? I'm trying to understand, but @messmerd's PR was too complicated to understand for me.

@messmerd
Copy link
Member

@RiedleroD It affects the GB APU and the audio it produces in a lot of unintended ways.

The APU requires end_time > last_time to be true, but due to this bug, it sometimes isn't, and that invalidates a lot of the logic that follows. In addition to the assert statement for debug builds, the person who wrote the library even wrote a comment saying "end_time must not be before previous time", so we are clearly doing things we really should not be doing. However, I cannot know everything that could go wrong without a deeper understanding of how the APU works.

But I do know that by fixing this bug, we will be making FreeBoy behave in the way it was intended to, and we'll likely fix some hard-to-notice audio glitches that would otherwise be nearly impossible to track down.

@messmerd
Copy link
Member

@RiedleroD I found an example of an audio issue that this bug is causing.

Here's the 1st part of Freeboy_issue.mmpz from #6144 rendered to wav at 96,000 Hz once with the master build and once with the fix in PR #6680:

Freeboy_issue.zip

With this bug fixed, you can tell there's much less strange noise in the background when each new note plays.
Note that my PR doesn't fix the high CPU usage described in #6144, but it does fix the failed assertion that was mentioned in the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants