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 e94a7fff50.

* revert lus changes

* moved fallback function to LUS

* use audioplayerbridge
This commit is contained in:
AltoXorg 2023-01-22 07:05:05 +08:00 committed by GitHub
parent 643a98244b
commit 52a976489b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1242,29 +1242,19 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
} }
extern "C" bool AudioPlayer_Init(void) { extern "C" bool AudioPlayer_Init(void) {
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { return AudioPlayerInit();
return OTRGlobals::Instance->context->GetAudioPlayer()->Init();
}
return false;
} }
extern "C" int AudioPlayer_Buffered(void) { extern "C" int AudioPlayer_Buffered(void) {
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { return AudioPlayerBuffered();
return OTRGlobals::Instance->context->GetAudioPlayer()->Buffered();
}
} }
extern "C" int AudioPlayer_GetDesiredBuffered(void) { extern "C" int AudioPlayer_GetDesiredBuffered(void) {
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { return AudioPlayerGetDesiredBuffered();
return OTRGlobals::Instance->context->GetAudioPlayer()->GetDesiredBuffered();
}
} }
extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { AudioPlayerPlayFrame(buf, len);
OTRGlobals::Instance->context->GetAudioPlayer()->Play(buf, len);
}
} }
extern "C" int Controller_ShouldRumble(size_t slot) { extern "C" int Controller_ShouldRumble(size_t slot) {