-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加新的音频引擎 miniaudio #2679
base: master
Are you sure you want to change the base?
添加新的音频引擎 miniaudio #2679
Conversation
Can it run on Mac or Linux? |
auto name = BGMList[scene][bgm].c_str(); | ||
wchar_t fname[1024]; | ||
myswprintf(fname, L"./sound/BGM/%ls", name); | ||
PlayMusic(reinterpret_cast<char*>(fname), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use EncodeUTF8 rather than reinterpret_cast
return; | ||
ma_sound_uninit(&soundBGM); | ||
#ifdef _WIN32 | ||
ma_sound_init_from_file_w(&engineMusic, reinterpret_cast<wchar_t*>(song), MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundBGM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also DecodeUTF8 here.
@@ -177,6 +188,139 @@ void SoundManager::PlaySoundEffect(int sound) { | |||
break; | |||
} | |||
#endif | |||
#ifdef YGOPRO_USE_MINIAUDIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use #elif
@@ -25,6 +25,17 @@ bool SoundManager::Init() { | |||
} | |||
#endif // YGOPRO_USE_IRRKLANG | |||
// TODO: Implement other sound engines | |||
#ifdef YGOPRO_USE_MINIAUDIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use #elif
break; | ||
} | ||
case SOUND_COMMON_FEEDBACK: { | ||
ma_engine_play_sound(&engineSound, "./sound/common_feedback.wav", nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used in YGOPro. Please remove it for now.
BUILD_MINIAUDIO = false | ||
end | ||
if not BUILD_miniaudio then | ||
MINIAUDIO_INCLUDE_DIR = GetParam("miniaudio-include-dir") or "/usr/local/include" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miniaudio being a single header library, everything in premake5.lua is not needed.
You may toss the miniaudio.h file to gframe directory directly. But remember to add some conditional checks in gframe/premake5.lua
哦,我晚点改,现在在写xmake。 |
I'm planning to use this one. Thanks for your work anyway. |
https://miniaud.io/docs/manual/
有点疑虑
这里好像未经初始化就使用变量了,而我自己编译时往往带了-ftrivial-auto-var-init=zero,用于把变量自动初始化为0。
premake未测试……
大概没问题……