-
-
Notifications
You must be signed in to change notification settings - Fork 449
Fix sound effect issue after sleep or hibernation #3532
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
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. Forbidden patterns 🙅 (1)In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves. These forbidden patterns matched content: s.b. workaround(s)
If the flagged items are 🤯 false positivesIf items relate to a ...
|
🥷 Code experts: onesounds Jack251970, onesounds have most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
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.
Pull Request Overview
This PR addresses the issue of sound effects failing to play after system sleep or hibernation by reinitializing the sound components upon a system resume event.
- Added a subscription to SystemEvents.PowerModeChanged, triggering reinitialization of the sound effects.
- Enhanced cleanup by disposing or closing sound objects and unsubscribing from the event during disposal.
Comments suppressed due to low confidence (2)
Flow.Launcher/MainWindow.xaml.cs:562
- [nitpick] Consider using Path.Combine(AppContext.BaseDirectory, "Resources", "open.wav") to construct the file path, which enhances readability and reliability.
animationSoundWMP.Open(new Uri(AppContext.BaseDirectory + "Resources\open.wav"));
Flow.Launcher/MainWindow.xaml.cs:567
- [nitpick] Consider using Path.Combine(AppContext.BaseDirectory, "Resources", "open.wav") to construct the file path, which enhances readability and reliability.
animationSoundWPF = new SoundPlayer(AppContext.BaseDirectory + "Resources\open.wav");
📝 WalkthroughWalkthroughThe update adds handling for system power mode changes in the main window logic. When the system resumes from sleep or hibernation, sound effects are reinitialized to address an issue where sounds fail to play after waking. Event subscription and resource management logic were introduced to support this behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant System
participant MainWindow
participant SoundPlayer
System->>MainWindow: PowerModeChanged(Resume)
MainWindow->>MainWindow: SystemEvents_PowerModeChanged()
MainWindow->>MainWindow: InitSoundEffects()
MainWindow->>SoundPlayer: Close or Dispose existing sound resources
MainWindow->>SoundPlayer: Create new sound player instances
Assessment against linked issues
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Graph Analysis (1)Flow.Launcher/MainWindow.xaml.cs (2)
⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (6)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@jjw24 I would like to include this bug fix PR in 1.20.0 milestone. |
When system resumes, we need to recreate Sound instance so that it can play sound normally.
From: https://stackoverflow.com/questions/64805186/mediaplayer-doesnt-play-after-computer-sleeps
Resolve #3278.
Tested.