File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed
Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR BSD" OFF)
6666cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR BSD OR WIN32" OFF )
6767cmake_dependent_option(ENABLE_LIBNM "Enable libnm" ON "LINUX" OFF )
6868cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF )
69- cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR BSD " OFF )
69+ cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX" OFF )
7070cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF )
7171cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF )
7272cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF )
@@ -533,7 +533,7 @@ elseif(BSD)
533533 src/detection/poweradapter/poweradapter_nosupport.c
534534 src/detection/processes/processes_bsd.c
535535 src/detection/gtk_qt/qt.c
536- src/detection/sound/sound_linux .c
536+ src/detection/sound/sound_bsd .c
537537 src/detection/swap/swap_bsd.c
538538 src/detection/temps/temps_bsd.c
539539 src/detection/terminalfont/terminalfont_linux.c
@@ -954,6 +954,7 @@ elseif(BSD)
954954 PRIVATE "m"
955955 PRIVATE "usbhid"
956956 PRIVATE "geom"
957+ PRIVATE "mixer"
957958 )
958959elseif (ANDROID)
959960 CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)
Original file line number Diff line number Diff line change 1+ #include "sound.h"
2+
3+ #include <mixer.h>
4+
5+ const char * ffDetectSound (FFlist * devices )
6+ {
7+ int nmixers = mixer_get_nmixers ();
8+ if (nmixers == 0 ) return "No mixers found" ;
9+
10+ if (__builtin_expect (nmixers > 9 , false)) nmixers = 9 ;
11+
12+ char path [] = "/dev/mixer0" ;
13+
14+ for (int idev = 0 ; idev < nmixers ; ++ idev )
15+ {
16+ path [strlen ("/dev/mixer" )] = (char ) ('0' + idev );
17+ struct mixer * m = mixer_open (path );
18+ if (!m ) continue ;
19+
20+ if (m -> mode & MIX_MODE_PLAY )
21+ {
22+ struct mix_dev * dev = mixer_get_dev_byname (m , "vol" );
23+ if (dev )
24+ {
25+ FFSoundDevice * device = ffListAdd (devices );
26+ ffStrbufInitS (& device -> identifier , path );
27+ ffStrbufInitF (& device -> name , "%s %s" , m -> ci .longname , m -> ci .hw_info );
28+ device -> volume = MIX_ISMUTE (m , dev -> devno ) ? 0 : (uint8_t ) MIX_VOLDENORM ((dev -> vol .left + dev -> vol .right ) / 2 );
29+ device -> active = true;
30+ device -> main = !!m -> f_default ;
31+ }
32+ }
33+
34+ mixer_close (m );
35+ }
36+
37+ return NULL ;
38+ }
You can’t perform that action at this time.
0 commit comments