Пример #1
0
void synth_main()
{
	gfx_wave_render_initialise();
	gfx_envelope_render_initialise();

	create_settings();
	create_ui();

	gfx_event_initialise();
	gfx_initialise();

	patch_initialise();
	synth_initialise();
	configure_audio();
	configure_profiling();

	config_setting_t* piglow_config = config_lookup(&app_config, CFG_DEVICES_PIGLOW);
	if (piglow_config != NULL)
	{
		piglow_initialise(piglow_config);
	}

	waveform_initialise();
	gfx_register_event_global_handler(GFX_EVENT_BUFFERSWAP, process_buffer_swap);

	// Done after synth setup as this can load controller values into the synth
	configure_midi();

	int profiling = 0;

	int32_t last_timestamp = get_elapsed_time_ms();

	while (1)
	{
		int midi_controller_value;

		if (midi_controller_update_and_read(&exit_controller, &midi_controller_value))
		{
			break;
		}

		if (midi_controller_update_and_read(&screenshot_controller, &midi_controller_value))
		{
			static int screenshot_count = 0;
			char screenshot_name[64];
			sprintf(screenshot_name, "pithesiser-img-%03d.png", screenshot_count++);
			gfx_screenshot(screenshot_name);
		}

		process_midi_events();

		if (!profiling && midi_controller_update_and_read(&profile_controller, &midi_controller_value))
		{
			if (profile_file != NULL)
			{
				ProfilerStart(profile_file);
				profiling = 1;
			}
		}

		alsa_sync_with_audio_output();

		int32_t timestamp = get_elapsed_time_ms();
		process_audio(timestamp - last_timestamp);
		last_timestamp = timestamp;
	}

	if (profiling)
	{
		ProfilerStop();
	}

	synth_controllers_save(SETTINGS_FILE);
	patch_save();
	patch_deinitialise();
	piglow_deinitialise();
	gfx_deinitialise();
	destroy_ui();
	gfx_envelope_render_deinitialise();
	gfx_wave_render_deinitialise();
	mod_matrix_controller_deinitialise();
	alsa_deinitialise();
	midi_deinitialise();
	synth_deinitialise();
	config_destroy(&app_config);

	LOG_INFO("Done: %d xruns", alsa_get_xruns_count());
}
Пример #2
0
void GAMECLIENT::on_game_over()
{
	if(config.tc_autoscreen && !demorec_isplaying())
		gfx_screenshot();
}