From b3e7451a08fce096e84e6a82b215b7764f5835ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 12 Feb 2025 00:17:36 +0800 Subject: [PATCH] Sound (Haiku): add stub file --- CMakeLists.txt | 3 ++- src/detection/sound/sound_haiku.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/detection/sound/sound_haiku.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 989c9fed9..7cd640d79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1139,7 +1139,7 @@ elseif(Haiku) src/detection/poweradapter/poweradapter_nosupport.c src/detection/processes/processes_haiku.c src/detection/gtk_qt/qt.c - src/detection/sound/sound_nosupport.c + src/detection/sound/sound_haiku.cpp src/detection/swap/swap_haiku.c src/detection/terminalfont/terminalfont_linux.c src/detection/terminalshell/terminalshell_linux.c @@ -1616,6 +1616,7 @@ elseif(ANDROID) elseif(Haiku) target_link_libraries(libfastfetch PRIVATE "network" + PRIVATE "media" PRIVATE "be" PRIVATE "gnu" ) diff --git a/src/detection/sound/sound_haiku.cpp b/src/detection/sound/sound_haiku.cpp new file mode 100644 index 000000000..04dce76d5 --- /dev/null +++ b/src/detection/sound/sound_haiku.cpp @@ -0,0 +1,22 @@ +extern "C" +{ +#include "sound.h" +} +#include + +const char* ffDetectSound(FF_MAYBE_UNUSED FFlist* devices /* List of FFSoundDevice */) +{ + BMediaRoster* roster = BMediaRoster::Roster(); + media_node mediaNode; + + roster->GetAudioOutput(&mediaNode); + + int32_t mediaOutputCount = 0; + roster->GetAllOutputsFor(mediaNode, NULL, 0, &mediaOutputCount); + if (mediaOutputCount == 0) + return NULL; + + // TODO: Implement the rest of the function + + return "Not supported on this platform"; +}