dp_doom: hacky way to run without audio

This needs fixing in the controller. Try something similar to xdg-open
where a doomgrandchild would execvp() the doom.
This commit is contained in:
oxmox 2023-02-19 16:22:51 +01:00
parent e53023079e
commit fc302969f6
2 changed files with 13 additions and 8 deletions

View file

@ -35,11 +35,8 @@ int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, vo
audio_callback = _audio_callback;
if (SDL_Init(SDL_INIT_AUDIO))
{
dp_sdl_error("IB_StartupSound: SDL_INIT_AUDIO failed");
return 0;
}
u32 activeSubsystems = SDL_WasInit(0);
log_info("IB_StartupSound: initialized SDL subsystems: 0x%08x", activeSubsystems);
desired_audio_specification.freq = 48000;
desired_audio_specification.format = AUDIO_S16;
@ -48,6 +45,13 @@ int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, vo
desired_audio_specification.callback = Callback;
desired_audio_specification.userdata = user_data;
if (SDL_Init(SDL_INIT_AUDIO))
{
dp_sdl_error("IB_StartupSound: SDL_INIT_AUDIO failed, using hacks");
initial_callback(desired_audio_specification.freq, user_data);
return 1;
}
audio_device = SDL_OpenAudioDevice(NULL,
0, &desired_audio_specification, &obtained_audio_specification,
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_SAMPLES_CHANGE);
@ -59,9 +63,10 @@ int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, vo
return 1;
}
dp_sdl_error("IB_StartupSound: SDL_INIT_AUDIO failed");
dp_sdl_error("IB_StartupSound: SDL_OpenAudioDevice failed, using hacks");
initial_callback(desired_audio_specification.freq, user_data);
SDL_QuitSubSystem(SDL_INIT_AUDIO);
return 0;
return 1;
}
void IB_ShutdownSound(void)

View file

@ -313,7 +313,7 @@ void IB_InitGraphics(const char *title, size_t screen_width, size_t screen_heigh
signal(SIGINT, I_Quit_Wrapper);
log_set_level(LOG_TRACE);
log_set_level(LOG_DEBUG);
dp_nng_init_limits(1, 1, 1);