Commit 3f447246 by PioLing Committed by GitHub

使用SDL_OpenAudioDevice接口打开音频设备 (#2489)

修复SDL_OpenAudio()接口可能打开失败问题
parent 936babf4
...@@ -33,8 +33,8 @@ SDLAudioDevice::SDLAudioDevice() { ...@@ -33,8 +33,8 @@ SDLAudioDevice::SDLAudioDevice() {
SDLAudioDevice *_this = (SDLAudioDevice *) userdata; SDLAudioDevice *_this = (SDLAudioDevice *) userdata;
_this->onReqPCM((char *) stream, len); _this->onReqPCM((char *) stream, len);
}; };
if (SDL_OpenAudio(&wanted_spec, &_audio_config) < 0) { if (SDL_OpenAudioDevice(NULL, 0, &wanted_spec, &_audio_config, SDL_AUDIO_ALLOW_ANY_CHANGE) < 0) {
throw std::runtime_error("SDL_OpenAudio failed"); throw std::runtime_error("SDL_OpenAudioDevice failed");
} }
InfoL << "actual audioSpec, " << "freq:" << _audio_config.freq InfoL << "actual audioSpec, " << "freq:" << _audio_config.freq
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论