Skip to content
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

Merged
merged 13 commits into from
Feb 8, 2025
Merged

auracast audio io #643

merged 13 commits into from
Feb 8, 2025

Conversation

barbibulle
Copy link
Collaborator

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.

@barbibulle barbibulle requested a review from zxzxwu February 6, 2025 21:42
@@ -57,6 +69,44 @@ class Entry:
tag: Metadata.Tag
data: bytes

def decode(self) -> Any:
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Comment on lines +56 to +58
class SampleType(enum.Enum):
FLOAT32 = 0
INT16 = 1
Copy link
Collaborator

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?

Copy link
Collaborator Author

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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@barbibulle barbibulle merged commit 3f6f036 into main Feb 8, 2025
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants