From 52a976489b84d205a01486ee19e918ee787115d9 Mon Sep 17 00:00:00 2001 From: AltoXorg <56553686+Alto1772@users.noreply.github.com> Date: Sun, 22 Jan 2023 07:05:05 +0800 Subject: [PATCH] implement audio backend fallbacks (#1857) * audio & rendering backend option greyed out if theres only one * add audio fallback code * InitializeAudioPlayer/WindowManager add param * string -> string_view * Revert "audio & rendering backend option greyed out if theres only one" This reverts commit e94a7fff50088068afa515caa826b1625d2b154d. * revert lus changes * moved fallback function to LUS * use audioplayerbridge --- soh/soh/OTRGlobals.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 6c7bb459f..a34c69917 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1242,29 +1242,19 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) { } extern "C" bool AudioPlayer_Init(void) { - if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetAudioPlayer()->Init(); - } - - return false; + return AudioPlayerInit(); } extern "C" int AudioPlayer_Buffered(void) { - if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetAudioPlayer()->Buffered(); - } + return AudioPlayerBuffered(); } extern "C" int AudioPlayer_GetDesiredBuffered(void) { - if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetAudioPlayer()->GetDesiredBuffered(); - } + return AudioPlayerGetDesiredBuffered(); } extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { - if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { - OTRGlobals::Instance->context->GetAudioPlayer()->Play(buf, len); - } + AudioPlayerPlayFrame(buf, len); } extern "C" int Controller_ShouldRumble(size_t slot) {