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
DSP: Copy audio dma samples one block at a time #10741
Merged
JMC47
merged 2 commits into
dolphin-emu:master
from
Pokechu22:audio-dma-one-block-at-a-time
Oct 24, 2022
Merged
DSP: Copy audio dma samples one block at a time #10741
JMC47
merged 2 commits into
dolphin-emu:master
from
Pokechu22:audio-dma-one-block-at-a-time
Oct 24, 2022
Conversation
This file contains 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
cdf1382
to
ab49cb1
Compare
|
Also fixes https://bugs.dolphin-emu.org/issues/9410 or at least the audio crackling doesn't happen anymore. The previous PR (#10738) didn't change the behaviour. |
Pokechu22
commented
Jun 12, 2022
ab49cb1
to
6725fbd
Compare
6725fbd
to
9f424b4
Compare
4711687
to
5b79f41
Compare
|
Can we get a review here of someone who's familiar with the DSP/Audio stuff? |
5b79f41
to
9e4a791
Compare
9e4a791
to
446e4fb
Compare
446e4fb
to
49e1bac
Compare
49e1bac
to
e543c4a
Compare
e543c4a
to
1eb2151
Compare
Reverts 9f8e1e2, but keeps the changes from e4e4490. This fixes missing audio in Datel titles; see https://bugs.dolphin-emu.org/issues/12281.
`count` is the number of stereo samples to write (where each stereo sample is two shorts), while `BUFFER_SIZE` is the size of the buffer in shorts. So `count` needs to be multiplied by `2`, not `BUFFER_SIZE`. Also, when this check was failed, the previous code just clobbered whatever was past the end of the buffer after logging the warning, which corrupted `basename`, eventually resulting in Dolphin crashing. This affected Datel's Wii-compatible Action Replay, which uses a block size of 2298, or 18384 stereo samples, which is 36768 shorts, which is bigger than the buffer size of 32768. (However, the previous commit means that only one block is transfered at a time, eliminating this issue; fixing the bounds check is just a general safety thing instead of an actual bugfix now.)
1eb2151
to
6de55e4
Compare
|
If this breaks audio, let it be known that I showed restraint and gave people months to review it before deciding that my shitty unlicensed games needed some love. |
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.
This fixes missing audio in various Datel titles; see https://bugs.dolphin-emu.org/issues/12281. They send a large number of samples at the same time, since they don't have to deal with an actual DSP program generating them. Before, we were sending all of the samples at once, which would be too large to ever fit in the buffer in
Mixer.cppand thus the code that prevents overflowing the buffer rejected the samples. This new approach should be more hardware-accurate, though I haven't done any testing related to it.Compared to #10738, this change does not result in audio desyncs after pressing tab to disable the speed limit, and I never encountered any duplicated sound effects on Datel titles.
This PR reverts #720 (but it keeps the length 0 change from #762). Other PRs that are good for context are #692 and #762. I don't own Xenoblade Chronicles, so I haven't confirmed whether this causes issues for it.
This PR also fixes a broken size check in
WaveFile. That check used to be relevant for the Wii-compatible Action Replay (which would crash Dolphin if audio dumping was enabled), but the other change in this PR means that only 8 samples at a time are getting written. Still, it's better to fix it.