Add disable_audio flag
This commit is contained in:
parent
10ecfa858a
commit
4684ee49c3
|
|
@ -50,7 +50,12 @@ int devinit(SimDevice* simdevices, int numdevices, DeviceSettings* ds, Monocoque
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds[j].dev_type == SIMDEV_SOUND) {
|
if (ds[j].dev_type == SIMDEV_SOUND) {
|
||||||
|
if(ms->disable_audio == true)
|
||||||
|
{
|
||||||
|
slogi("skipping configured sound device due to disable_audio being specified...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SoundDevice* sim = new_sound_device(&ds[j], ms);
|
SoundDevice* sim = new_sound_device(&ds[j], ms);
|
||||||
if (sim != NULL)
|
if (sim != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -66,6 +71,7 @@ int devinit(SimDevice* simdevices, int numdevices, DeviceSettings* ds, Monocoque
|
||||||
slogw("Could not initialize Sound Device");
|
slogw("Could not initialize Sound Device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ds[j].dev_type == SIMDEV_SERIAL) {
|
if (ds[j].dev_type == SIMDEV_SERIAL) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ typedef struct
|
||||||
int verbosity_count;
|
int verbosity_count;
|
||||||
int fps;
|
int fps;
|
||||||
bool force_udp_mode;
|
bool force_udp_mode;
|
||||||
|
bool disable_audio;
|
||||||
char* tyre_diameter_config;
|
char* tyre_diameter_config;
|
||||||
char* config_str;
|
char* config_str;
|
||||||
char* log_filename_str;
|
char* log_filename_str;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
p->verbosity_count = 0;
|
p->verbosity_count = 0;
|
||||||
p->fps = 60;
|
p->fps = 60;
|
||||||
|
|
||||||
|
p->disable_audio = false;
|
||||||
p->udp = false;
|
p->udp = false;
|
||||||
|
|
||||||
p->user_specified_config_file = false;
|
p->user_specified_config_file = false;
|
||||||
|
|
@ -61,6 +62,7 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
|
|
||||||
struct arg_rex* cmd1 = arg_rex1(NULL, NULL, "play", NULL, REG_ICASE, NULL);
|
struct arg_rex* cmd1 = arg_rex1(NULL, NULL, "play", NULL, REG_ICASE, NULL);
|
||||||
struct arg_lit* arg_udp = arg_lit0("d", "udp", "force udp mode for sims which support it");
|
struct arg_lit* arg_udp = arg_lit0("d", "udp", "force udp mode for sims which support it");
|
||||||
|
struct arg_lit* arg_audio1 = arg_lit0("a", "disable_audio", "force disable of audio devices");
|
||||||
struct arg_file* arg_conf = arg_file0("c", "uiconf", "<config_file>", NULL);
|
struct arg_file* arg_conf = arg_file0("c", "uiconf", "<config_file>", NULL);
|
||||||
struct arg_file* arg_log = arg_filen("l", "log", "<log_file>", 0, 1, NULL);
|
struct arg_file* arg_log = arg_filen("l", "log", "<log_file>", 0, 1, NULL);
|
||||||
struct arg_str* arg_confdir = arg_strn(NULL, "configdir", "config_dir>", 0, 1, NULL);
|
struct arg_str* arg_confdir = arg_strn(NULL, "configdir", "config_dir>", 0, 1, NULL);
|
||||||
|
|
@ -68,7 +70,7 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
struct arg_lit* help = arg_litn(NULL,"help", 0, 1, "print this help and exit");
|
struct arg_lit* help = arg_litn(NULL,"help", 0, 1, "print this help and exit");
|
||||||
struct arg_lit* vers = arg_litn(NULL,"version", 0, 1, "print version information and exit");
|
struct arg_lit* vers = arg_litn(NULL,"version", 0, 1, "print version information and exit");
|
||||||
struct arg_end* end1 = arg_end(20);
|
struct arg_end* end1 = arg_end(20);
|
||||||
void* argtable1[] = {cmd1,arg_log,arg_conf,arg_fps,arg_udp,arg_verbosity1,help,vers,end1};
|
void* argtable1[] = {cmd1,arg_log,arg_conf,arg_fps,arg_udp,arg_audio1,arg_verbosity1,help,vers,end1};
|
||||||
int nerrors1;
|
int nerrors1;
|
||||||
|
|
||||||
struct arg_rex* cmd2a = arg_rex1(NULL, NULL, "config", NULL, REG_ICASE, NULL);
|
struct arg_rex* cmd2a = arg_rex1(NULL, NULL, "config", NULL, REG_ICASE, NULL);
|
||||||
|
|
@ -83,10 +85,11 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
int nerrors2;
|
int nerrors2;
|
||||||
|
|
||||||
struct arg_rex* cmd3 = arg_rex1(NULL, NULL, "test", NULL, REG_ICASE, NULL);
|
struct arg_rex* cmd3 = arg_rex1(NULL, NULL, "test", NULL, REG_ICASE, NULL);
|
||||||
|
struct arg_lit* arg_audio2 = arg_lit0("a", "disable_audio", "force disable of audio devices");
|
||||||
struct arg_lit* help3 = arg_litn(NULL,"help", 0, 1, "print this help and exit");
|
struct arg_lit* help3 = arg_litn(NULL,"help", 0, 1, "print this help and exit");
|
||||||
struct arg_lit* vers3 = arg_litn(NULL,"version", 0, 1, "print version information and exit");
|
struct arg_lit* vers3 = arg_litn(NULL,"version", 0, 1, "print version information and exit");
|
||||||
struct arg_end* end3 = arg_end(20);
|
struct arg_end* end3 = arg_end(20);
|
||||||
void* argtable3[] = {cmd3,arg_verbosity3,help3,vers3,end3};
|
void* argtable3[] = {cmd3,arg_verbosity3,arg_audio2,help3,vers3,end3};
|
||||||
int nerrors3;
|
int nerrors3;
|
||||||
|
|
||||||
struct arg_lit* help0 = arg_lit0(NULL,"help", "print this help and exit");
|
struct arg_lit* help0 = arg_lit0(NULL,"help", "print this help and exit");
|
||||||
|
|
@ -132,6 +135,10 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
{
|
{
|
||||||
p->udp = true;
|
p->udp = true;
|
||||||
}
|
}
|
||||||
|
if (arg_audio1->count > 0)
|
||||||
|
{
|
||||||
|
p->disable_audio = true;
|
||||||
|
}
|
||||||
if(arg_fps->count > 0)
|
if(arg_fps->count > 0)
|
||||||
{
|
{
|
||||||
p->fps = arg_fps->ival[0];
|
p->fps = arg_fps->ival[0];
|
||||||
|
|
@ -167,6 +174,10 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
|
||||||
{
|
{
|
||||||
p->program_action = A_TEST;
|
p->program_action = A_TEST;
|
||||||
p->verbosity_count = arg_verbosity3->count;
|
p->verbosity_count = arg_verbosity3->count;
|
||||||
|
if (arg_audio2->count > 0)
|
||||||
|
{
|
||||||
|
p->disable_audio = true;
|
||||||
|
}
|
||||||
exitcode = E_SUCCESS_AND_DO;
|
exitcode = E_SUCCESS_AND_DO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ typedef struct
|
||||||
SimulatorAPI sim;
|
SimulatorAPI sim;
|
||||||
bool simon;
|
bool simon;
|
||||||
bool udp;
|
bool udp;
|
||||||
|
bool disable_audio;
|
||||||
|
|
||||||
char* config_filepath;
|
char* config_filepath;
|
||||||
char* config_dirpath;
|
char* config_dirpath;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ void SetSettingsFromParameters(Parameters* p, MonocoqueSettings* ms, char* confi
|
||||||
}
|
}
|
||||||
|
|
||||||
ms->force_udp_mode = false;
|
ms->force_udp_mode = false;
|
||||||
|
ms->disable_audio = p->disable_audio;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|
@ -243,7 +244,10 @@ int main(int argc, char** argv)
|
||||||
pulseaudio = true;
|
pulseaudio = true;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
if(ms->disable_audio == false)
|
||||||
|
{
|
||||||
setupsound();
|
setupsound();
|
||||||
|
}
|
||||||
//error = looper(devices, numdevices, p);
|
//error = looper(devices, numdevices, p);
|
||||||
error = monocoque_mainloop(ms);
|
error = monocoque_mainloop(ms);
|
||||||
if (error == MONOCOQUE_ERROR_NONE)
|
if (error == MONOCOQUE_ERROR_NONE)
|
||||||
|
|
@ -254,13 +258,19 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
sloge("Game loop exited with error code: %i", error);
|
sloge("Game loop exited with error code: %i", error);
|
||||||
}
|
}
|
||||||
|
if(ms->disable_audio == false)
|
||||||
|
{
|
||||||
freesound();
|
freesound();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slogi("running monocoque in test mode...");
|
slogi("running monocoque in test mode...");
|
||||||
|
|
||||||
|
if(ms->disable_audio == false)
|
||||||
|
{
|
||||||
setupsound();
|
setupsound();
|
||||||
|
}
|
||||||
ms->useconfig = 0;
|
ms->useconfig = 0;
|
||||||
|
|
||||||
int configs = getNumberOfConfigs(ms->config_str);
|
int configs = getNumberOfConfigs(ms->config_str);
|
||||||
|
|
@ -295,9 +305,12 @@ int main(int argc, char** argv)
|
||||||
simdevices[x].free(&simdevices[x]);
|
simdevices[x].free(&simdevices[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(ms->disable_audio == false)
|
||||||
|
{
|
||||||
freesound();
|
freesound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue