当前位置: 首页>>代码示例>>C++>>正文


C++ ITheEventBoard类代码示例

本文整理汇总了C++中ITheEventBoard的典型用法代码示例。如果您正苦于以下问题:C++ ITheEventBoard类的具体用法?C++ ITheEventBoard怎么用?C++ ITheEventBoard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ITheEventBoard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ConsoleHandler

BOOL WINAPI ConsoleHandler(DWORD CEvent)
{
    switch(CEvent)
    {
    case CTRL_CLOSE_EVENT:        	
		
		ITheFramework *frame = Factory::GetFramework ();
		IThePainter *painter = 0;
		painter = Factory::GetPainter ();
		ITheEventBoard *eboard = 0;
		eboard = Factory::GetEventBoard ();

		if (eboard) {
			eboard->Stop ();
		}
		frame->Stop ();			
		frame->Clear ();
		if (eboard) {
			eboard->Clear ();
		}
		if (painter) {
			painter->Clear ();
		}		

		Factory::Clear ();
		::SetCurrentDirectory (_workdir);

		break;
    }
    return TRUE;
}
开发者ID:hihiy,项目名称:IntelliVoice,代码行数:31,代码来源:Main.cpp

示例2: ex_xml

void ex_xml () {

	ITheFramework *frame = Factory::GetFramework ();
	IThePainter *painter = Factory::GetPainter ();
	ITheEventBoard *board = Factory::GetEventBoard ();

	XMLPipeline *xmlpipe = ssi_factory_create (XMLPipeline, 0, true);
	xmlpipe->parse ("my.pipeline");
	
	frame->Start ();
	board->Start ();
	frame->Wait ();
	board->Stop ();
	frame->Stop ();
	board->Clear ();
	frame->Clear ();
	painter->Clear ();
}
开发者ID:hihiy,项目名称:IntelliVoice,代码行数:18,代码来源:Main.cpp

示例3: ex_event

bool ex_event(void *args)
{
	ITheFramework *frame = Factory::GetFramework();
	ITheEventBoard *board = Factory::GetEventBoard();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	Mouse *mouse = ssi_create(Mouse, 0, true);
	mouse->getOptions()->mask = Mouse::LEFT;
	ITransformable *button_t = frame->AddProvider(mouse, SSI_MOUSE_BUTTON_PROVIDER_NAME);
	ITransformable *cursor_t = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
	frame->AddSensor(mouse);

	PythonConsumer *py_send = ssi_create_id(PythonConsumer, 0, "pysend");
	py_send->getOptions()->setScript("ssi_send");
	ITransformable *input[] = { button_t, cursor_t };
	frame->AddConsumer(2, input, py_send, "100ms");
	board->RegisterSender(*py_send);

	PythonObject *py_listen = ssi_create_id(PythonObject, 0, "pylisten");
	py_listen->getOptions()->setScript("ssi_listen");
	board->RegisterListener(*py_listen, py_send->getEventAddress());

	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, 0, 10000u);

	SignalPainter *plot = 0;

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("CURSOR");
	frame->AddEventConsumer(cursor_t, plot, board, py_send->getEventAddress());

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:47,代码来源:Main.cpp

示例4: ex_gsr_arousal

bool ex_gsr_arousal(void *args) {

	ITheEventBoard *board = Factory::GetEventBoard();
	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	FileReader *reader = ssi_create(FileReader, 0, true);
	reader->getOptions()->setPath("data\\gsr");
	reader->getOptions()->block = 0.2;
	ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
	frame->AddSensor(reader);

	GSRArousalEstimation *arousal = ssi_create(GSRArousalEstimation, 0, true);
	ITransformable *arousal_p = frame->AddTransformer(gsr_p, arousal, "1");

	ThresClassEventSender *classifier = ssi_create(ThresClassEventSender, 0, true);
	classifier->getOptions()->setClasses("low,med,high");
	classifier->getOptions()->setThresholds("0.01,0.3,0.7");
	frame->AddConsumer(arousal_p, classifier, "1");
	board->RegisterSender(*classifier);

	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, "@");

	SignalPainter *plot = 0;

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("gsr");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(gsr_p, plot, "0.2s");

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("arousal");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(arousal_p, plot, "0.2s");

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:52,代码来源:Main.cpp

示例5: ex_stream_info

bool ex_stream_info(void *arg) {

	Factory::RegisterDLL("ssimouse");

	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create (Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard();

	//ClockEventSender *eclock = ssi_create(ClockEventSender, 0, true);

	Mouse *mouse = ssi_create(Mouse, "mouse", true);
	mouse->getOptions()->mask = Mouse::LEFT;
	mouse->getOptions()->scale = true;
	mouse->getOptions()->single = false;
	mouse->getOptions()->sendEvent = true;
	ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
	ITransformable *button_p = frame->AddProvider(mouse, SSI_MOUSE_BUTTON_PROVIDER_NAME);
	frame->AddSensor(mouse);
	board->RegisterSender(*mouse);

	Websocket *websocket = ssi_create(Websocket, 0, true);
	websocket->getOptions()->setHttpRoot("stream_to_browser_info");
	websocket->getOptions()->send_info = true;
	//frame->AddConsumer(cursor_p, websocket, "0.25s");

	ssi::ITransformable *src[2] = { cursor_p, button_p };
	frame->AddConsumer(2, src, websocket, "1");

	board->RegisterSender(*websocket);
	board->RegisterListener(*websocket);

	EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor);

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();

	frame->Wait();

	frame->Stop();
	frame->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:51,代码来源:Main.cpp

示例6: ex_mobile_events

bool ex_mobile_events(void *arg)
{

	Factory::RegisterDLL("ssiioput");

	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create (Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard();

	Websocket *websocket = ssi_create(Websocket, 0, true);
	websocket->getOptions()->setHttpRoot("mobile_browser_to_SSI");

	board->RegisterSender(*websocket);
	board->RegisterListener(*websocket);

	EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor);

	FileEventWriter *writer = ssi_create(FileEventWriter, 0, true);
	writer->getOptions()->setPath("sensor_data");
	board->RegisterListener(*writer);

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();

	frame->Wait();

	frame->Stop();
	frame->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:39,代码来源:Main.cpp

示例7: ex_events_string

bool ex_events_string(void *arg) {

	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create (Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard();

	ClockEventSender *eclock = ssi_create(ClockEventSender, 0, true);
	eclock->getOptions()->clock = 1000;
	eclock->getOptions()->empty = false;
	eclock->getOptions()->setString("test");
	board->RegisterSender(*eclock);
	frame->AddRunnable(eclock);

	Websocket *websocket = ssi_create(Websocket, 0, true);

	board->RegisterSender(*websocket);
	board->RegisterListener(*websocket);

	EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor);

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();

	frame->Wait();

	frame->Stop();
	frame->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:38,代码来源:Main.cpp

示例8: ex_sender_events

bool ex_sender_events (void *arg) {

	Socket::TYPE::List *type = ssi_pcast(Socket::TYPE::List, arg);

	ITheFramework *frame = Factory::GetFramework();
	ITheEventBoard *board = Factory::GetEventBoard();

	// start mouse

	Mouse *mouse = ssi_create(Mouse, 0, true);
	mouse->getOptions()->mask = Mouse::LEFT;
	mouse->getOptions()->sendEvent = true;
	mouse->getOptions()->setAddress("[email protected]");
	ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);	
	frame->AddSensor(mouse);
	board->RegisterSender(*mouse);
	
	MapEventSender *msender = ssi_create(MapEventSender, 0, true);
	msender->getOptions()->setAddress("[email protected]");
	msender->getOptions()->setKeys("x,y");
	frame->AddEventConsumer(cursor_p, msender, board, mouse->getEventAddress());
	board->RegisterSender(*msender);

	// start sender and receiver

	SocketEventWriter *socket_event_writer = 0;
	
	socket_event_writer = ssi_create(SocketEventWriter, 0, true);
	socket_event_writer->getOptions()->setUrl(*type, "localhost", 1111);	
	board->RegisterListener(*socket_event_writer, msender->getEventAddress());

	socket_event_writer = ssi_create(SocketEventWriter, 0, true);
	socket_event_writer->getOptions()->setUrl(*type, "localhost", 2222);
	socket_event_writer->getOptions()->osc = true;
	socket_event_writer->getOptions()->xml = false;
	board->RegisterListener(*socket_event_writer, msender->getEventAddress());

	SocketEventReader *socket_event_reader = 0;
	
	socket_event_reader = ssi_create(SocketEventReader, 0, true);
	socket_event_reader->getOptions()->setUrl(*type, "localhost", 1111);	
	socket_event_reader->getOptions()->setAddress("c[email protected]");
	board->RegisterSender(*socket_event_reader);

	socket_event_reader = ssi_create(SocketEventReader, 0, true);
	socket_event_reader->getOptions()->setUrl(*type, "localhost", 2222);
	socket_event_reader->getOptions()->osc = true;
	socket_event_reader->getOptions()->setAddress("[email protected]");
	board->RegisterSender(*socket_event_reader);

	EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
	monitor->getOptions()->setPos(CONSOLE_WIDTH, 0, 600, CONSOLE_HEIGHT);
	board->RegisterListener(*monitor, socket_event_reader->getEventAddress(), 60000);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:64,代码来源:Main.cpp

示例9: ex_vad

void ex_vad () {

	//general
	ITheFramework *frame = Factory::GetFramework ();

	Decorator *decorator = ssi_create (Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard ();
	ssi_pcast (TheEventBoard, board)->getOptions()->update = 250;

	// audio sensor	
#ifndef SIMULATE
	Audio *audio = ssi_create (Audio, "audio", true);
	audio->getOptions()->scale = true;		
	ITransformable *audio_p = frame->AddProvider(audio, SSI_AUDIO_PROVIDER_NAME);
#else
	WavReader *audio = ssi_create (WavReader, 0, true);
	audio->getOptions()->setPath("audio.wav");
	audio->getOptions()->scale = true;		
	ITransformable *audio_p = frame->AddProvider(audio, SSI_WAVREADER_PROVIDER_NAME);
#endif	
	frame->AddSensor(audio);

	SignalPainter *audio_plot = ssi_create_id (SignalPainter, 0, "plot");
	audio_plot->getOptions()->setTitle("audio");
	audio_plot->getOptions()->size = 10.0;		
	audio_plot->getOptions()->type = PaintSignalType::AUDIO;
	frame->AddConsumer(audio_p, audio_plot, "0.2s");

	OSLpc * lpc = ssi_create (OSLpc, 0, true);
	lpc->getOptions()->lsp = true;
	ssi::ITransformable *lpc_p = frame->AddTransformer(audio_p, lpc, "160");
	
	OSPitchChain * pitch = ssi_create (OSPitchChain, 0, true);
	pitch->getOSPitchShs()->getOptions()->voicingC1 = true;
	pitch->getOSPitchSmoother()->getOptions()->voicingC1 = true;
	ssi::ITransformable *pitch_p = frame->AddTransformer(audio_p, pitch, "160", "160");
	
	OSEnergy * energy = ssi_create (OSEnergy, 0, true);
	energy->getOptions()->type = OSEnergy::TYPE::LOG;
	ssi::ITransformable *energy_p = frame->AddTransformer(audio_p, energy, "160");

	OSVad * vad = ssi_create (OSVad, 0, true);
	ssi::ITransformable * src[3] = {lpc_p, pitch_p, energy_p};
	frame->AddConsumer(3, src, vad, "0.01s");
	board->RegisterSender(*vad);

	EventMonitor *monitor = ssi_create_id (EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, vad->getEventAddress());

#ifdef SIMULATE
	AudioPlayer *player = ssi_create (AudioPlayer, "player", true);
	frame->AddConsumer(audio_p, player, "0.01s");
#endif

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:68,代码来源:opensmile_testMain.cpp

示例10: Run

void Run (const ssi_char_t *exepath, const ssi_char_t *filepath, const ssi_char_t *configpaths, bool savepipe, bool init_only, bool export_dlls, bool show_close_but) {	

	Factory::RegisterDLL ("ssiframe", ssiout, ssimsg);
	Factory::RegisterDLL ("ssievent", ssiout, ssimsg);
#if _WIN32||_WIN64
	// disable close button
	if (!show_close_but) {
		RemoveCloseButton ();
	}

	// working directory
	::GetCurrentDirectory (SSI_MAX_CHAR, _workdir);
#else
	getcwd(_workdir,SSI_MAX_CHAR);
#endif
	// executable directory
	FilePath exepath_fp (exepath);	
	ssi_char_t exedir[SSI_MAX_CHAR];
	if (exepath_fp.isRelative ()) {
		#if _WIN32||_WIN64
		ssi_sprint (exedir, "%s\\%s", _workdir, exepath_fp.getDir ());
		#else
		ssi_sprint (exedir, "%s/%s", _workdir, exepath_fp.getDir ());
		#endif
	} else {
		strcpy (exedir, exepath_fp.getDir ());
	}

	// full pipepath
	FilePath filepath_fp (filepath);	
	ssi_char_t pipepath[SSI_MAX_CHAR];
	if (filepath_fp.isRelative ()) {
		#if _WIN32||_WIN64
		ssi_sprint (pipepath, "%s\\%s", _workdir, filepath);
		#else
		ssi_sprint (pipepath, "%s/%s", _workdir, filepath);

		#endif
	} else {
		strcpy (pipepath, filepath);
	}

	// set working directory to pipeline directory
		#if _WIN32||_WIN64
	::SetCurrentDirectory (filepath_fp.getDir ());
	#else
	chdir(filepath_fp.getDir ());
	#endif


	XMLPipeline *xmlpipe = ssi_create (XMLPipeline, 0, true);

	xmlpipe->SetRegisterDllFptr (Factory::RegisterDLL);
	bool result = false;
	if (configpaths) {
		ssi_size_t n = 0;
		n = ssi_split_string_count (configpaths, ';');
		ssi_char_t **ns = new ssi_char_t *[n];
		ssi_split_string (n, ns, configpaths, ';');
		result = xmlpipe->parse (pipepath, n, ns, savepipe);
	} else {
		result = xmlpipe->parse (pipepath, 0, 0, savepipe);
	}

	if (!result) {
		ssi_print ("ERROR: could not parse pipeline from '%s'\n", pipepath);
		ssi_print ("\n\n\t\tpress enter to quit\n");
		getchar ();
	} else {

		if (export_dlls) {
			Factory::ExportDlls (exedir);
		}

		if (!init_only) {			

			ITheFramework *frame = Factory::GetFramework ();
			IThePainter *painter = 0;
			if (xmlpipe->startPainter ()) {
				painter = Factory::GetPainter ();
			}
			ITheEventBoard *eboard = 0;
			if (xmlpipe->startEventBoard ()) {
				eboard = Factory::GetEventBoard ();
			}						
			frame->Start ();
			if (eboard) {
				eboard->Start ();
			}
			frame->Wait ();
			if (eboard) {
				eboard->Stop ();
			}
			frame->Stop ();			
			frame->Clear ();
			if (eboard) {
				eboard->Clear ();
			}
			if (painter) {
				painter->Clear ();
//.........这里部分代码省略.........
开发者ID:hihiy,项目名称:IntelliVoice,代码行数:101,代码来源:Main.cpp

示例11: ex_bvp_beat_events_raw

bool ex_bvp_beat_events_raw(void *args) {

	ITheEventBoard *board = Factory::GetEventBoard();
	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	FileReader *reader = ssi_create(FileReader, 0, true);
	reader->getOptions()->setPath("data\\bvp");
	reader->getOptions()->block = 0.2;
	reader->getOptions()->loop = false;

	ITransformable *bvp_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
	frame->AddSensor(reader);

	SignalPainter *plot = 0;

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("bvp");
	plot->getOptions()->size = 10.0;
	frame->AddConsumer(bvp_p, plot, "1");

	BVPBeatEventSender *bvp_event = ssi_create(BVPBeatEventSender, 0, true);
	bvp_event->getOptions()->beep = true;
	bvp_event->getOptions()->mean_window = 1;
	bvp_event->getOptions()->tuple = true;

	bvp_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);

	frame->AddConsumer(bvp_p, bvp_event, "0.2s");

	board->RegisterSender(*bvp_event);

	BVPBeatEventRawListener *event_listener = ssi_create(BVPBeatEventRawListener, 0, true);
	event_listener->getOptions()->sr = 9;

	ITransformable *heartRate = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_HEART_RATE_PROVIDER_NAME);
	ITransformable *amp = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_AMPLITUDE_PROVIDER_NAME);
	ITransformable *interBeat = frame->AddProvider(event_listener, SSI_BVP_EVENTLISTENER_CHANNEL_INTERBEAT_INTERVAL_PROVIDER_NAME);

	frame->AddSensor(event_listener);

	board->RegisterListener(*event_listener, bvp_event->getEventAddress());

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("heartRate");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(heartRate, plot, "1");

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("amp");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(amp, plot, "1");

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("interBeat");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(interBeat, plot, "1");

	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, bvp_event->getEventAddress());

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:77,代码来源:Main.cpp

示例12: ex_gsr_response_amplitude_events

bool ex_gsr_response_amplitude_events(void *args) {

	ITheEventBoard *board = Factory::GetEventBoard();
	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	FileReader *reader = ssi_create(FileReader, 0, true);
	reader->getOptions()->setPath("data\\gsr");
	reader->getOptions()->block = 0.2;
	reader->getOptions()->loop = false;

	ITransformable *gsr_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
	frame->AddSensor(reader);

	SignalPainter *plot = 0;

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("gsr(lowpassed)");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(gsr_p, plot, "1");

	GSRResponseEventSender *gsr_event = ssi_create(GSRResponseEventSender, 0, true);
	gsr_event->getOptions()->tuple = true;
	gsr_event->getOptions()->minRisingTime = 0;
	gsr_event->getOptions()->minAllowedRegression = 0.1f;
	gsr_event->getOptions()->minAmplitude = 0.5f;
	gsr_event->getOptions()->print = false;

	gsr_event->setLogLevel(SSI_LOG_LEVEL_DEBUG);

	frame->AddConsumer(gsr_p, gsr_event, "0.2s");

	board->RegisterSender(*gsr_event);

	GSREventListener *event_listener = ssi_create(GSREventListener, 0, true);
	event_listener->getOptions()->statisticalFn = GSR_SUM;
	event_listener->getOptions()->window = SSI_GSR_EVENTLISTENER_NO_WINDOW;

	ITransformable *nr_of_responses = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_NUMBER_OF_RESPONSES_PROVIDER_NAME);
	ITransformable *amp = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_AMPLITUDE_PROVIDER_NAME);
	ITransformable *power = frame->AddProvider(event_listener, SSI_GSR_EVENTLISTENER_POWER_PROVIDER_NAME);

	frame->AddSensor(event_listener);

	board->RegisterListener(*event_listener, gsr_event->getEventAddress());

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("nr_of_responses");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(nr_of_responses, plot, "1");

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("amp");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(amp, plot, "1");

	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("power");
	plot->getOptions()->size = 150.0;
	frame->AddConsumer(power, plot, "1");

	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, gsr_event->getEventAddress());

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;

}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:81,代码来源:Main.cpp

示例13: ex_qrs_hr_features

bool ex_qrs_hr_features(void *args) {

	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard();

	//raw
	FileReader *reader = ssi_create(FileReader, 0, true);
	reader->getOptions()->setPath("data/ecg");
	reader->getOptions()->block = 0.2;
	ITransformable *ecg_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
	frame->AddSensor(reader);

	// qrs detection
	QRSDetection *ecg_chain = ssi_create(QRSDetection, 0, true);
	ecg_chain->getOptions()->sendEvent = false;
	ITransformable *ecg_qrs_t = frame->AddTransformer(ecg_p, ecg_chain, "0.75s", "0", "60.0s");

	// heart rate
	QRSHeartRate *qrshr = ssi_create(QRSHeartRate, 0, true);
	ITransformable *ecg_hr_t = frame->AddTransformer(ecg_qrs_t, qrshr, "1.0s", "0", "60.0s");

	// heart rate features
	Spectrogram *spectogram = ssi_create(Spectrogram, 0, true);
	ssi_strcpy(spectogram->getOptions()->file, "hrspect.banks");
	spectogram->getOptions()->nbanks = 3;
	ITransformable *ecg_hr_spec_t = frame->AddTransformer(ecg_hr_t, spectogram, "1", "29", "60.0s");

	//hrv_spectral
	QRSHRVspectral *ecg_hr_spectralfeatures = ssi_create(QRSHRVspectral, 0, true);
	ecg_hr_spectralfeatures->getOptions()->print = true;
	ITransformable *ecg_hr_spectralfeatures_t = frame->AddTransformer(ecg_hr_spec_t, ecg_hr_spectralfeatures, "1", "0", "60.0s");

	//hrv_time
	QRSHRVtime *ecg_hr_timefeatures = ssi_create(QRSHRVtime, 0, true);
	ecg_hr_timefeatures->getOptions()->print = true;
	ITransformable *ecg_hr_timefeatures_t = frame->AddTransformer(ecg_qrs_t, ecg_hr_timefeatures, "1.0s", "6.5s", "60.0s");

	//visual
	SignalPainter *plot = 0;
	ssi_real_t p_size = 100.0f;

	//qrs
	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("qrs");
	plot->getOptions()->size = p_size;
	frame->AddConsumer(ecg_qrs_t, plot, "0.75s");

	//heart rate
	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("hr");
	plot->getOptions()->size = p_size;
	frame->AddConsumer(ecg_hr_t, plot, "1");

	//spectrgram
	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("hr spect");
	plot->getOptions()->size = p_size;
	plot->getOptions()->type = PaintSignalType::IMAGE;
	frame->AddConsumer(ecg_hr_spec_t, plot, "1");

	//framework

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();

	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:81,代码来源:Main.cpp

示例14: ex_qrs_heartrate_mean

bool ex_qrs_heartrate_mean(void *args) {

	if (!ssi_exists("data/ecg_qrs.stream")) {
		ex_ecg_detection(args);
	}

	ITheFramework *frame = Factory::GetFramework();

	Decorator *decorator = ssi_create(Decorator, 0, true);
	frame->AddDecorator(decorator);

	ITheEventBoard *board = Factory::GetEventBoard();

	//raw
	FileReader *reader = ssi_create(FileReader, 0, true);
	reader->getOptions()->setPath("data/ecg_qrs");
	reader->getOptions()->block = 0.2;
	ITransformable *qrs_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
	frame->AddSensor(reader);

	// heart rate
	QRSHeartRate *qrshr = ssi_create(QRSHeartRate, 0, true);
	ITransformable *ecg_hr_t = frame->AddTransformer(qrs_p, qrshr, "0.25s");

	//heart rate mean
	QRSHeartRateMean *qrshr_mean = ssi_create(QRSHeartRateMean, 0, true);
	qrshr_mean->getOptions()->winsize = 15.0;
	frame->AddConsumer(ecg_hr_t, qrshr_mean, "0.25s");
	board->RegisterSender(*qrshr_mean);

	//visual
	SignalPainter *plot = 0;
	ssi_real_t p_size = 100.0f;

	//qrs
	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("qrs");
	plot->getOptions()->size = p_size;
	frame->AddConsumer(qrs_p, plot, "0.3s");

	//heart rate
	plot = ssi_create_id(SignalPainter, 0, "plot");
	plot->getOptions()->setTitle("heartrate");
	plot->getOptions()->size = p_size;
	frame->AddConsumer(ecg_hr_t, plot, "0.3s");

	//events
	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	board->RegisterListener(*monitor, qrshr_mean->getEventAddress());

	//framework

	decorator->add("console", 0, 0, 650, 800);
	decorator->add("plot*", 650, 0, 400, 400);
	decorator->add("monitor*", 650, 400, 400, 400);

	board->Start();
	frame->Start();

	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

	return true;
}
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:67,代码来源:Main.cpp

示例15: ex_annotation

bool ex_annotation(void *arg) {

	ITheFramework *frame = Factory::GetFramework();
	ITheEventBoard *board = Factory::GetEventBoard();

	Mouse *mouse = ssi_create(Mouse, 0, true);
	mouse->getOptions()->sr = 50.0;
	mouse->getOptions()->mask = Mouse::LEFT;
	ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
	ITransformable *button_p = frame->AddProvider(mouse, SSI_MOUSE_BUTTON_PROVIDER_NAME);
	frame->AddSensor(mouse);

	TriggerEventSender *ezero = 0;
	
	ezero = ssi_create(TriggerEventSender, 0, true);
	ezero->getOptions()->triggerType = TriggerEventSender::TRIGGER::NOT_EQUAL;
	ezero->getOptions()->setAddress("[email protected]");
	ezero->getOptions()->minDuration = 0.2;
	frame->AddConsumer(button_p, ezero, "0.25s");
	board->RegisterSender(*ezero);

	ezero = ssi_create(TriggerEventSender, 0, true);
	ezero->getOptions()->triggerType = TriggerEventSender::TRIGGER::NOT_EQUAL;
	ezero->getOptions()->setAddress("[email protected]");
	ezero->getOptions()->minDuration = 0.2;
	ezero->getOptions()->eventType = SSI_ETYPE_STRING;
	ezero->getOptions()->setEventString("string");
	frame->AddConsumer(button_p, ezero, "0.25s");
	board->RegisterSender(*ezero);

	StringEventSender *ssender = ssender = ssi_create(StringEventSender, 0, true);
	ssender->getOptions()->setAddress("[email protected]");
	ssender->getOptions()->mean = true;
	frame->AddEventConsumer(cursor_p, ssender, board, ezero->getEventAddress());
	board->RegisterSender(*ssender);

	MapEventSender *msender = 0;
	
	msender = ssi_create(MapEventSender, 0, true);
	msender->getOptions()->setAddress("[email protected]");
	msender->getOptions()->setKeys("x,y");
	frame->AddEventConsumer(cursor_p, msender, board, ezero->getEventAddress());
	board->RegisterSender(*msender);

	msender = ssi_create(MapEventSender, 0, true);
	msender->getOptions()->setAddress("[email protected]");
	msender->getOptions()->setKeys("y,x");
	frame->AddEventConsumer(cursor_p, msender, board, ezero->getEventAddress());
	board->RegisterSender(*msender);
	
	FileAnnotationWriter *annotation = 0;
			
	annotation = ssi_create(FileAnnotationWriter, 0, true);	
	annotation->getOptions()->setAnnoPath("discrete_empty_and_string");
	annotation->getOptions()->setSchemePath("scheme_discrete.annotation");
	annotation->getOptions()->setDefaultLabel("empty");
	annotation->getOptions()->defaultConfidence = 0.5f;
	annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
	board->RegisterListener(*annotation, ezero->getEventAddress());	

	annotation = ssi_create(FileAnnotationWriter, 0, true);
	annotation->getOptions()->setAnnoPath("discrete_map");
	annotation->getOptions()->setSchemePath("scheme_discrete.annotation");
	annotation->getOptions()->mapKeyIndex = 1;
	annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
	board->RegisterListener(*annotation, msender->getEventAddress());

	annotation = ssi_create(FileAnnotationWriter, 0, true);
	annotation->getOptions()->setAnnoPath("free_empty_and_string");
	annotation->getOptions()->setSchemePath("scheme_free");
	annotation->getOptions()->setDefaultLabel("empty");
	annotation->getOptions()->defaultConfidence = 0.5f;
	annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
	board->RegisterListener(*annotation, ezero->getEventAddress());

	annotation = ssi_create(FileAnnotationWriter, 0, true);
	annotation->getOptions()->setAnnoPath("free_map");
	annotation->getOptions()->setSchemePath("scheme_free");
	annotation->getOptions()->mapKeyIndex = 1;
	annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
	board->RegisterListener(*annotation, msender->getEventAddress());

	annotation = ssi_create(FileAnnotationWriter, 0, true);
	annotation->getOptions()->setAnnoPath("continuous");
	annotation->getOptions()->setSchemePath("scheme_continuous");
	annotation->getOptions()->setMeta("annotator=hans;role=wurscht");
	frame->AddConsumer(cursor_p, annotation, "1.0s");

	EventMonitor *monitor = ssi_create_id(EventMonitor, 0, "monitor");
	monitor->getOptions()->setPos(CONSOLE_WIDTH, 0, 600, 300);
	board->RegisterListener(*monitor, 0, 60000);

	board->Start();
	frame->Start();
	frame->Wait();
	frame->Stop();
	board->Stop();
	frame->Clear();
	board->Clear();

//.........这里部分代码省略.........
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:101,代码来源:Main.cpp


注:本文中的ITheEventBoard类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。