Skip to content

fix: use dummy backend when no output device is availible#622

Merged
sjfhsjfh merged 2 commits into
TeamFlos:mainfrom
liquidhelium:main
Jan 18, 2026
Merged

fix: use dummy backend when no output device is availible#622
sjfhsjfh merged 2 commits into
TeamFlos:mainfrom
liquidhelium:main

Conversation

@liquidhelium

@liquidhelium liquidhelium commented Dec 3, 2025

Copy link
Copy Markdown
Member

fixes #605 .
Testing steps: disable all your audio devices in your system settings, then run phira.
Things to be discussed: Should the translation string be put into a seprate file, rather than scene.ftl?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a fallback mechanism to gracefully handle scenarios where no audio output device is available. When audio backend initialization fails, the application now displays an error message and falls back to a dummy backend that silently ignores all audio operations, allowing the application to continue running without sound.

Key changes:

  • Added error handling in build_audio() to catch backend initialization failures and use a dummy backend as fallback
  • Implemented a minimal DummyBackend that satisfies the Backend trait interface without performing any actual audio operations
  • Added localized error messages in English and Chinese to inform users when running in silent mode

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
prpr/src/ui.rs Added error handling for audio backend initialization, implemented DummyBackend struct, and added l10n macro import for translation strings
prpr/locales/en-US/scene.ftl Added English error message for audio backend initialization failure
prpr/locales/zh-CN/scene.ftl Added Chinese error message for audio backend initialization failure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread prpr/src/ui.rs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sjfhsjfh
sjfhsjfh merged commit b4032f3 into TeamFlos:main Jan 18, 2026
1 check passed
@YuevUwU YuevUwU mentioned this pull request Feb 16, 2026
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.

关于Windows端Phira v0.6.7在系统无可用音频输出设备时闪退问题的建议

2 participants