-
Notifications
You must be signed in to change notification settings - Fork 104
Refactor Microphone to use callback mode #267
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
Refactor Microphone to use callback mode #267
Conversation
Hi @lugia19 Thanks for this PR. This looks pretty interesting! Will check this out and get back to provide some feedback! |
Also, just a heads up @lugia19 I haven't taken a look, but just a reminder that interfaces cannot change until a major release meaning how a user implements their code should not break (need to preserve backward compatibility). If we need to break the interfaces, we can do something special for the I see you are still making changes, ping me when ready to review. |
@dvonthenen Oh it's ready, that was the last change I had to do since I realized I implemented the asyncio callback stuff in a non-thread safe way. As far as the interface, I'm aware - I made sure the interface would remain the same (bar the new optional argument for the init to set the input device, but I made it so by default not including it maintains the same behavior as before). There shouldn't be any differences. |
Cool. Will take a look when I get a free moment. |
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.
Very cool! Thanks for this contribution! Left some feedback for you. If you can also squash commits after updating, that would be awesome!
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.
Few other things I just noticed and we are good to merge.
Improve handling of coroutine push_callback with asyncio Add parameter input_device_index instead of always defaulting to the default input device Make self.exit an event instead of a bool+lock
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.
Sweeeeet! Yay!
Thanks for your help with this @lugia19 ! |
Proposed changes
Refactored the Microphone class:
Types of changes
What types of changes does your code introduce to the Deepgram Python SDK?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
N/A