Banderi / Ozymandias

An open source re-implementation of Pharaoh (1999) in the Julius/Augustus engine
GNU Affero General Public License v3.0
109 stars 10 forks source link

Load music formats #3

Closed lysanntranvouez closed 3 years ago

lysanntranvouez commented 3 years ago

After running the game for the first time (and playing for a little bit 😃) I noticed some errors in the log concerning loading MP3 music. I had a look at how this could potentially be fixed and found out that SDL2_mixer can load extensions for different formats. So I added the code to initialize all available music formats. (I didn't really want to hardcode which formats to load inside the engine, but we could also forward the formats requested somehow - to at least log an error if an important format is missing. But I don't know well enough how the engine is structure and how such game specific settings should best be forwarded.)

Review the 2 commits individually. In the 2nd one I went a bit overboard with logging which formats are loaded ^^

Note that my default SDL2_mixer installation on macOS via homebrew didn't have any MP3 support built-in. But after building SDL2_mixer from source with MP3 support enabled, it worked like a charm. I have no idea what the version of SDL2_mixer supports that we suggest people install on other platforms. Perhaps we should update the build instructions mentioning this?

Banderi commented 3 years ago

I haven't taken a look at audio at all yet (in fact I've disabled some of it in code to make the engine ran initially) but would be great to get it working. The logging info looks very helpful so far, and yes the build instructions need to be updated for sure - most of it is 1:1 taken from Augustus' docs. If you feel like tackling this, feel free to!