Sound Effects of the same name shouldn't stack. #125
Labels
No Label
RGSS accuracy
bug
compilation
discussion
documentation
duplicate
enhancement
invalid
performance issue
port request
question
ruby incompatibility
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MapleShrine/mkxp#125
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If you have a script with the following:
...RPG Maker will only play the sound once, while MKXP will "stack" the sound on top of itself. There is either a timeout on sounds with the same filename, or there is handled some other way.
To determine that this is actually how RPG Maker works, I recorded a sound being played once, followed by that sound being played 20 times in both RPG Maker VX and MKXP on Windows. You can clearly see that the waveform is unaffected in RPG Maker, but affected in MKXP. (In Linux, this distortion can actually be heard.)
For my own purposes, I solved the problem this way:
https://github.com/sorlok/mkxp/blob/ld_hacks/src/audio.cpp#L313
Perhaps this isn't really an issue for most games? Stacking sound effects is certainly bad design. Anyway, just thought I'd bring this to your attention.
Ah yes, I've dealt with this problem before. Specifically, in a game which displayed each letter of a message box separately and made a typewriter kind of noise for each letter. RMVXA actually ate every 2nd or 3rd of those sounds and made it sound very unnatural, so to be honest, I'm not sure if the behavior in RMVXA is even intentional or just some obscure implementation detail of the sound backend they use.
It certainly wouldn't be wrong to at least introduce some kind of throttling in mkxp, at least for all sound instances played during the same frame. Since you already started experimenting, would you mind finding out what the threshold for RMXP/VXA is before a sound is "swallowed", and if it's related to the current graphics frame at all? (I suspect not)
From the help file(s):
Now, to find out what "short period" means :)
Sure, I'll dig into it. I expect it'll be somewhere around ~50ms, and I agree that it's not likely to be related to the current graphics frame (because I added "sleep" statements to the sample code and then all the sounds played in RMVX).
Looks like I was way off: it's actually 1ms:
I would hazard a guess that they don't even test actual time deltas; they just check if time_in_ms() > last_time_in_ms() for each filename.