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

NF: Automatic microphone polling #6843

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

mdcutone
Copy link
Member

This PR allows the microphone to poll asynchronously by getting samples using a background thread. When autoPolling=True, the background thread will get samples at a rate specified by pollInterval. This value just needs to be less than the stream buffer size to prevent samples from being missed. Calls to poll() in existing scripts will still work as they always have. However, the user never actually needs to call poll() explicitly when autoPolling is enabled, as the stream buffer is effectively infinite and all data is contains will be automatically written to the recording buffer when the stream is stopped.

This also has the benefit of keeping the audio stream alive if the device drivers tend to timeout and go into an inactive state.

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 6.12245% with 46 lines in your changes missing coverage. Please review.

Project coverage is 49.56%. Comparing base (8984c15) to head (64eb4e7).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6843      +/-   ##
==========================================
- Coverage   49.59%   49.56%   -0.03%     
==========================================
  Files         332      332              
  Lines       61349    61383      +34     
==========================================
+ Hits        30424    30426       +2     
- Misses      30925    30957      +32     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)

@mdcutone
Copy link
Member Author

Updated to allow polling continuously between open()/close() calls. Also various other improvements and documentation changes

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.

1 participant