19 #include <SDL2/SDL_mixer.h>
23 if (SDL_Init(SDL_INIT_AUDIO) < 0) {
24 fprintf(stdout,
"Cannot initialize SDL Audio: %s\\n", SDL_GetError());
25 return (EXIT_FAILURE);
28 if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024) == -1) {
29 fprintf(stdout,
"Cannot initialize SDL Mixer: %s\\n", Mix_GetError());
30 return (EXIT_FAILURE);
33 if (Mix_Init(MIX_INIT_OGG) != MIX_INIT_OGG) {
34 fprintf(stdout,
"Cannot initialize OGG codec: %s\\n", Mix_GetError());
36 return (EXIT_FAILURE);
39 Mix_Music* music = Mix_LoadMUS(argv[1]);
40 if (music ==
nullptr) {
41 fprintf(stdout,
"Cannot load music file: %s\\n", Mix_GetError());
43 return (EXIT_FAILURE);
46 fprintf(stdout,
"Success\\n");
49 return (EXIT_SUCCESS);
int main(int, char **argv)