Compare commits

...

2 commits

Author SHA1 Message Date
326db7e312 windows: spawn dooms with -nosound 2024-12-18 20:25:59 +01:00
5ddc95b4e9 implement -nosound option 2024-12-18 20:25:46 +01:00
2 changed files with 7 additions and 4 deletions

View file

@ -131,7 +131,7 @@ inline void spawn_doom(ControllerContext &ctx)
ZeroMemory(&pi, sizeof(pi)); ZeroMemory(&pi, sizeof(pi));
char cmdLine[256]; char cmdLine[256];
snprintf(cmdLine, sizeof(cmdLine), "%s", DOOM_EXECUTABLE); snprintf(cmdLine, sizeof(cmdLine), "%s -nosound", DOOM_EXECUTABLE);
// Start the child process. // Start the child process.
if (!CreateProcess(NULL, // No module name (use command line) if (!CreateProcess(NULL, // No module name (use command line)
@ -239,7 +239,7 @@ void check_on_dooms(ControllerContext &ctx)
} }
} while (pid > 0); } while (pid > 0);
#else #else
#warning "pid checking not implemented for Windows" //#warning "pid checking not implemented for Windows"
#endif #endif
// Find dooms that are in Endoom state and remove them. This works for // Find dooms that are in Endoom state and remove them. This works for

View file

@ -1,4 +1,5 @@
#include "../ib_sound.h" #include "../ib_sound.h"
#include "../m_argv.h"
#include <stddef.h> #include <stddef.h>
#include <dp_common.h> #include <dp_common.h>
@ -24,6 +25,8 @@ static void Callback(void *user_data, Uint8 *output_buffer, int bytes_to_do)
int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, void *user_data), void (*_audio_callback)(short* output_buffer, size_t frames_to_do, void *user_data), void *user_data) int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, void *user_data), void (*_audio_callback)(short* output_buffer, size_t frames_to_do, void *user_data), void *user_data)
{ {
const int nosound = M_CheckParm("-nosound");
SDL_AudioSpec desired_audio_specification; SDL_AudioSpec desired_audio_specification;
SDL_AudioSpec obtained_audio_specification; SDL_AudioSpec obtained_audio_specification;
@ -36,9 +39,9 @@ int IB_StartupSound(void (*initial_callback)(unsigned int output_sample_rate, vo
desired_audio_specification.callback = Callback; desired_audio_specification.callback = Callback;
desired_audio_specification.userdata = user_data; desired_audio_specification.userdata = user_data;
if (SDL_Init(SDL_INIT_AUDIO)) if (nosound || SDL_Init(SDL_INIT_AUDIO))
{ {
dp_sdl_error("IB_StartupSound: SDL_INIT_AUDIO failed, using hacks"); //dp_sdl_error("IB_StartupSound: SDL_INIT_AUDIO failed, using hacks");
initial_callback(desired_audio_specification.freq, user_data); initial_callback(desired_audio_specification.freq, user_data);
return 1; return 1;
} }