Disable feedback format correction by default #1234
This commit is contained in:
		| @@ -2247,14 +2247,12 @@ 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 && !CFG_TUD_AUDIO_DISABLE_FEEDBACK_FORMAT_CORRECTION | ||||
| #if CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION && !TUD_OPT_HIGH_SPEED | ||||
|   uint8_t * fb = (uint8_t *) &_audiod_fct[func_id].fb_val; | ||||
|  | ||||
|   // For FS format is 10.14 | ||||
| @@ -2264,7 +2262,7 @@ bool tud_audio_n_fb_set(uint8_t func_id, uint32_t feedback) | ||||
|   // 4th byte is needed to work correctly with MS Windows | ||||
|   *fb = 0; | ||||
| #else | ||||
|   // For HS format is 16.16 as originally demanded | ||||
|   // Send value as-is, caller will choose the appropriate format | ||||
|   _audiod_fct[func_id].fb_val = feedback; | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -186,9 +186,9 @@ | ||||
| #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 | ||||
| // Enable/disable conversion from 16.16 to 10.14 format on full-speed devices. See tud_audio_n_fb_set(). | ||||
| #ifndef CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION | ||||
| #define CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION     0                             // 0 or 1 | ||||
| #endif | ||||
|  | ||||
| // Audio interrupt control EP size - disabled if 0 | ||||
| @@ -459,15 +459,15 @@ TU_ATTR_WEAK bool tud_audio_rx_done_post_read_cb(uint8_t rhport, uint16_t n_byte | ||||
|  | ||||
| #if CFG_TUD_AUDIO_ENABLE_EP_OUT && CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP | ||||
| TU_ATTR_WEAK bool tud_audio_fb_done_cb(uint8_t rhport); | ||||
| // User code should call this function with feedback value in 16.16 format for FS and HS. | ||||
| // 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. | ||||
|  | ||||
| // This function is used to provide data rate feedback from an asynchronous sink. 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. | ||||
| // The feedback format is specified to be 16.16 for HS and 10.14 for FS devices (see Universal Serial Bus Specification Revision 2.0 5.12.4.2). By default, | ||||
| // the choice of format is left to the caller and feedback argument is sent as-is. If CFG_TUD_AUDIO_ENABLE_FEEDBACK_FORMAT_CORRECTION is set, then tinyusb | ||||
| // expects 16.16 format and handles the conversion to 10.14 on FS. | ||||
| // | ||||
| // Note that due to a bug in its USB Audio 2.0 driver, Windows currently requires 16.16 format for _all_ USB 2.0 devices. On Linux and macOS it seems the  | ||||
| // driver can work with either format. So a good compromise is to keep format correction disabled and stick to 16.16 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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Valentin Milea
					Valentin Milea