コード例 #1
0
ファイル: meters.c プロジェクト: felipebetancur/meters.lv2
LV2_SYMBOL_EXPORT
const LV2UI_Descriptor*
lv2ui_descriptor(uint32_t index)
{
#if (defined _WIN32 && defined RTK_STATIC_INIT)
	static int once = 0;
	if (!once) {once = 1; gobject_init_ctor();}
#endif
	switch (index) {
	case 0: return lv2ui_kmeter (index);
	case 1: return lv2ui_needle (index);
	case 2: return lv2ui_phasewheel (index);
	case 3: return lv2ui_sdhmeter (index);
	case 4: return lv2ui_goniometer (index);
	case 5: return lv2ui_dr14meter (index);
	case 6: return lv2ui_stereoscope (index);
	case 7: return lv2ui_ebur (index);
	case 8: return lv2ui_dpm (index);
	default:
		return NULL;
	}
}
コード例 #2
0
ファイル: robtkapp.c プロジェクト: x42/robtk
int main (int argc, char **argv) {
	int rv = 0;

	inst = & _plugin;

#ifdef __APPLE__
	rtk_osx_api_init();
#endif

#ifdef _WIN32
	pthread_win32_process_attach_np();
#endif
#if (defined _WIN32 && defined RTK_STATIC_INIT)
	glib_init_static();
	gobject_init_ctor();
#endif

	struct { int argc; char **argv; } rtkargv;
	rtkargv.argc = argc;
	rtkargv.argv = argv;

	const LV2_Feature external_lv_feature = { LV2_EXTERNAL_UI_URI, &extui_host};
	const LV2_Feature external_kx_feature = { LV2_EXTERNAL_UI_URI__KX__Host, &extui_host};
	const LV2_Feature robtk_argv = { "http://gareus.org/oss/lv2/robtk#argv", &rtkargv};

	// TODO add argv[] as feature
	const LV2_Feature* ui_features[] = {
		&external_lv_feature,
		&external_kx_feature,
		&robtk_argv,
		NULL
	};

	extui_host.plugin_human_id = inst->plugin_human_id;

	plugin_gui = inst->lv2ui_descriptor(inst->gui_descriptor_id);

	if (plugin_gui) {
	/* init plugin GUI */
	extui_host.ui_closed = on_external_ui_closed;
	gui_instance = plugin_gui->instantiate(plugin_gui,
			"URI TODO", NULL, NULL, NULL,
			(void **)&extui, ui_features);

	}

	if (!gui_instance || !extui) {
		fprintf(stderr, "Error: GUI was not initialized.\n");
		rv |= 2;
		goto out;
	}

#ifndef _WIN32
	signal (SIGHUP, catchsig);
	signal (SIGINT, catchsig);
#endif

	{

		LV2_EXTERNAL_UI_SHOW(extui);

#ifdef __APPLE__
		CFRunLoopRef runLoop = CFRunLoopGetCurrent();
		CFRunLoopTimerContext context = {0, NULL, NULL, NULL, NULL};
		CFRunLoopTimerRef timer = CFRunLoopTimerCreate(kCFAllocatorDefault, 0, 1.0/UI_UPDATE_FPS, 0, 0, &osx_loop, &context);
		CFRunLoopAddTimer(runLoop, timer, kCFRunLoopCommonModes);
		rtk_osx_api_run();
#else

		main_loop();
#endif

		LV2_EXTERNAL_UI_HIDE(extui);
	}

out:
	cleanup(0);
#ifdef _WIN32
	pthread_win32_process_detach_np();
#endif
#if (defined _WIN32 && defined RTK_STATIC_INIT)
	glib_cleanup_static();
#endif
	return(rv);
}