0% found this document useful (0 votes)
9 views2 pages

0001 Added Simple SBC XQ From Soundexpert Org Blog

Uploaded by

haymwland1710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

0001 Added Simple SBC XQ From Soundexpert Org Blog

Uploaded by

haymwland1710
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

From 6b431da7712dd77aaeb10766107467714e4eedc2 Mon Sep 17 00:00:00 2001

From: Christoph Scheurer <Christoph Scheurer christoph.scheurer@web.de>


Date: Sun, 1 Dec 2019 15:58:31 +0100
Subject: [PATCH] added simple SBC-XQ from soundexpert.org blog

---
src/bluealsa.h | 3 +++
src/bluez.c | 17 +++++++++++++++--
src/main.c | 6 ++++++
3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/bluealsa.h b/src/bluealsa.h


index a2a9848..da68212 100644
--- a/src/bluealsa.h
+++ b/src/bluealsa.h
@@ -92,6 +92,9 @@ struct ba_config {
* for sink endpoint and semi-mandatory for source. It is then possible
* to force lower sampling in order to save Bluetooth bandwidth. */
bool force_44100;
+ /* http://soundexpert.org/articles/-/blogs/audio-quality-of-sbc-xq-
bluetooth-audio-codec
+ * force 44100 Hz, dual channel, bitpool 38, bands 8, blk_len 16,
allocation method Loudness */
+ bool force_sbcxq;

/* The number of seconds for keeping A2DP transport alive after PCM has
* been closed. One might set this value to negative number for
infinite
diff --git a/src/bluez.c b/src/bluez.c
index 6d17a6e..d3d5b6c 100644
--- a/src/bluez.c
+++ b/src/bluez.c
@@ -207,8 +207,20 @@ static void
bluez_endpoint_select_configuration(GDBusMethodInvocation *inv, void
a2dp_sbc_t *cap = capabilities;
unsigned int cap_chm = cap->channel_mode;
unsigned int cap_freq = cap->frequency;
-
- if ((cap->channel_mode = bluez_a2dp_codec_select_channel_mode(codec,
cap_chm)) == 0) {
+ size_t i;
+
+
+ if (config.a2dp.force_sbcxq) {
+ for (i = 0; i < codec->channels_size; i++)
+ if (codec->channels[i].mode == BLUEZ_A2DP_CHM_DUAL_CHANNEL &&
+ cap_chm & codec->channels[i].value)
+ cap->channel_mode = codec->channels[i].value;
+ if (cap->channel_mode == 0) {
+ error("SBC dual channel mode not supported: %#x", cap_chm);
+ goto fail;
+ }
+ }
+ else if ((cap->channel_mode = bluez_a2dp_codec_select_channel_mode(codec,
cap_chm)) == 0) {
error("No supported channel modes: %#x", cap_chm);
goto fail;
}
@@ -250,6 +262,7 @@ static void
bluez_endpoint_select_configuration(GDBusMethodInvocation *inv, void
}

int bitpool = a2dp_sbc_default_bitpool(cap->frequency, cap-


>channel_mode);
+ if (config.a2dp.force_sbcxq) bitpool = 38; /* i.e. 452.0 kbit/s */
cap->min_bitpool = MAX(SBC_MIN_BITPOOL, cap->min_bitpool);
cap->max_bitpool = MIN(bitpool, cap->max_bitpool);

diff --git a/src/main.c b/src/main.c


index b10ffb4..db95fd2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -104,6 +104,7 @@ int main(int argc, char **argv) {
{ "a2dp-force-audio-cd", no_argument, NULL, 7 },
{ "a2dp-keep-alive", required_argument, NULL, 8 },
{ "a2dp-volume", no_argument, NULL, 9 },
+ { "a2dp-force-sbcxq", no_argument, NULL, 14 },
#if ENABLE_AAC
{ "aac-afterburner", no_argument, NULL, 4 },
{ "aac-vbr-mode", required_argument, NULL, 5 },
@@ -161,6 +162,7 @@ int main(int argc, char **argv) {
" -p, --profile=NAME\tenable BT profile\n"
" --a2dp-force-mono\tforce monophonic sound\n"
" --a2dp-force-audio-cd\tforce 44.1 kHz sampling\n"
+ " --a2dp-force-sbcxq\tforce SBC 44.1 kHz, dual
channel, high bit pool \n"
" --a2dp-keep-alive=SEC\tkeep A2DP transport alive\
n"
" --a2dp-volume\t\tcontrol volume natively\n"
#if ENABLE_AAC
@@ -248,6 +250,10 @@ int main(int argc, char **argv) {
case 7 /* --a2dp-force-audio-cd */ :
config.a2dp.force_44100 = true;
break;
+ case 14 /* --a2dp-force-sbcxq */ :
+ config.a2dp.force_44100 = true;
+ config.a2dp.force_sbcxq = true;
+ break;
case 8 /* --a2dp-keep-alive=SEC */ :
config.a2dp.keep_alive = atoi(optarg);
break;
--
2.1.4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy