Ejemplo n.º 1
0
void
loadconfig() {
	config_init(&config);
	config_set_include_dir(&config, configdir);
	config_read_file(&config, configpath);
	
	const char *dev = device;
	config_lookup_string(&config, "joystick.device", &dev);
	commands = config_lookup(&config, "commands");
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	if (logging_initialise() != RESULT_OK)
	{
		exit(EXIT_FAILURE);
	}

	const char* config_file = RESOURCES_SYNTH_CFG;
	if (argc > 1)
	{
		config_file = argv[1];
	}

	char config_dir[PATH_MAX];
	realpath(config_file, config_dir);
	dirname(config_dir);
	config_init(&app_config);
	config_set_include_dir(&app_config, config_dir);
	if (config_read_file(&app_config, config_file) != CONFIG_TRUE)
	{
		LOG_ERROR("Config error in %s at line %d: %s", config_error_file(&app_config), config_error_line(&app_config), config_error_text(&app_config));
		exit(EXIT_FAILURE);
	}

	config_setting_t *setting_tests = config_lookup(&app_config, CFG_TESTS);

	if (setting_tests != NULL)
	{
		config_setting_t *setting_code_timing_tests = config_setting_get_member(setting_tests, CFG_CODE_TIMING_TESTS);
		if (setting_code_timing_tests != NULL)
		{
			code_timing_tests_main(setting_code_timing_tests);
		}
	}
	else
	{
		recording_initialise(&app_config, WAVE_RENDERER_ID);
		synth_main();
		recording_deinitialise();
	}

	return 0;
}