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) {
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) {