- --
Viewing Issue Advanced Details
[ Jump to Notes ]
ID | Category [?] | Severity [?] | Reproducibility | Date Submitted | Last Update |
---|---|---|---|---|---|
09203 | Sound | Major | Always | 4 days ago | 1 day ago |
Tester | hap | View Status | Public | Platform | MAME (Official Binary) |
Assigned To | Resolution | Open | OS | Windows 10/11 (64-bit) | |
Status [?] | Confirmed | Driver | |||
Version | 0.278 | Fixed in Version | Build | 64-bit | |
Fixed in Git Commit | Github Pull Request # | ||||
Summary | 09203: Sound: unstable buffer synchronization | ||||
Description |
Sound module abuffer ( https://github.com/mamedev/mame/blob/master/src/osd/modules/sound/sound_module.cpp ) has desync issues. If a desync happens, for example after save/loadstate, or after pressing fast forward, the sound will crackle every 20ms, and it will have trouble restabilizing. It is deliberate, see: // If there are too many buffers, remove five samples per buffer // to slowly resync to reduce latency (4 seconds to // compensate one buffer, roughly) So, it will crackle for 4 seconds per buffer, which is already annoying. But even after that, it hovers over the number of buffers limit occasionally, and you'll still get sound crackling. abuffer is used in: File modules\sound\coreaudio_sound.cpp File modules\sound\pa_sound.cpp File modules\sound\pipewire_sound.cpp File modules\sound\pulse_sound.cpp File modules\sound\sdl_sound.cpp File modules\sound\wasapi_sound.cpp File modules\sound\xaudio2_sound.cpp |
||||
Steps To Reproduce |
Run a game with clear simple sound, such as pacman. Briefly press INS (the fast forward key) to force a desync. Listen to sound crackling. Note: to force it to resync cleanly and get rid of the sound crackling, simply pause and unpause. |
||||
Additional Information | |||||
Github Commit | |||||
Flags | |||||
Regression Version | 0.278 | ||||
Affected Sets / Systems | |||||
Attached Files
|
|||||
Relationships
There are no relationship linked to this issue. |
Notes
6
![]() No.23457
Augusto Tester
4 days ago
|
That issue happen here too. Ubuntu 24.04. MAME using pulseaudio. |
---|---|
![]() No.23460
Robbbert Moderator
3 days ago
edited on: 3 days ago |
Not happening here - sound is clean when INS released. Tried xaudio2 (my default), wasapi, and port audio - using the default settings with all effects off (Bypass). However, it does happen for some users, so i will confirm it. |
![]() No.23461
hap Developer
3 days ago
|
If you can't hear it, try this in osd/modules/sound/sound_module.cpp: } else if(m_used_buffers >= 5) { printf("x"); // If there are too many buffers, remove five samples per buffer // to slowly resync to reduce latency (4 seconds to // compensate one buffer, roughly) m_delta2 -= std::max<uint32_t>(samples / 200, 1); buf.m_cpos = std::max<uint32_t>(samples / 200, 1); } Press INS briefly, and check if it keeps printing x-es. Every "x" is an audible click. Perhaps not with your ears, but it is there. |
![]() No.23462
danylopez123 Tester
3 days ago
|
All i know from this weird audio sync is that launching a game results in some sort of delayed audio but to fix it, pause the game for a second then resume, that's when the audio it's in more in sync. However, doing the turbo will delay the audio again, to fix it again that's where i do the pause thing again. Used XAudio2 with 0.0 Latency |
![]() No.23465
Robbbert Moderator
2 days ago
edited on: 2 days ago |
@hap, I tried adding the "x", and a bunch of x's showed after releasing INS, this being in pacman's attract mode which is silent. I then replaced "x" with "%d ",m_used_buffers and this shows 10 then slowly dropping to 5 and eventually stopped printing. So, the code appears to be working as designed. However there were no clicks, just silence. I also tried kof2002 during its attract sequence, no audible issue there either. |
![]() No.23471
hap Developer
1 day ago
|
Yeah, it keeps hovering at 5 buffers when that happens (which is 100ms latency), even when the sound module can handle lower latency than that. Imagine opening a wav file in an editor, and every 800 samples or so, you cut away a few samples. That will introduce a click at each of those points when playing it back. That's what MAME does right now. |