Skip to content

Commit

Permalink
Add audio plugin hosting via Carla
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed May 17, 2023
1 parent 323c7e0 commit 096ac5d
Show file tree
Hide file tree
Showing 21 changed files with 3,520 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "plugins/obs-websocket"]
path = plugins/obs-websocket
url = https://github.com/obsproject/obs-websocket.git
[submodule "plugins/carla/carla"]
path = plugins/carla/carla
url = https://github.com/falkTX/Carla.git
2 changes: 2 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)

# Add plugins in alphabetical order to retain order in IDE projects
add_subdirectory(aja)
add_subdirectory(carla)
if(OS_WINDOWS OR OS_MACOS)
add_subdirectory(coreaudio-encoder)
endif()
Expand Down Expand Up @@ -191,3 +192,4 @@ add_subdirectory(obs-transitions)
add_subdirectory(rtmp-services)
add_subdirectory(text-freetype2)
add_subdirectory(aja)
add_subdirectory(carla)
111 changes: 111 additions & 0 deletions plugins/carla/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
cmake_minimum_required(VERSION 3.16...3.25)

legacy_check()

option(ENABLE_CARLA "Enable building OBS with carla plugin host" ON)
if(NOT ENABLE_CARLA)
target_disable(carla)
return()
endif()

# Find Qt
find_qt(COMPONENTS Core Widgets)

# Use pkg-config to find optional deps
find_package(PkgConfig)

# Find pthread via cmake
if(OS_WINDOWS)
set(carla_pthread_libs OBS::w32-pthreads)
else()
find_package(Threads REQUIRED)
set(carla_pthread_libs ${CMAKE_THREAD_LIBS_INIT})
endif()

# Optional: transient X11 window flags
if(PKGCONFIG_FOUND AND NOT (OS_MACOS OR OS_WINDOWS))
pkg_check_modules(X11 "x11")
else()
set(X11_FOUND FALSE)
endif()

# Use *.mm files under macOS, regular *.cpp everywhere else
if(OS_MACOS)
set(CARLA_OBJCPP_EXT "mm")
else()
set(CARLA_OBJCPP_EXT "cpp")
endif()

# Import extra carla libs
include(cmake/jackbridge.cmake)
add_library(carla::jackbridge ALIAS carla-jackbridge)

include(cmake/lilv.cmake)
add_library(carla::lilv ALIAS carla-lilv)

include(cmake/rtmempool.cmake)
add_library(carla::rtmempool ALIAS carla-rtmempool)

include(cmake/water.cmake)
add_library(carla::water ALIAS carla-water)

# Setup binary tools
include(cmake/carla-discovery-native.cmake)
include(cmake/carla-bridge-native.cmake)

# Setup carla-bridge target
add_library(carla-bridge MODULE)
add_library(OBS::carla-bridge ALIAS carla-bridge)

target_compile_definitions(
carla-bridge
PRIVATE BUILDING_CARLA
BUILDING_CARLA_OBS
CARLA_BACKEND_NAMESPACE=CarlaBridgeOBS
CARLA_FRONTEND_NO_CACHED_PLUGIN_API
CARLA_MODULE_ID="carla-bridge"
CARLA_MODULE_NAME="Carla Bridge"
CARLA_PLUGIN_ONLY_BRIDGE
STATIC_PLUGIN_TARGET)

target_include_directories(
carla-bridge
PRIVATE carla/source
carla/source/backend
carla/source/frontend
carla/source/frontend/utils
carla/source/includes
carla/source/modules
carla/source/utils)

# TODO remove carla::water dependency from PluginDiscovery.cpp

target_link_libraries(carla-bridge PRIVATE carla::jackbridge carla::lilv carla::water OBS::libobs Qt::Core Qt::Widgets)

if(NOT (OS_MACOS OR OS_WINDOWS))
target_link_options(carla-bridge PRIVATE -Wl,--no-undefined)
endif()

target_sources(
carla-bridge
PRIVATE carla.c
carla-bridge.cpp
carla-bridge-wrapper.cpp
common.c
qtutils.cpp
carla/source/backend/utils/Information.cpp
carla/source/backend/utils/PluginDiscovery.cpp
carla/source/frontend/carla_frontend.cpp
carla/source/frontend/pluginlist/pluginlistdialog.cpp
carla/source/frontend/pluginlist/pluginlistrefreshdialog.cpp
carla/source/utils/CarlaBridgeUtils.cpp
carla/source/utils/CarlaMacUtils.${CARLA_OBJCPP_EXT}
carla/source/utils/CarlaPipeUtils.cpp)

set_target_properties_obs(
carla-bridge
PROPERTIES AUTOMOC ON
AUTOUIC ON
AUTORCC ON
FOLDER plugins
PREFIX "")
1 change: 1 addition & 0 deletions plugins/carla/carla
Submodule carla added at ad7def
Loading

0 comments on commit 096ac5d

Please sign in to comment.