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

Add device types introduced in API level 31 or Android Tiramisu #44

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

torokati44
Copy link
Contributor

Source: https://developer.android.com/reference/android/media/AudioDeviceInfo#constants_1

Although I haven't tested it, this might fix #43.

@torokati44
Copy link
Contributor Author

torokati44 commented Apr 24, 2022

Although given that this enum is even marked #[non_exhaustive], that unwrap in devices_info.rs should perhaps be replaced with an unwrap_or_default, defaulting to Unknown?
Or maybe, since Unknown seems like a legitimate return value of getType, this might be lying, so instead a dummy variant could be added, something like Unsupported, or Unrecognized...?

@katyo
Copy link
Owner

katyo commented Apr 26, 2022

@torokati44 Added something like Unsupported sounds good for first look (maybe with integer field inside).
Could you update that PR?

@torokati44
Copy link
Contributor Author

Yep, done!

@torokati44
Copy link
Contributor Author

Actually.... I wasn't able to test it right away, only now, and:
error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants
rust-lang/rust#60553

@torokati44
Copy link
Contributor Author

For the moment I just removed the i32 from inside the Unsupported variant, and set it to -1 instead.

@katyo katyo merged commit c6d1d57 into katyo:master Apr 29, 2022
@torokati44
Copy link
Contributor Author

Thank you for merging!
Do you perhaps have an estimate on when a new release can be pushed to crates.io?
#43 is kind of a blocker for me... :/

@katyo
Copy link
Owner

katyo commented Apr 30, 2022

@torokati44 I published 0.4.6 just now.

@torokati44
Copy link
Contributor Author

Awesome, thanks a lot!

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.

Panic on Android when enumerating devices using CPAL
2 participants