audio: simplify alt settings management #3266
Merged
+38
−143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously alt settings are saved in an array sized by
CFG_TUD_AUDIO_FUNC_n_N_AS_INT
, since we limit each audio instance to one IN EP and one OUT EP, we can save directly the current alt setting value in the instance, which avoid a lookup operation.CFG_TUD_AUDIO_FUNC_1_N_AS_INT
audiod_get_AS_interface_index
in each transfer, on STM32F7 this call cost 600 cycles = 3us !audiod_get_AS_interface_index_global
is replaced byaudiod_verify_itf_exists
PS:
In current state it looks like adding UAC1 compatibility is not too complicated, most code should be already compatible.
I've tested on Windows, you can test more if I didn't break anything @PanRe @kf6gpe @gmikitiuk @mastupristi