libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
435 stars 147 forks source link

Sample programs don't call Mix_Init() #464

Closed genpfault closed 2 years ago

genpfault commented 2 years ago

The playmus.c and playwave.c sample programs don't call Mix_Init(), seemingly in violation of the API documentation (emphasis mine):

This function loads dynamic libraries that SDL_mixer needs, and prepares them for use. This must be the first function you call in SDL_mixer, and if it fails you should not continue with the library.

Are the samples wrong? Is the documentation wrong? Something else?

genpfault commented 2 years ago

Looks like the "This must be the first function you call in SDL_mixer" language was added earlier this year in this commit.

slouken commented 2 years ago

Yeah, I don't think that's correct. @icculus?

icculus commented 2 years ago

Hmm, Mix_Init() only configures music format stuff, and Mix_LoadMusic_RW() will do it for you anyhow. What's the value of having Mix_Init() at all, then? To know if a certain format is unsupported up front?

icculus commented 2 years ago

(We can change the "you must call this first" language in any case, since that's clearly not true.)

slouken commented 2 years ago

What's the value of having Mix_Init() at all, then? To know if a certain format is unsupported up front?

Yep.