-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix/ducking #78
fix/ducking #78
Conversation
ensure volume is restored when ovos-core signals an utterance has been fully handled in some cases volume could stay lowered and never be restored, this can be reproduced with "stop" commands under some circumstances closes #77
WalkthroughThe recent changes to Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AudioService
participant EventHandler
participant AudioPlayer
User->>AudioService: Start OCP Skill
AudioService->>EventHandler: Subscribe to events
User->>AudioService: Play radio station
AudioService->>AudioPlayer: Initialize with volume 65
User->>AudioService: Stop OCP Skill
AudioService->>AudioPlayer: Duck volume to 30
AudioService->>EventHandler: Unsubscribe from events
User->>AudioService: Restart radio station
AudioService->>AudioPlayer: Restore volume to 65
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- ovos_audio/audio.py (6 hunks)
Additional comments not posted (7)
ovos_audio/audio.py (7)
81-81
: Added attribute for speaking volume state.The new attribute
volume_is_speaking
is introduced to track when the system is speaking. This is a good practice as it helps in managing the state of the system more effectively.
177-179
: New event handlers for audio service and ducking events.The addition of new event handlers for track position and audio ducking events enhances the control over audio playback and interaction during voice recognition and speech output. This aligns well with the PR's objective to handle audio ducking issues effectively.
Also applies to: 183-188
306-313
: Refactored methods for volume control during speaking.The methods
_lower_volume_on_speak
and_restore_volume_on_speak
have been introduced, replacing the previous generic volume control methods. This more specific naming and functionality ensure clarity in the codebase and better manage the audio state during speech events.Also applies to: 320-322
329-338
: New method to handle volume restoration after utterance handling.The method
_restore_volume_on_handled
is a significant addition. It ensures that the volume is restored correctly after an utterance is fully handled, addressing the issue described in the linked GitHub issue. This method checks if speech is not happening and restores the volume, which is crucial for maintaining user experience consistency.
341-351
: Refactored method for volume control during recording.The method
_lower_volume_on_record
has been refactored to handle volume reduction when recording starts. This is essential for preventing feedback and ensuring clear audio capture, which is particularly important in a voice-controlled environment.
Line range hint
399-423
: Updated logic for selecting the audio player service based on URI type.The updated logic in the
play
method for selecting the appropriate audio service based on the URI type and user preferences helps in maintaining a robust and flexible audio playback system. This change is crucial for ensuring that the correct backend is used for different media types, which can significantly affect playback quality and resource usage.
581-590
: Updated shutdown method to remove event handlers.The shutdown method has been updated to ensure that all event handlers related to audio service and volume control are properly removed. This is a good practice for cleaning up resources and preventing potential memory leaks or erroneous behavior after the service is stopped.
ensure volume is restored when ovos-core signals an utterance has been fully handled
in some cases volume could stay lowered and never be restored, this can be reproduced with "stop" commands under some circumstances
closes #77
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Maintenance