summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Milea <[email protected]>2021-12-06 18:49:58 +0200
committerValentin Milea <[email protected]>2021-12-06 18:49:58 +0200
commitef879e8a8a43dfa34160f50d7f432c3140dec7fa (patch)
treef266bcf610e71d9fdd2c97f30d3fc3e258ecb963 /src
parent3e9bb3bee1e835a0d99c3f503c63cf0481b45ce2 (diff)
Support disabling feedback format correction #1234
Diffstat (limited to 'src')
-rw-r--r--src/class/audio/audio_device.c3
-rw-r--r--src/class/audio/audio_device.h10
2 files changed, 12 insertions, 1 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index d9f2e284e..a461e97c5 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -2248,12 +2248,13 @@ static void audiod_parse_for_AS_params(audiod_function_t* audio, uint8_t const *
#if CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
// Input value feedback has to be in 16.16 format - the format will be converted according to speed settings automatically
+// unless format correction is disabled.
bool tud_audio_n_fb_set(uint8_t func_id, uint32_t feedback)
{
TU_VERIFY(func_id < CFG_TUD_AUDIO && _audiod_fct[func_id].p_desc != NULL);
// Format the feedback value
-#if !TUD_OPT_HIGH_SPEED
+#if !TUD_OPT_HIGH_SPEED && !CFG_TUD_AUDIO_DISABLE_FEEDBACK_FORMAT_CORRECTION
uint8_t * fb = (uint8_t *) &_audiod_fct[func_id].fb_val;
// For FS format is 10.14
diff --git a/src/class/audio/audio_device.h b/src/class/audio/audio_device.h
index 5a469523c..731fd6c01 100644
--- a/src/class/audio/audio_device.h
+++ b/src/class/audio/audio_device.h
@@ -186,6 +186,11 @@
#define CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP 0 // Feedback - 0 or 1
#endif
+// Disable/enable conversion from 16.16 to 10.14 format on high-speed devices. See tud_audio_n_fb_set().
+#ifndef CFG_TUD_AUDIO_DISABLE_FEEDBACK_FORMAT_CORRECTION
+#define CFG_TUD_AUDIO_DISABLE_FEEDBACK_FORMAT_CORRECTION 0 // 0 or 1
+#endif
+
// Audio interrupt control EP size - disabled if 0
#ifndef CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN
#define CFG_TUD_AUDIO_INT_CTR_EPSIZE_IN 0 // Audio interrupt control - if required - 6 Bytes according to UAC 2 specification (p. 74)
@@ -458,6 +463,11 @@ TU_ATTR_WEAK bool tud_audio_fb_done_cb(uint8_t rhport);
// Value will be corrected for FS to 10.14 format automatically.
// (see Universal Serial Bus Specification Revision 2.0 5.12.4.2).
// Feedback value will be sent at FB endpoint interval till it's changed.
+//
+// Note that the USB Audio 2.0 driver on Windows 10 is not following the spec and expects 16.16
+// format for FS. You can define CFG_TUD_AUDIO_DISABLE_FEEDBACK_FORMAT_CORRECTION=1 as a workaround
+// to transmit the feedback value unchanged. Be aware that this might break feedback on other hosts,
+// though at least on Linux the ALSA driver will happily accept either format.
bool tud_audio_n_fb_set(uint8_t func_id, uint32_t feedback);
static inline bool tud_audio_fb_set(uint32_t feedback);
#endif