If SDL initialization fails, the background will still start but show an error to let the user know why the sound doesn't work

Signed-off-by: Alexis Maiquez Murcia <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez Murcia 2022-04-04 21:00:03 +02:00
parent 693f3c5d0e
commit 3ed1459568
2 changed files with 15 additions and 8 deletions

View File

@ -8,19 +8,24 @@ assignees: Almamu
---
**Wallpaper Engine Background**
A link to the background in the steam workshop or it's background ID.
**Wallpaper Engine Background(s)**
Link(s) to the backgorund(s) in the steam workshop or their background ID(s).
**Console output**
When a background cannot be loaded It's usually due to some unexpected error that is logged into the terminal. Please attach the program's output so we can properly debug it if needed.
**Screenshots**
If you have any screenshot of it working on Windows that'll help so we can compare both outputs
**Desktop (please complete the following information):**
- OS: [e.g. Arch Linux]
- OS: [e.g. Arch Linux]
- Desktop Environment: [e.g. GNOME, CINNAMON, KDE...]
- Window Manager: [if in doubt, just leave it empty]
**Additional context**
Any additional information about your setup (like
Any additional information about your setup

View File

@ -345,12 +345,14 @@ int main (int argc, char* argv[])
{
// Mix_GetError is an alias for SDL_GetError, so calling it directly will yield the correct result
// it doesn't matter if SDL_Init or Mix_Init failed, both report the errors through the same functions
fprintf (stderr, "Cannot initialize SDL audio system, SDL_GetError: %s", SDL_GetError ());
return 2;
std::cerr << "Cannot initialize SDL audio system, SDL_GetError: " << SDL_GetError() << std::endl;
std::cerr << "Continuing without audio support" << std::endl;
shouldEnableAudio = false;
}
// initialize audio engine
Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
// initialize audio engine if it should be
if (shouldEnableAudio)
Mix_OpenAudio (22050, AUDIO_S16SYS, 2, 640);
}
// TODO: FIGURE OUT THE REQUIRED INPUT MODE, AS SOME WALLPAPERS USE THINGS LIKE MOUSE POSITION