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

Allow disabling StelAudioMgr at runtime #3775

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

gzotti
Copy link
Member

@gzotti gzotti commented Jun 21, 2024

Description

We had a complaint (#3725) that Stellarium takes some extra (unspecified) time to initialize on a system without sound hardware (or disabled). While sound hardware has been generally available on consumer systems of the past 25 years, there may be circumstances, e.g. on Virtual Machines. This branch brings in yet another configuration option to avoid initialisation. The simple alternative is to build Stellarium from source without media support.

Fixes # 3725

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Running scripts/test/audiotest.ssc. When audio system is disabled, observe text output.

I have not yet tested videos with sound output! And I cannot test a physical system without sound hardware.

Test Configuration:

  • Operating system: Win10pro
  • Graphics Card: irrelevant

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

- command line option
- config.ini option
SUG documented
@gzotti gzotti added enhancement Improve existing functionality importance: medium A bit annoying, minor miscalculation, but no crash labels Jun 21, 2024
@gzotti gzotti added this to the 24.3 milestone Jun 21, 2024
@gzotti gzotti self-assigned this Jun 21, 2024
@gzotti gzotti added this to Needs triage in Media via automation Jun 21, 2024
@github-actions github-actions bot requested review from 10110111 and alex-w June 21, 2024 13:29
Copy link

github-actions bot commented Jun 21, 2024

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

Files matching guide/**:

  • Did you remember to update screenshots to match new updates?
  • Did you remember to grammar check in changed part of documentation?

This is an automatically generated QA checklist based on modified files.

Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, what about video support? I guess one config option to suppress both - audio and video support will be better…

Media automation moved this from Needs triage to In progress Jun 21, 2024
@gzotti
Copy link
Member Author

gzotti commented Jun 21, 2024

I wonder what piece of hardware or Linux subsystem one has to remove/disable to accidentally not being able to show a (silent) video. No graphics card? No screen? And you are running the rest of Stellarium successfully?

As commented, I have not yet looked into the case of disabling sound output for videos with sound. Can do that only on the other PC.

@alex-w
Copy link
Member

alex-w commented Jun 21, 2024

Well… log in #3725 has info about missing gstreamer’s plugin by the fact and gstreamer is not our direct dependency. OK, you’re suppressed audio playback and missing gstreamer’s parts for audio, but Qt using gstreamer for audio channels in video also…

@alex-w
Copy link
Member

alex-w commented Jun 21, 2024

I hope all videos will be silent…

@gzotti
Copy link
Member Author

gzotti commented Jun 21, 2024

Please do not merge yet!

As commented, I have not yet looked into the case of disabling sound output for videos with sound. Can do that only on the other PC.

@gzotti
Copy link
Member Author

gzotti commented Jun 21, 2024

gstreamer is some Qt dependency. I assume it gets called on creating a new QAudioOutput().

@gzotti
Copy link
Member Author

gzotti commented Jun 21, 2024

Someone can test this now on a sound-less PC or VM. How does it behave attempting to play videos with sound?
I am very unsure about the solution in the Qt5 path, I don't see a clear way to disable accessing some audio component. Here videos always were problematic anyhow. The one user who needs a Qt5-based soundless system, just build without media support!

src/core/StelApp.cpp Outdated Show resolved Hide resolved
- no AudioMgr and VideoMgr message when media support is disabled
- no AudioMgr message when audio is switched off by runtime option
src/core/StelVideoMgr.cpp Outdated Show resolved Hide resolved
src/core/StelAudioMgr.cpp Outdated Show resolved Hide resolved
@gzotti
Copy link
Member Author

gzotti commented Jun 22, 2024

Now I just need confirmation about whether the actual changes work on a (deliberately) crippled Linux system. Videos play silently on Windows, but i don't remove my audio drivers for testing. I also did not test Qt5, sorry to be short in time.

@10110111
Copy link
Contributor

but i don't remove my audio drivers for testing

You can just disable a device in the Device Manager.

@10110111
Copy link
Contributor

I get the following errors when building on a Windows VM (MSVC++ 17.9.34728.123; ENABLE_MEDIA=0):

C:\Users\User\source\repos\stellarium\src\core\StelAudioMgr.cpp(194): error C2511: 'StelAudioMgr::StelAudioMgr(void)': overloaded member function not found in 'StelAudioMgr'
C:\Users\User\source\repos\stellarium\src\core\StelAudioMgr.hpp(31): note: see declaration of 'StelAudioMgr'
...
C:\Users\User\source\repos\stellarium\src\core\StelVideoMgr.cpp(39): error C2614: 'StelVideoMgr': illegal member initialization: 'audioEnabled' is not a base or member

This may not circumvent problems with missing hardware,
just make sure no sound emits the speakers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing functionality importance: medium A bit annoying, minor miscalculation, but no crash
Projects
Media
  
In progress
Development

Successfully merging this pull request may close these issues.

Stellarium waiting several seconds on 'Audio' at startup
3 participants