Sdl mixer usage in sdl2.0.9


#1

hi.
i was wondering what is the correct workflow of api calls to create/destroy sdl mixer?
currently this is the logic:

SDL_Init(SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS) Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 512)
Mix_Quit()
SDL_Quit()

should i also call
Mix_Init()
Mix_CloseAudio()
any where?


#2

After a lot of testing and experimentation, this is the order I do it:

SDL_Init
Mix_OpenAudio
Mix_Init

And to shut down:

(stop all playing channels and music)
(free all sound and music chunks)
Mix_CloseAudio
Mix_Quit
SDL_Quit

Other combinations result in crashes.


#3

Pretty sure Mix_Init should be called before Mix_OpenAudio. Why would it crash?