CMain: Support SDL2 audio backend

This commit is contained in:
Luke Street 2022-05-31 20:48:25 -04:00
parent 2364c4cdba
commit a76d26d724
3 changed files with 16 additions and 5 deletions

View File

@ -195,6 +195,8 @@ public:
m_voiceEngine->setVolume(0.f); m_voiceEngine->setVolume(0.f);
} }
#endif #endif
m_voiceEngine->startPump();
} }
void initialize() { void initialize() {
@ -273,9 +275,15 @@ public:
if (g_mainMP1) { if (g_mainMP1) {
m_imGuiConsole.PreUpdate(); m_imGuiConsole.PreUpdate();
if (m_voiceEngine) {
m_voiceEngine->lockPump();
}
if (g_mainMP1->Proc(dt)) { if (g_mainMP1->Proc(dt)) {
return false; return false;
} }
if (m_voiceEngine) {
m_voiceEngine->unlockPump();
}
m_imGuiConsole.PostUpdate(); m_imGuiConsole.PostUpdate();
} else { } else {
auto result = m_imGuiConsole.ShowAboutWindow(false, m_errorString, true); auto result = m_imGuiConsole.ShowAboutWindow(false, m_errorString, true);
@ -334,13 +342,16 @@ public:
void onAppExiting() noexcept override { void onAppExiting() noexcept override {
m_imGuiConsole.Shutdown(); m_imGuiConsole.Shutdown();
if (m_voiceEngine) {
m_voiceEngine->stopPump();
}
if (g_mainMP1) { if (g_mainMP1) {
g_mainMP1->Shutdown(); g_mainMP1->Shutdown();
} }
g_mainMP1.reset(); g_mainMP1.reset();
m_cvarManager.serialize(); m_cvarManager.serialize();
m_voiceEngine.reset();
m_amuseAllocWrapper.reset(); m_amuseAllocWrapper.reset();
m_voiceEngine.reset();
CDvdFile::Shutdown(); CDvdFile::Shutdown();
} }

View File

@ -1750,13 +1750,13 @@ void ImGuiConsole::ShowPipelineProgress() {
void ImGuiConsole::ControllerAdded(uint32_t idx) { void ImGuiConsole::ControllerAdded(uint32_t idx) {
const char* name = PADGetName(idx); const char* name = PADGetName(idx);
if (name != nullptr) { if (name != nullptr) {
m_toasts.emplace_back(fmt::format("Controller {} ({}) connected", idx, name), 5.f); m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} ({}) connected"), idx, name), 5.f);
} else { } else {
m_toasts.emplace_back(fmt::format("Controller {} connected", idx), 5.f); m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} connected"), idx), 5.f);
} }
} }
void ImGuiConsole::ControllerRemoved(uint32_t idx) { void ImGuiConsole::ControllerRemoved(uint32_t idx) {
m_toasts.emplace_back(fmt::format("Controller {} disconnected", idx), 5.f); m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} disconnected"), idx), 5.f);
} }
} // namespace metaforce } // namespace metaforce

2
extern/boo vendored

@ -1 +1 @@
Subproject commit 49364a152fb9c42d73415db6071f32213cfd127c Subproject commit 6e4030212c1a2a21a79a6d69660b6e7a52cf2885