ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.58k stars 359 forks source link

macOS Sonoma on Apple Silicon: createMusic: Failed to create a music track from memory. The error: No SoundFonts have been requested #8554

Open pshirshov opened 2 months ago

pshirshov commented 2 months ago

Preliminary checks

Platform

macOS

Describe the bug

MIDI does not play on Apple Silicon machines w/macOS Sonoma 14.4.1, the error message in the console is

 [ERROR]    createMusic:  Failed to create a music track from memory. The error: No SoundFonts have been requested 

I use the homebrew version:

~$ brew info fheroes2
==> fheroes2: stable 1.0.13 (bottled), HEAD
Recreation of the Heroes of Might and Magic II game engine
https://ihhub.github.io/fheroes2/
/opt/homebrew/Cellar/fheroes2/1.0.13 (38 files, 8.4MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-04-02 at 22:47:13
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/f/fheroes2.rb
License: GPL-2.0-or-later
==> Dependencies
Build: cmake ✘, gettext ✔
Required: innoextract ✔, sdl2 ✔, sdl2_mixer ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
Documentation is available at:
/opt/homebrew/Cellar/fheroes2/1.0.13/share/doc/fheroes2/README.txt
==> Analytics
install: 199 (30 days), 702 (90 days), 2,343 (365 days)
install-on-request: 199 (30 days), 702 (90 days), 2,343 (365 days)
build-error: 0 (30 days)

Same thing happens whatever option I choose - External/MIDI/MIDI Expansion.

Save file

N/A

Additional info

No response

oleg-derevenetz commented 2 months ago

Looks like an issue with sdl2_mixer Homebrew package. Native MIDI backend seems to be disabled (I have no idea what the reason is), FluidSynth MIDI backend is enabled, but it requires sound fonts that have not been installed by fheroes2 package. Try to manually copy files/soundfonts/fheroes2.sf3 from the source package to ~/.fheroes2/files/soundfonts.

pshirshov commented 2 months ago

It works, thank you. Though, I think it's still a good idea to fix it in the brew formula or in the code itself.

oleg-derevenetz commented 2 months ago

Though, I think it's still a good idea to fix it in the brew formula or in the code itself.

There is nothing to fix in our code in this case. As for the brew formula, I do not know who is its regular maintainer. Personally, I don't use Homebrew, but MacPorts. In MacPorts, on the contrary, FluidSynth backend is disabled and native macOS MIDI is enabled, i.e. no soundfonts are required.

pshirshov commented 2 months ago

Well, it still might be a good idea to show a user-friendly error message.

oleg-derevenetz commented 2 months ago

Well, it still might be a good idea to show a user-friendly error message.

This error comes from SDL as a string. It doesn't make much sense to show this error in the game UI as is, because an average user, most likely, still won't understand what this means and what needs to be done, it's just going to be some kind of another incomprehensible "blablabla" error message for him. Also there is no point in trying to parse this error string somehow, because its wording is not a part of the API contract - this string can be changed, translated/localized, and so on at any time. Moreover, even though errors of this kind are returned by SDL, they can be originated from some 3-rd party library. Errors of this kind are logged and user can contact our team or package maintainer for help if something really doesn't work for him (e.g. he can't hear the MIDI music, like in your case).

ihhub commented 2 months ago

This issue is outside our project and must be fixed in Homebrew package itself, which is not maintained by the core team.