Skip to content

Commit

Permalink
Implement Pipewire audio driver
Browse files Browse the repository at this point in the history
  • Loading branch information
rtbo committed Aug 14, 2024
1 parent 8f634ad commit 04fe3bb
Show file tree
Hide file tree
Showing 4 changed files with 931 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/framework/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ elseif(OS_IS_LIN OR OS_IS_FBSD)
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.h
)
if (MUSE_MODULE_AUDIO_PW)
set(DRIVER_SRC
${DRIVER_SRC}
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/pwaudiodriver.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/pwaudiodriver.h
)
endif()
endif()
elseif(OS_IS_MAC)
set(DRIVER_SRC
Expand Down
19 changes: 18 additions & 1 deletion src/framework/audio/audiomodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ using namespace muse::audio::fx;

#ifdef Q_OS_LINUX
#include "internal/platform/lin/linuxaudiodriver.h"
#ifdef MUSE_MODULE_AUDIO_PW
#include "internal/platform/lin/pwaudiodriver.h"
#endif
#endif

#ifdef Q_OS_FREEBSD
Expand Down Expand Up @@ -113,6 +116,20 @@ std::string AudioModule::moduleName() const
return "audio_engine";
}

#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
std::shared_ptr<IAudioDriver> makeLinuxAudioDriver()
{
#if defined(Q_OS_LINUX) && defined(MUSE_MODULE_AUDIO_PW)
auto driver = std::make_shared<PwAudioDriver>();
if (driver->connectedToPwServer()) {
return driver;
}
#endif // Q_OS_LINUX && MUSE_MODULE_AUDIO_PW
return std::make_shared<LinuxAudioDriver>();
}

#endif // Q_OS_LINUX || Q_OS_FREEBSD

void AudioModule::registerExports()
{
m_configuration = std::make_shared<AudioConfiguration>();
Expand All @@ -131,7 +148,7 @@ void AudioModule::registerExports()
#else

#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
m_audioDriver = std::shared_ptr<IAudioDriver>(new LinuxAudioDriver());
m_audioDriver = makeLinuxAudioDriver();
#endif

#ifdef Q_OS_WIN
Expand Down
Loading

0 comments on commit 04fe3bb

Please sign in to comment.