-
-
Notifications
You must be signed in to change notification settings - Fork 172
Consistently cast and wrap the mixer's position #2745
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
Conversation
I still get a crash in a debug build of this branch, though the stack trace looks a bit different now:
|
Hmm.. yes; it's still overflowing on the quantity itself now. MIXER_LockAudioDevice();
Mix(check_cast<uint16_t>(static_cast<int64_t>(index * mixer.frames_needed)));
MIXER_UnlockAudioDevice(); That's a quantity and not a ring-buffer index, so I'll digest the quantity down using a loop. |
This fixes the macOS debug build assertion failure when plugging in headphones. Tried it with a few programs, works 100% reliably. Nice one @kcgen 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @kcgen 🎉
If you can try the update, curious if the chunked mixing avoids the crash on your side. |
Rename to CamelCase and use length instead of size because we're dealing with sample counts and not raw bytes.
73f202d
to
1c0d796
Compare
@kcgen Yep, that fixes the crash. Great job. 👍 Sidenote, I did notice an additional bug. Dosbox hangs on quit when I have But, like @johnnovak said in the bug thread, this is a very corner case and I think it's not our bug anyway so I think we can close this one up. |
Also, if you're curious what was happening, I found that SDL opened the audio device without reporting any errors, makes a single call to the callback function, and then stops making callbacks. So definitely an edge case but good job getting it fixed 😄 |
Very interesting! Sounds like little SDL went trick-or-treating to the haunted audio mansion at the end of the block, and never returned. "Your callbacks will never be heard again!" 🦇 🧛♂️ |
Applies the same ring-buffer wrapping in all places in the mixer, consistently. Possibly fixes #2704.