Skip to content

Commit 6a2375a

Browse files
committed
Integrate native Linux audio backends
1 parent df37f97 commit 6a2375a

6 files changed

Lines changed: 40 additions & 5 deletions

File tree

‎scripts/vcpkg‎

‎scripts/vcpkg-manifest/vcpkg.json‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@
1717
"platform": "windows"
1818
},
1919
{
20-
"name": "sdl2",
21-
"platform": "linux",
22-
"default-features": false
20+
"name": "pipewire",
21+
"platform": "linux"
22+
},
23+
{
24+
"name": "pulseaudio",
25+
"platform": "linux"
26+
},
27+
{
28+
"name": "jack2",
29+
"platform": "linux"
30+
},
31+
{
32+
"name": "alsa",
33+
"platform": "linux"
2334
},
2435
"interval-tree",
2536
"boost-interprocess",

‎src/libs/3rdparty/talcs‎

Submodule talcs updated 43 files

‎src/plugins/audio/CMakeLists.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ diffscope_add_builtin_plugin(${PROJECT_NAME}
4343
internal/**
4444
)
4545

46+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
47+
add_dependencies(${PROJECT_NAME} TalcsPipeWire TalcsPulseAudio TalcsJack TalcsAlsa)
48+
file(RELATIVE_PATH _talcs_library_dir "/${CK_INSTALL_PLUGINS_DIR}/audio" "/${CK_INSTALL_LIBRARY_DIR}")
49+
target_compile_definitions(${PROJECT_NAME} PRIVATE AUDIO_TALCS_LIBRARY_RELATIVE_DIR="${_talcs_library_dir}")
50+
endif()
51+
4652
file(GLOB _res_soundfx res/soundfx/*)
4753
qt_add_resources(${PROJECT_NAME} soundfx
4854
PREFIX /diffscope/audio/soundfx

‎src/plugins/audio/internal/AudioPlugin.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "AudioPlugin.h"
55

66
#include <QApplication>
7+
#include <QDir>
78
#include <QPointer>
89
#include <QQmlComponent>
910
#include <QSplashScreen>
@@ -19,6 +20,7 @@
1920

2021
#include <SVSCraftQuick/MessageBox.h>
2122

23+
#include <TalcsDevice/AudioDriverManager.h>
2224
#include <TalcsDevice/OutputContext.h>
2325

2426
#include <coreplugin/CoreInterface.h>
@@ -117,6 +119,10 @@ namespace Audio::Internal {
117119

118120
void AudioPlugin::initializeAudioSystem() {
119121
new AudioSystem(this);
122+
#ifdef Q_OS_LINUX
123+
const auto directory = QDir(pluginSpec()->location()).absoluteFilePath(QStringLiteral(AUDIO_TALCS_LIBRARY_RELATIVE_DIR));
124+
AudioSystem::outputSystem()->outputContext()->driverManager()->loadBuiltInDriverLibraries(directory);
125+
#endif
120126
GlobalAudioContextPrivate::create(this);
121127
}
122128

‎src/share/install.cmake‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ endif()
4747

4848
set(_exclude)
4949

50+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
51+
# Native driver modules are loaded at runtime and are not link dependencies of the audio plugin.
52+
install(TARGETS TalcsPipeWire TalcsPulseAudio TalcsJack TalcsAlsa
53+
LIBRARY DESTINATION ${CK_INSTALL_LIBRARY_DIR}
54+
)
55+
# Native audio clients and their backend modules must use the deployment environment.
56+
list(APPEND _exclude
57+
"/lib(pipewire-0[.]3|pulse(-simple|-mainloop-glib|-common-[^/]*)?|jack(net|server)?|asound|atopology)[.]so([.][^/]*)?$"
58+
"/(pipewire-0[.]3|spa-0[.]2|pulseaudio)/"
59+
)
60+
endif()
61+
5062
if(UNIX AND NOT APPLE)
5163
# Libraries resolved from the system library directories (glibc, graphics drivers, X11, D-Bus,
5264
# ...) must come from the target system. Qt and vcpkg libraries resolve from their own

0 commit comments

Comments
 (0)