我看到了许多SDL_mixer的教程,但是都没有使用Mix_Init函数。我在文档页面上看到了此Mix_Init函数
https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer.html
这些教程仅使用名为Mix_OpenAudio的函数来初始化SDL_mixer。
我的问题是,如果我调用函数Mix_OpenAudio,它将自动调用函数Mix_Init或无需调用函数Mix_Init。
是Mix_Init函数只是某些类型的检查器函数。
最佳答案
查看https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_9.html上的文档:
Initialize by loading support as indicated by the flags, or at least return success if support is already loaded. You may call this multiple times, which will actually require you to call Mix_Quit just once to clean up. You may call this function with a 0 to retrieve whether support was built-in or not loaded yet.
如果您需要支持flac,mp3,ogg vorbis等压缩音频格式,则需要使用所需格式列表调用此函数。如果未在SDL_mixer中内置该代码,则将导致加载所需的代码以对该格式进行解压缩。如果仅使用WAV,则可以省略
Mix_Init
调用。
关于c++ - Mix_Init和Mix_OpenAudio SDL有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62871345/