File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,15 +26,18 @@ int main(int, char** argv)
2626 return (EXIT_FAILURE );
2727 }
2828
29- MIX_Init ();
29+ if (!MIX_Init ()) {
30+ fprintf (stdout, " Cannot initialize SDL Mixer: %s\n " , SDL_GetError ());
31+ return (EXIT_FAILURE );
32+ }
3033
3134 SDL_AudioSpec spec;
3235 spec.freq = 44100 ;
3336 spec.format = SDL_AUDIO_S16 ;
3437 spec.channels = 2 ;
3538 MIX_Mixer* mixer = MIX_CreateMixerDevice (SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK , &spec);
3639 if (!mixer) {
37- fprintf (stdout, " Cannot initialize SDL Mixer : %s\n " , SDL_GetError ());
40+ fprintf (stdout, " Cannot initialize audio device : %s\n " , SDL_GetError ());
3841 return (EXIT_FAILURE );
3942 }
4043
@@ -60,5 +63,6 @@ int main(int, char** argv)
6063 fprintf (stdout, " Success\n " );
6164 MIX_DestroyAudio (music);
6265 MIX_DestroyMixer (mixer);
66+ MIX_Quit ();
6367 return (EXIT_SUCCESS );
6468}
You can’t perform that action at this time.
0 commit comments