Skip to content

Commit

Permalink
Merge branch 'master' into lhdc
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Nov 13, 2024
2 parents 43623e9 + 59c953a commit 41b714a
Show file tree
Hide file tree
Showing 76 changed files with 1,119 additions and 658 deletions.
2 changes: 2 additions & 0 deletions .github/spellcheck-wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ unregister
utils

# Others
a2dpconf
AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ
aas
ABCD
Expand Down Expand Up @@ -175,6 +176,7 @@ dlopen
dmix
dmx
docutils
dpconf
dpsnk
dpsrc
DYN
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ unreleased
- renamed bluealsa-cli to bluealsactl (no backward compatibility)
- channel map and volume control for surround sound (5.1, 7.1) audio
- native A2DP volume control by default (dropped --a2dp-volume option)
- fix configuration for Android 13 A2DP Opus codec

bluez-alsa v4.3.1 (2024-08-30)
==============================
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,14 @@ AM_COND_IF([ENABLE_MANPAGES], [

AC_ARG_ENABLE([test],
[AS_HELP_STRING([--enable-test], [enable unit test])])
AM_CONDITIONAL([HAVE_SNDFILE], [false])
AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"])
AM_COND_IF([ENABLE_TEST], [
AC_SEARCH_LIBS([dlsym], [dl],
[], [AC_MSG_ERROR([unable to find dlsym() function])])
PKG_CHECK_MODULES([CHECK], [check >= 0.11.0])
PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0],
AM_CONDITIONAL([HAVE_SNDFILE], [true])
AC_DEFINE([HAVE_SNDFILE], [1], [Define to 1 if you have the sndfile library.]), [:])
])

Expand Down
4 changes: 4 additions & 0 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if ENABLE_RFCOMM
man1_MANS += bluealsa-rfcomm.1
endif

if ENABLE_A2DPCONF
man1_MANS += a2dpconf.1
endif

if ENABLE_HCITOP
man1_MANS += hcitop.1
endif
Expand Down
96 changes: 96 additions & 0 deletions doc/a2dpconf.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
========
a2dpconf
========

----------------------------------------
Decode A2DP codec capability hex strings
----------------------------------------

:Date: September 2024
:Manual section: 1
:Manual group: General Commands Manual
:Version: $VERSION$

SYNOPSIS
========

**a2dpconf** [*OPTION*]... [*CODEC*:]\ *CONFIG*...

DESCRIPTION
===========

**a2dpconf** presents the fields of the given A2DP codec *CONFIG* in a
human-readable format. *CODEC* is the name of the relevant codec, and *CONFIG*
is the hexadecimal encoding of the configuration or capabilities binary "blob"
as reported by tools such as ``bluealsactl(1)`` or the debug output of
``bluealsad(8)``.
(see `EXAMPLES`_ below).

OPTIONS
=======

-h, --help
Print this help and exit.

-V, --version
Print version and exit.

-x, --auto-detect
Try to auto-detect the codec. If the name of the codec associated with the
configuration string is not known, then give this option and the
configuration string without the codec name prefix. The output is then a
list of all possible known codec configurations for which the given string
is valid.

EXAMPLES
========
::

$ a2dpconf sbc:ffff0235
SBC <hex:ffff0235> {
sample-rate:4 = 48000 44100 32000 16000
channel-mode:4 = JointStereo Stereo DualChannel Mono
block-length:4 = 16 12 8 4
sub-bands:2 = 8 4
allocation-method:2 = Loudness SNR
min-bit-pool-value:8 = 2
max-bit-pool-value:8 = 53
}

::

$ a2dpconf -x ffff0235
SBC <hex:ffff0235> {
sample-rate:4 = 48000 44100 32000 16000
channel-mode:4 = JointStereo Stereo DualChannel Mono
block-length:4 = 16 12 8 4
sub-bands:2 = 8 4
allocation-method:2 = Loudness SNR
min-bit-pool-value:8 = 2
max-bit-pool-value:8 = 53
}
MPEG-1,2 Audio <hex:ffff0235> {
layer:3 = MP3 MP2 MP1
crc:1 = true
channel-mode:4 = JointStereo Stereo DualChannel Mono
<reserved>:1
media-payload-format:1 = MPF-1 MPF-2
sample-rate:6 = 48000 44100 32000 24000 22050 16000
vbr:1 = false
bitrate-index:15 = 0x235
}

COPYRIGHT
=========

Copyright (c) 2016-2024 Arkadiusz Bokowy.

The bluez-alsa project is licensed under the terms of the MIT license.

SEE ALSO
========

``bluealsactl(1)``, ``bluealsad(8)``

Project web site
https://github.com/arkq/bluez-alsa
6 changes: 3 additions & 3 deletions doc/bluealsa-plugins.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ CTL Parameters

EXT
Causes the plugin to include extra controls. These are the controls for
Bluetooth codec selection, volume mode selection, delay adjustment (sync)
Bluetooth codec selection, volume mode selection, client delay (sync)
and/or battery level indicator.
If the value is **yes** then all of these additional controls are included;
if the value is **no** then none of them are included. The default is
Expand All @@ -452,13 +452,13 @@ CTL Parameters
See the `Volume control` section in the ``bluealsad(8)`` for more
information on the software volume setting.

The delay adjustment controls are called "Sync". They can be used to apply
The client delay controls are called "Sync". They can be used to apply
a fixed adjustment to the delay reported by the associated PCM to the
application, and may be useful with applications that need to synchronize
the bluetooth audio stream with some some other stream, such as a video.
The values are in milliseconds from ``-3275 ms`` to ``+3275 ms`` in steps
of ``25 ms``. The playback control has index 0 and the capture control has
index 1. Each codec supported by a PCM has its own delay adjustment value.
index 1. Each codec supported by a PCM has its own client delay value.
Note that this control changes only the delay value reported to the
application by ALSA, it does not affect the actual delay (latency) of the
PCM stream. Values set by this control type are saved in the BlueALSA
Expand Down
96 changes: 71 additions & 25 deletions doc/bluealsactl.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bluealsactl
a simple command line interface for the BlueALSA D-Bus API
----------------------------------------------------------

:Date: August 2024
:Date: September 2024
:Manual section: 1
:Manual group: General Commands Manual
:Version: $VERSION$
Expand Down Expand Up @@ -82,24 +82,45 @@ list-pcms
info *PCM_PATH*
Print the properties and available codecs of the given PCM.
The properties are printed one per line, in the format
'PropertyName: Value'. Values are presented in human-readable format - for
example the Volume property is printed as:
"PropertyName: Value". Values are presented in human-readable format, and
for a property with multiple values they are printed as a space-separated
list.

The Volume property is presented as two lines; "Volume:" indicating
the loudness component of each channel and "Mute:" indicating the mute
component of each channel. Both components are presented with their channel
values in the same order as the ChannelMap. For example:
::

ChannelMap: FC FL FR RL RR LFE
Volume: 127 127 127 127 127 127
Mute: off off off off off off

If the **--verbose** option is given then "Available codecs:" values include
the codec capabilities as a hexadecimal string suffix, separated by a colon.
Similarly, the "Selected codec:" value includes the current codec
configuration as a hexadecimal string separated by a colon. For example:
::

``Volume: 127 127``
Available codecs: SBC:ffff02fa AAC:c0ffff035b60
Selected codec: AAC:400084035b60

A tool such as ``a2dpconf(1)`` can be used to decode the hex string.

The list of available A2DP codecs requires BlueZ SEP support
(BlueZ >= 5.52)

codec [-c NUM] [-r NUM] [--force] *PCM_PATH* [*CODEC*\ [:*CONFIG*]]
Get or set the Bluetooth codec used by the given PCM.

If *CODEC* is not given, print a list of additional codecs supported by the
given PCM and the currently selected codec. With the option **--verbose**
the codec capabilities and current configuration are shown in the same
format as for the **info** command.

If *CODEC* is given, change the codec to be used by the given PCM. This
command will terminate the PCM if it is currently running.

If *CODEC* is not given, print a list of additional codecs supported by the
given PCM and the currently selected codec. The level of detail in the
output depends on the verbosity level.

Optionally, for A2DP codecs, one can specify A2DP codec configuration which
should be selected. The *CONFIG* shall be given as a hexadecimal string. If
this parameter is omitted, BlueALSA will select default configuration based
Expand All @@ -112,6 +133,16 @@ codec [-c NUM] [-r NUM] [--force] *PCM_PATH* [*CODEC*\ [:*CONFIG*]]
the configuration. However, this may result in a non-working connection and
in the worst case it may crash remote Bluetooth device!

The options **-c NUM** and **-r NUM** may be used to select a specific
channel count and/or sample rate, provided that the given values are
supported by the codec. For example, if the device at path PCM_PATH
supports 5.1 surround sound and 96000 rate with the AAC codec, but is
currently configured as AAC with stereo at 48000, then the configuration
can be changed with:
::

bluealsactl codec -c6 -r96000 PCM_PATH aac

Selecting an A2DP codec and listing available A2DP codecs requires BlueZ
SEP support (BlueZ >= 5.52).

Expand All @@ -123,23 +154,31 @@ codec [-c NUM] [-r NUM] [--force] *PCM_PATH* [*CODEC*\ [:*CONFIG*]]
Selecting the HFP codec when using oFono is not supported.

volume *PCM_PATH* [*VOLUME* [*VOLUME*]...]
Get or set the volume value of the given PCM.
Get or set the volume loudness value(s) of the given PCM.

If *VOLUME* is given, set the loudness component of the volume property of
the given PCM.

If only one value *VOLUME* is given it is applied to all channels.
For stereo (2-channel) PCMs the first value *VOLUME* is applied to channel
1 (Left), and the second value *VOLUME* is applied to channel 2 (Right).

For multi-channel PCMs, if multiple *VOLUME* values are given, then each
given value is applied to the corresponding channel of the ChannelMap (see
the **info** command). If the number of values given is less than the
number of channels, then the remaining channels are set to the first given
value.

Valid A2DP values for *VOLUME* are 0-127, valid HFP/HSP values are 0-15.

Note that A2DP does not support independent channel volumes, so such a
setting is better suited to use with soft-volume enabled. See
``bluealsad(8)`` for more details.

mute *PCM_PATH* [*STATE* [*STATE*]...]
Get or set the mute switch of the given PCM.

If *STATE* argument(s) are given, set mute component of the volume property
of the given PCM. The second *STATE* argument is used for stereo PCMs as
described for the **volume** command.
of the given PCM. Multiple *STATE* arguments are used for multi-channel
PCMs as described for the **volume** command.

The *STATE* value can be one of **on**, **yes**, **true**, **y** or **1**
for mute on, or **off**, **no**, **false**, **n** or **0** for mute off.
Expand All @@ -156,16 +195,15 @@ soft-volume *PCM_PATH* [*STATE*]
for soft-volume on, or **off**, **no**, **false**, **n** or **0** for
soft-volume off.

delay-adjustment *PCM_PATH* [*ADJUSTMENT*]
Get or set the DelayAdjustment property of the given PCM for the current
codec.
client-delay *PCM_PATH* [[-]\ *DELAY*]
Get or set the ClientDelay property of the given PCM.

If the *ADJUSTMENT* argument is given, set the DelayAdjustment property for
the current codec in the given PCM. This property may be used by clients to
If the *DELAY* argument is given, set the ClientDelay property for the
given PCM. This property may be used by clients to
adjust the reported audio delay and may be useful with PCM devices that do
not report an accurate Delay property.

The *ADJUSTMENT* value is in milliseconds and must be a decimal number with
The *DELAY* value is in milliseconds and must be a decimal number with
optional sign prefix (e.g. **250**, **-500**, **+360.4**). The permitted
range is [-3276.8, 3276.7].

Expand Down Expand Up @@ -207,12 +245,19 @@ monitor [-p[PROPS] | --properties[=PROPS]]

``PropertyChanged PCM_PATH PROPERTY_NAME VALUE``

Property names than can be monitored are **Codec**, **Running**,
**SoftVolume** and **Volume**.
Property names that can be monitored are **Codec**, **Delay**,
**ClientDelay**, **Running**, **SoftVolume** and **Volume**.

Volume is an array of values, each showing the loudness and mute components
of a channel. The order of the values corresponds to the ChannelMap
property (see the **info** command). The loudness is shown as a decimal
integer value, with an optional suffix ``[M]`` indicating that the channel
is muted. For example, for a 2-channel (stereo) A2DP PCM at path PCM_PATH
with both channels at full volume and the right channel muted, the event
would be displayed as:
::

The value for Volume is a hexadecimal 16-bit encoding where data for
channel 1 is stored in the upper byte, channel 2 is stored in the lower
byte. The highest bit of both bytes determines whether channel is muted.
PropertyChanged PCM_PATH Volume 127 127[M]

*PROPS* is an optional comma-separated list of property names to be
monitored. If given, only changes to those properties listed will be
Expand All @@ -239,7 +284,8 @@ The bluez-alsa project is licensed under the terms of the MIT license.
SEE ALSO
========

``bluealsad(8)``, ``bluealsa-aplay(1)``, ``bluealsa-rfcomm(1)``
``a2dpconf(1)``, ``bluealsa-aplay(1)``, ``bluealsa-rfcomm(1)``,
``bluealsad(8)``

Project web site
https://github.com/arkq/bluez-alsa
28 changes: 8 additions & 20 deletions doc/org.bluealsa.PCM1.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@ void SelectCodec(string codec, dict props)
dbus.Error.NotSupported
dbus.Error.Failed

void SetDelayAdjustment(string codec, int16 adjustment)
Set an arbitrary adjustment (+/-) to the reported Delay in 1/10 of
millisecond for a specific codec. This adjustment is applied to the Delay
property when that codec is selected, and can be used to compensate for
devices that do not report accurate Delay values.

Possible Errors:
::

dbus.Error.InvalidArguments

array{string, int16} GetDelayAdjustments()
Return the array of currently set delay adjustments. Each entry of the
array gives the name of a codec and the adjustment that the PCM will apply
to the Delay property when that codec is selected.

Properties
----------

Expand Down Expand Up @@ -165,10 +149,14 @@ array{byte} CodecConfiguration [readonly]
uint16 Delay [readonly]
Approximate PCM delay in 1/10 of millisecond.

int16 DelayAdjustment [readonly]
An adjustment (+/-) included within the reported Delay in 1/10 of
millisecond to compensate for devices that do not report accurate delay
values.
int16 ClientDelay [readwrite]
Positive (or negative) client side delay in 1/10 of millisecond.

This property shall be set by the client in order to account for the client
side delay. In case of PCM source it shall be set to a value reported by a
playback subsystem to account for playback delay. In case of PCM sink it
can be used to adjust the Delay property to compensate for devices that do
not report accurate delay values.

boolean SoftVolume [readwrite]
This property determines whether BlueALSA will make volume control
Expand Down
2 changes: 1 addition & 1 deletion misc/bash-completion/bluealsad
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ _bluealsactl() {

# the command names supported by this version of bluealsactl
local simple_commands="list-pcms list-services monitor status"
local path_commands="codec delay-adjustment info mute open soft-volume volume"
local path_commands="codec client-delay info mute open soft-volume volume"

# options that may appear before or after the command
local global_shortopts="-h"
Expand Down
Loading

0 comments on commit 41b714a

Please sign in to comment.