-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <[email protected]> Co-authored-by: sqweek <[email protected]> Co-authored-by: Daniel Schürmann <[email protected]> Co-authored-by: Mooneer Salem <[email protected]> Co-authored-by: Be <[email protected]> Co-authored-by: Mario Kleiner <[email protected]>
- Loading branch information
1 parent
67ead0a
commit 0dce0e9
Showing
15 changed files
with
3,374 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# Copyright 2008 Matthias Kretz <[email protected]> | ||
# Copyright 2009 Marcus Hufgard <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# 3. Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
# SPDX-FileCopyrightText: 2008 Matthias Kretz <[email protected]> | ||
# SPDX-FileCopyrightText: 2009 Marcus Hufgard <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#.rst: | ||
# FindPulseAudio | ||
# -------------- | ||
# | ||
# This is base on | ||
# https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/find-modules/FindPulseAudio.cmake | ||
# | ||
# Try to locate the PulseAudio library. | ||
# If found, this will define the following variables: | ||
# | ||
# ``PulseAudio_FOUND`` | ||
# True if the system has the PulseAudio library of at least | ||
# the minimum version specified by either the version parameter | ||
# to find_package() or the variable PulseAudio_MINIMUM_VERSION | ||
# ``PulseAudio_INCLUDE_DIRS`` | ||
# The PulseAudio include directory | ||
# ``PulseAudio_LIBRARIES`` | ||
# The PulseAudio libraries for linking | ||
# ``PulseAudio_MAINLOOP_LIBRARY`` | ||
# The libraries needed to use PulseAudio Mainloop | ||
# ``PulseAudio_VERSION`` | ||
# The version of PulseAudio that was found | ||
# ``PulseAudio_INCLUDE_DIR`` | ||
# Deprecated, use ``PulseAudio_INCLUDE_DIRS`` | ||
# ``PulseAudio_LIBRARY`` | ||
# Deprecated, use ``PulseAudio_LIBRARIES`` | ||
# | ||
# If ``PulseAudio_FOUND`` is TRUE, it will also define the following | ||
# imported target: | ||
# | ||
# ``PulseAudio::PulseAudio`` | ||
# The PulseAudio library | ||
# | ||
# Since 5.41.0. | ||
|
||
# Support PulseAudio_MINIMUM_VERSION for compatibility: | ||
if(NOT PulseAudio_FIND_VERSION) | ||
set(PulseAudio_FIND_VERSION "${PulseAudio_MINIMUM_VERSION}") | ||
endif() | ||
|
||
# the minimum version of PulseAudio we require | ||
if(NOT PulseAudio_FIND_VERSION) | ||
set(PulseAudio_FIND_VERSION "1.0.0") | ||
endif() | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(PC_PulseAudio QUIET libpulse>=${PulseAudio_FIND_VERSION}) | ||
pkg_check_modules(PC_PulseAudio_MAINLOOP QUIET libpulse-mainloop-glib) | ||
|
||
find_path(PulseAudio_INCLUDE_DIRS pulse/pulseaudio.h | ||
HINTS | ||
${PC_PulseAudio_INCLUDEDIR} | ||
${PC_PulseAudio_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(PulseAudio_LIBRARIES NAMES pulse libpulse | ||
HINTS | ||
${PC_PulseAudio_LIBDIR} | ||
${PC_PulseAudio_LIBRARY_DIRS} | ||
) | ||
|
||
find_library(PulseAudio_MAINLOOP_LIBRARY | ||
NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib | ||
HINTS | ||
${PC_PulseAudio_LIBDIR} | ||
${PC_PulseAudio_LIBRARY_DIRS} | ||
) | ||
|
||
# Store the version number in the cache, | ||
# so we don't have to search every time again: | ||
if(PulseAudio_INCLUDE_DIRS AND NOT PulseAudio_VERSION) | ||
|
||
# get PulseAudio's version from its version.h | ||
file(STRINGS "${PulseAudio_INCLUDE_DIRS}/pulse/version.h" pulse_version_h | ||
REGEX ".*pa_get_headers_version\\(\\).*") | ||
string(REGEX REPLACE ".*pa_get_headers_version\\(\\)\ \\(\"([0-9]+\\.[0-9]+\\.[0-9]+)[^\"]*\"\\).*" "\\1" | ||
_PulseAudio_VERSION "${pulse_version_h}") | ||
|
||
set(PulseAudio_VERSION "${_PulseAudio_VERSION}" | ||
CACHE STRING "Version number of PulseAudio" | ||
FORCE) | ||
endif() | ||
|
||
# Use the new extended syntax of | ||
# find_package_handle_standard_args(), | ||
# which also handles version checking: | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(PulseAudio | ||
REQUIRED_VARS PulseAudio_LIBRARIES | ||
PulseAudio_INCLUDE_DIRS | ||
VERSION_VAR PulseAudio_VERSION) | ||
|
||
# Deprecated synonyms | ||
set(PulseAudio_INCLUDE_DIR "${PulseAudio_INCLUDE_DIRS}") | ||
set(PulseAudio_LIBRARY "${PulseAudio_LIBRARIES}") | ||
set(PulseAudio_MAINLOOP_LIBRARY "${PulseAudio_MAINLOOP_LIBRARY}") | ||
set(PulseAudio_FOUND "${PulseAudio_FOUND}") | ||
|
||
if(PulseAudio_FOUND AND NOT TARGET PulseAudio::PulseAudio) | ||
add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED) | ||
set_target_properties(PulseAudio::PulseAudio PROPERTIES | ||
IMPORTED_LOCATION "${PulseAudio_LIBRARIES}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${PulseAudio_INCLUDE_DIRS}") | ||
endif() | ||
|
||
mark_as_advanced(PulseAudio_INCLUDE_DIRS PulseAudio_INCLUDE_DIR | ||
PulseAudio_LIBRARIES PulseAudio_LIBRARY | ||
PulseAudio_MAINLOOP_LIBRARY PulseAudio_MAINLOOP_LIBRARY) | ||
|
||
include(FeatureSummary) | ||
set_package_properties(PulseAudio PROPERTIES | ||
URL "https://www.freedesktop.org/wiki/Software/PulseAudio" | ||
DESCRIPTION "Sound server, for sound stream routing and mixing") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#ifndef PA_LINUX_PULSEAUDIO_H | ||
#define PA_LINUX_PULSEAUDIO_H | ||
|
||
/* | ||
* $Id$ | ||
* PortAudio Portable Real-Time Audio Library | ||
* PulseAudio-specific extensions | ||
* | ||
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files | ||
* (the "Software"), to deal in the Software without restriction, | ||
* including without limitation the rights to use, copy, modify, merge, | ||
* publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR | ||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/* | ||
* The text above constitutes the entire PortAudio license; however, | ||
* the PortAudio community also makes the following non-binding requests: | ||
* | ||
* Any person wishing to distribute modifications to the Software is | ||
* requested to send the modifications to the original developer so that | ||
* they can be incorporated into the canonical version. It is also | ||
* requested that these non-binding requests be included along with the | ||
* license above. | ||
*/ | ||
|
||
/** @file | ||
* @ingroup public_header | ||
* @brief PulseAudio-specific PortAudio API extension header file. | ||
*/ | ||
|
||
#include "portaudio.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* Renames the PulseAudio description for the source that is opened | ||
* by PortAudio. | ||
* | ||
* @param s The PortAudio stream to operate on. | ||
* @param streamName The new name/description of the source. | ||
* | ||
* @return paNoError on success or the error encountered otherwise. | ||
*/ | ||
PaError PaPulseAudio_RenameSource( PaStream *s, const char *streamName ); | ||
|
||
/** | ||
* Renames the PulseAudio description for the sink that is opened | ||
* by PortAudio. | ||
* | ||
* @param s The PortAudio stream to operate on. | ||
* @param streamName The new name/description of the sink. | ||
* | ||
* @return paNoError on success or the error encountered otherwise. | ||
*/ | ||
PaError PaPulseAudio_RenameSink( PaStream *s, const char *streamName ); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.