gpt4 book ai didi

c++ - Mix_Init和Mix_OpenAudio SDL有什么区别?

转载 作者:行者123 更新时间:2023-12-03 01:14:46 26 4
gpt4 key购买 nike

我看到了许多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 leastreturn success if support is already loaded. You may call thismultiple times, which will actually require you to call Mix_Quit justonce to clean up. You may call this function with a 0 to retrievewhether 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com