fheroes2
fheroes2 copied to clipboard
Adventure map, sound of the horse's hooves continues after the horse has reached its destination
Preliminary checks
- [X] I've checked that there aren't other open issues on the same topic.
- [X] I've checked that this issue is reproducible on the latest snapshot build.
Platform
Windows
Describe the bug
Windows 7 SP1 - 64 bits
In fheroes2, the sound of the horse's hooves continues after the horse has reached its destination.
In fheroes2: Activate the sound of the video.
https://github.com/ihhub/fheroes2/assets/43583994/95ced611-2334-4eaa-a164-f1d4a741376b
Save file
Here is the save file: Horse sound after move 01.zip
Additional info
Windows 7 SP1 - 64 bits
Hi, @LeHerosInconnu Are you using MIDI? I believe this issue is valid only for MIDI sound, while for external music I cannot reproduce this problem.
Hello @Branikolog,
Hi, @LeHerosInconnu Are you using MIDI? I believe this issue is valid only for MIDI sound, while for external music I cannot reproduce this problem.
Yes, MIDI is used when the problem is detected. I did a test with .ogg files in the MUSIC folder and "Music Type" set to "External" and the problem is no longer present. There must have been a change in MIDI management at some point.
There must have been a change in MIDI management at some point.
This was always the case. MIDI playback (more precisely, MIDI playback startup) is slow in SDL_mixer. Here is the video of fheroes2 1.0.0 released Dec 21 2022 (more than a year ago):
https://github.com/ihhub/fheroes2/assets/32623900/9204a89e-f302-48f2-8614-a84acbc0dd73
As you can see, there is the same pause that caused by delay of playing the WAV musical effect for this Shrine caused by MIDI soundtrack change due to the change of terrain. This is the same place, but using the Windows built-in MIDI (not FluidSynth MIDI) - i removed the soundfont file to force SDL_mixer to switch to the Windows MIDI:
https://github.com/ihhub/fheroes2/assets/32623900/ad69ddd4-4c19-487c-a2d2-3781f1e698bf
The same delay (approximately +/-). We tried to mitigate this at the time by moving the background music playback to a separate thread, and it's just that when crossing the border of the terrain it's almost unnoticeable (except for some extra horse step sounds maybe), but in situations like this it will be noticeable with MIDI, because SDL_mixer cannot start MIDI music (which, again, is a rather slow operation) and play WAV file at the same time, because it's not thread-safe. There's not much we can do about it right now. Do not use MIDI :)
This delay is not observed with prehistoric 0.9.11, but the only reason is that in that version background music changes AFTER the object is visited, consider (turn the video sound on):
https://github.com/ihhub/fheroes2/assets/32623900/ba61a0d2-33c6-45ab-8b3b-86d290cffc66
And the MIDI playback itself was problematic even then, it was just a bit disguised in this particular case. Regarding horse steps, in this video (also with prehistoric 0.9.11) you can hear how the horse steps sounds continue a little even after the hero stops on the new terrain, because their playback has been delayed a bit during the MIDI music change due to change of terrain:
https://github.com/ihhub/fheroes2/assets/32623900/3406d9dc-c7f6-4393-8d3a-559d1ed47f78
And so far it can't be any other way.