Project

General

Profile

Actions

Emulator Issues #9410

closed

Audio Crackling in Homebrew Demo, not present on 4.0.2

Added by ASSympt0te almost 9 years ago. Updated almost 2 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:
5.0-17716

Description

Game Name?

GRLLib 4.3.0 Demo Presentation

Game ID? (right click the game in the game list, properties, info tab)

http://www.pouet.net/prod.php?which=55527

What's the problem? Describe what went wrong.

Using HLE or LLE, XAudio2 and OpenAL results in audio crackling when running the program, even though VPS and FPS remain a solid 60

What steps will reproduce the problem?

  1. Enable Virtual XFB, EFB2RAM (Required for proper video emulation)
  2. Start the dol, and listen

Which versions of Dolphin did you test on? Does using an older version of Dolphin solve your issue? If yes, which versions of Dolphin used to work?

4.0.2 - No issue on LLE or HLE (although video emulation is incorrect)

What are your PC specifications? (CPU, GPU, Operating System, more)

i5-4670k @ 4.4GHz
GTX 780
Windows 10

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)

Nope :(


Related issues 3 (2 open1 closed)

Related to Emulator - Emulator Issues #12281: Missing MaxPlay menu musicFixed

Actions
Related to Emulator - Emulator Issues #12498: Syobon Action Wii (Homebrew) Doesn't WorkAccepted

Actions
Related to Emulator - Emulator Issues #12799: Rick Dangerous Wii - Doesn't BootAccepted

Actions
Actions #1

Updated by MayImilae almost 9 years ago

Can you bisect to find when it stopped working?

Actions #2

Updated by Helios almost 9 years ago

If you're on windows and can't (easily) use git bisect, use this https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds

And yes, please bisect this.

Actions #3

Updated by ASSympt0te almost 9 years ago

4.0-8327 broke it

Actions #6

Updated by degasus almost 9 years ago

May you check your configuration value for the option "TimingVariance"? It should be 40ms. In this case, this PR has (almost) no effect.

Actions #7

Updated by ASSympt0te almost 9 years ago

It's 40. I tried changing it around from 10 to 100 and they all have the issue.

Actions #8

Updated by ASSympt0te almost 9 years ago

Chaning MAX_SAMPLES back to 2048 instead of 4096 stops it from happening

Actions #9

Updated by JMC4789 almost 9 years ago

  • Assignee set to degasus
  • Priority changed from Normal to High
  • Milestone set to Current

Please investigate this, degasus.

Actions #10

Updated by Fog almost 9 years ago

Does this audio crackling happen on a real Wii?

I'd like to get this confirmed before we change something which isn't correct.

Actions #11

Updated by Fog almost 9 years ago

  • Status changed from New to Accepted
Actions #12

Updated by JMC4789 almost 9 years ago

Can confirm the audio crackle doesn't happen on Wii.

Actions #13

Updated by Fog almost 9 years ago

  • Status changed from Accepted to Fix pending
Actions #14

Updated by degasus almost 9 years ago

  • Status changed from Fix pending to Accepted
  • Assignee deleted (degasus)
  • Priority changed from High to Normal

The bisect is wrong, this commit makes the stutter worse, but it's not the source of the issue. AI sends more DMA samples than expected, likely because of the homebrew very often enables / disabled DMA streaming: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/DSP.cpp#L432

So the linked patch is wrong.

Actions #15

Updated by JosJuice almost 9 years ago

  • Milestone deleted (Current)

Unless this affects more than some homebrew, I don't think it should be a 5.0 blocker.

Actions #16

Updated by JMC4789 over 8 years ago

  • Milestone set to Current

Until we know what we're doing wrong on this, it'd be nice to keep it current as there are games suffering from stuttering.

Actions #17

Updated by JMC4789 over 8 years ago

  • Milestone deleted (Current)

Okay degasus explained why current was dropped.

Actions #18

Updated by degasus over 8 years ago

About the issue: We send the correct amount of samples triggered by coretiming. But within https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/DSP.cpp#L432 , we also send samples on enable/disable the DMA. So if a game enables/disables very often, we send more samples than expected. No idea if this line is just wrong, or if we need to restart the coretiming event on every enable/disable action.

Actions #19

Updated by JMC4789 over 8 years ago

This looks like the same bug affecting neogeo games.

Actions #20

Updated by JMC4789 over 8 years ago

I tried the PR that seemed to fix this and it didn't affect the neogeo titles unfortunately.

Actions #21

Updated by ASSympt0te over 8 years ago

I don't think it is the same bug. This affects LLE and HLE, neogeo bug is exclusive to HLE.

Actions #22

Updated by phire over 8 years ago

I'm pretty sure loading samples on enable/disable DMA is correct, but I think the AudioDMACallback which runs at 4khz needs to have it's phase adjusted to match the timing of enabling the DMA.

If the homebrew is ignoring the Audio DMA interrupt + latching for correct timing (which will quickly force any game into whatever phase that dolphin chooses) and is using timers to manually trigger the Audio DMA at the correct time... you could get issues.

Actions #23

Updated by phire over 8 years ago

So... I've looked into this.

Dolphin currently latches the new values onto the Audio DMA at the start of a new transferer. Because this Homebrew hasn't updated the buffer, dolphin goes back to the start of previous buffer and loads the entire thing (512 samples). Then dolphin fires the Audio DMA interrupt.

The game sees this interrupt and stops the Audio DMA, loads the new address into it and starts a new transfer.

I've experimented and it looks like the re-latching interrupt is meant to fire soon enough that this homebrew can successfully restart the DMA at a new address before any samples are read out of memory.

Actions #24

Updated by pokechu22 about 2 years ago

Actions #26

Updated by pokechu22 about 2 years ago

Actions #27

Updated by pokechu22 about 2 years ago

Actions #28

Updated by ZephyrSurfer almost 2 years ago

Was the status of this ticket supposed to be set to Fixed or is there more to investigate here?

Actions #29

Updated by pokechu22 almost 2 years ago

  • Status changed from Accepted to Fixed

Pretty sure I meant to set this to fixed, yeah.

Actions

Also available in: Atom PDF