-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auracast audio io #643
auracast audio io #643
Conversation
@@ -57,6 +69,44 @@ class Entry: | |||
tag: Metadata.Tag | |||
data: bytes | |||
|
|||
def decode(self) -> Any: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used to plan to make each type of Entry a class, so each of them can take corresponding type of value and serializer directly - it's convenient but not very necessary at that moment. Or maybe we can do this in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a simple approach here, using mostly basic builtin types and existing enums rather than dedicated classes (mostly strings, ints and enums). But if a different approach makes senses, we can evaluate that in a later PR.
class SampleType(enum.Enum): | ||
FLOAT32 = 0 | ||
INT16 = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only s16 and f32? What about s16/24 and u16/24/32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the only two types currently used. If/when we need other types (for example support some form of conversion to/from other types), they can be added.
INT16 = 1 | ||
|
||
endianness: Endianness | ||
sample_type: SampleType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't any usage of this attribute inside this PR. When does it get used? Or it's just a reserved field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used implicitly when instances of the classes are printed out (like in a debug log).
But is should also be used after calling create_audio_input
to check that the sample type is supported (the code currently only checks the number of channels). I'll fix that.
This allows the auracast app to use the host's sound devices for input and output, in addition to other input and output types (file, stdio, external process).
The dependency on lc3 has changed, because PyPI does not allow
git
external dependencies.Also included are small changes to some of the LE Audio GATT services, to use object types instead of raw bytes or tuples where appropriate (there are still maybe a few characteristics left to 'objectify', which can be done in subsequent PRs).
A later PR will include improvements to the typing support for GATT adapters.