本文整理汇总了C++中ITheFramework::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ITheFramework::Clear方法的具体用法?C++ ITheFramework::Clear怎么用?C++ ITheFramework::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITheFramework
的用法示例。
在下文中一共展示了ITheFramework::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex_sensor
bool ex_sensor(void *args)
{
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
PythonSensor *py_sensor = ssi_create(PythonSensor, 0, true);
py_sensor->getOptions()->setScript("ssi_sensor");
py_sensor->getOptions()->block = 0.5;
py_sensor->getOptions()->add("sr", "1000");
py_sensor->getOptions()->add("dim", "2");
ITransformable *sine_t = frame->AddProvider(py_sensor, "sine");
ITransformable *saw_t = frame->AddProvider(py_sensor, "saw");
frame->AddSensor(py_sensor);
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("SINE");
plot->getOptions()->size = 5;
frame->AddConsumer(sine_t, plot, "0.5s");
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("SAW");
plot->getOptions()->size = 5;
frame->AddConsumer(saw_t, plot, "0.5s");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}
示例2: ex_sensor
bool ex_sensor (void *arg) {
ITheFramework *frame = Factory::GetFramework ();
//IThePainter *painter = Factory::GetPainter ();
//ITheEventBoard *board = Factory::GetEventBoard ();
Mouse *mouse = ssi_pcast (Mouse, Factory::Create (Mouse::GetCreateName (), "mouse"));
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);
ZeroEventSender *ezero = ssi_create (ZeroEventSender, "ezero", true);
ezero->getOptions ()->mindur = 0.2;
frame->AddConsumer (cursor_p, ezero, "0.25s");
/*
board->RegisterSender (*ezero);
SignalPainter *sigpaint = ssi_create (SignalPainter, 0, true);
sigpaint->getOptions ()->setName ("mouse");
sigpaint->getOptions ()->size = 2.0;
frame->AddConsumer (cursor_p, sigpaint, "0.2s");
sigpaint= ssi_create (SignalPainter, 0, true);
sigpaint->getOptions ()->setName ("mouse (tr)");
frame->AddEventConsumer (cursor_p, sigpaint, board, ezero->getEventAddress ());
*/
frame->Start ();
//board->Start ();
//painter->Arrange (2, 1, 0, 0, 800, 400);
frame->Wait ();
//board->Stop ();
frame->Stop ();
frame->Clear ();
//board->Clear ();
//painter->Clear ();
return true;
}
示例3: ex_trigger
bool ex_trigger (void *arg) {
ITheFramework *frame = Factory::GetFramework ();
//ssi_pcast(TheFramework, frame)->getOptions()->setConsolePos(800, 200, 400, 200);
Mouse *mouse = ssi_create (Mouse, 0, false);
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);
FileWriter *writer = ssi_create (FileWriter, 0, true);
writer->getOptions ()->type = File::ASCII;
frame->AddConsumer (cursor_p, writer, "0.2s", 0, 0, button_p);
frame->Start ();
frame->Wait ();
frame->Stop ();
frame->Clear ();
return true;
}
示例4: 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;
}
示例5: 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;
}
示例6: ex_pearson
bool ex_pearson(void *args)
{
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
Mouse *mouse = ssi_create(Mouse, 0, true);
ITransformable *cursor_t = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
frame->AddSensor(mouse);
PythonFeature *ppmcc = ssi_create(PythonFeature, 0, true);
ppmcc->getOptions()->setScript("ssi_ppmcc");
ITransformable *ppmcc_t = frame->AddTransformer(cursor_t, ppmcc, "0.1s");
SignalPainter *plot = 0;
plot = ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->setTitle("CURSOR");
plot->getOptions()->size = 5;
frame->AddConsumer(cursor_t, plot, "0.1s");
plot = ssi_create_id (SignalPainter, 0, "plot");
plot->getOptions()->setTitle("PPMCC");
plot->getOptions()->size = 5;
frame->AddConsumer(ppmcc_t, plot, "1");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}
示例7: ex_imggray
bool ex_imggray(void *args)
{
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
frame->AddDecorator(decorator);
FakeSignal *video = ssi_create(FakeSignal, 0, true);
video->getOptions()->type = FakeSignal::SIGNAL::IMAGE_RANDOM_RGB;
ITransformable *rgb_t = frame->AddProvider(video, "video");
frame->AddSensor(video);
PythonImageFilter *imggray = ssi_create(PythonImageFilter, 0, true);
imggray->getOptions()->setScript("ssi_imggray");
ITransformable *gray_t = frame->AddTransformer(rgb_t, imggray, "1");
VideoPainter *vidplot = 0;
vidplot = ssi_create_id(VideoPainter, 0, "plot");
vidplot->getOptions()->setTitle("RGB");
frame->AddConsumer(rgb_t, vidplot, "1");
vidplot = ssi_create_id(VideoPainter, 0, "plot");
vidplot->getOptions()->setTitle("GRAY");
frame->AddConsumer(gray_t, vidplot, "1");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}
示例8: ex_simulator
bool ex_simulator(void *arg) {
if (!ssi_exists("cursor_txt.stream")) {
ex_writer(0);
}
ITheFramework *frame = Factory::GetFramework ();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
File::SetLogLevel (SSI_LOG_LEVEL_DEBUG);
FileReader *reader = ssi_create (FileReader, 0, true);
reader->getOptions()->setPath("cursor_txt");
reader->getOptions()->block = 0.05;
reader->getOptions()->loop = true;
reader->getOptions()->offset = 0.1;
ITransformable *cursor_p = frame->AddProvider(reader, SSI_FILEREADER_PROVIDER_NAME);
frame->AddSensor(reader);
FileWriter *writer = ssi_create (FileWriter, 0, true);
writer->getOptions()->type = File::ASCII;
frame->AddConsumer(cursor_p, writer, "0.05s");
decorator->add("console", 0, 0, 650, 800);
decorator->add("plot*", 650, 0, 400, 400);
decorator->add("monitor*", 650, 400, 400, 400);
frame->Start();
reader->wait();
frame->Stop();
frame->Clear();
return true;
}
示例9: ex_event
bool ex_event (void *arg) {
ITheFramework *frame = Factory::GetFramework ();
ssi_pcast(TheFramework, frame)->getOptions()->setConsolePos(800, 200, 400, 200);
//IThePainter *painter = Factory::GetPainter ();
//ITheEventBoard *board = Factory::GetEventBoard ();
Mouse *mouse = ssi_create (Mouse, 0, false);
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);
// output
/*
SignalPainter *signal_painter = 0;
signal_painter = ssi_create (SignalPainter, 0, true);
signal_painter->getOptions ()->size = 2.0;
signal_painter->getOptions ()->setName ("cursor");
frame->AddConsumer (cursor_p, signal_painter, "0.2s");
*/
// zero event
ZeroEventSender *ezero = ssi_create (ZeroEventSender, 0, true);
ezero->getOptions ()->setSender ("mouse");
ezero->getOptions ()->setEvent ("click");
ezero->getOptions ()->eager = true;
ezero->getOptions ()->eall = true;
ezero->getOptions ()->hard = true;
ezero->getOptions ()->mindur = 0.5;
ezero->getOptions ()->maxdur = 4.0;
ezero->getOptions ()->hangin = 5;
ezero->getOptions ()->hangout = 5;
ezero->getOptions ()->empty = false;
ezero->getOptions ()->setString("ezero");
frame->AddConsumer (button_p, ezero, "0.2s");
//board->RegisterSender (*ezero);
FloatsEventSender *fsender = ssi_factory_create (FloatsEventSender, 0, true);
fsender->getOptions ()->mean = true;
fsender->getOptions ()->setEventName ("position");
fsender->getOptions ()->setSenderName ("mouse");
//frame->AddEventConsumer (cursor_p, fsender, board, ezero->getEventAddress ());
//board->RegisterSender (*fsender);
/*
signal_painter = ssi_create (SignalPainter, 0, true);
signal_painter->getOptions ()->size = 0;
signal_painter->getOptions ()->setName ("click event");
frame->AddEventConsumer (cursor_p, signal_painter, board, ezero->getEventAddress ());
*/
// thres event
ThresEventSender *ethres = ssi_create (ThresEventSender, "ethres", true);
ethres->getOptions ()->setSender ("tes");
ethres->getOptions ()->setEvent ("te");
ethres->getOptions ()->hard = false;
ethres->getOptions ()->mindur = 0.5;
ethres->getOptions ()->maxdur = 4.0;
ethres->getOptions ()->hangin = 5;
ethres->getOptions ()->hangout = 5;
ethres->getOptions ()->thres = 0.5;
ethres->getOptions ()->empty = false;
ethres->getOptions ()->setString("ethres");
frame->AddConsumer (cursor_p, ethres, "0.2s");
//board->RegisterSender (*ethres);
EventConsumer *ethres_c = ssi_create (EventConsumer, 0, true);
ethres_c->getOptions ()->async = true;
//board->RegisterListener (*ethres_c, ethres->getEventAddress ());
/*
signal_painter = ssi_create (SignalPainter, 0, true);
signal_painter->getOptions ()->size = 0;
signal_painter->getOptions ()->setName ("thres event");
ethres_c->AddConsumer (cursor_p, signal_painter);
// event monitor
EventMonitor *emonitor = ssi_create (EventMonitor, 0, true);
emonitor->getOptions ()->setMonitorPos (0, 200, 800, 200);
board->RegisterListener (*emonitor, 0, 50000);
*/
// run
frame->Start ();
//board->Start ();
//painter->Arrange (3,1,0,0,800,200);
frame->Wait ();
//board->Stop ();
frame->Stop ();
frame->Clear ();
//board->Clear ();
//painter->Clear ();
return true;
}
示例10: 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;
}
示例11: ex_sender
bool ex_sender(void *arg) {
Socket::TYPE::List *type = ssi_pcast(Socket::TYPE::List, arg);
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create(Decorator, 0, true);
decorator->getOptions()->setOrigin(CONSOLE_WIDTH, 0);
frame->AddDecorator(decorator);
// start mouse
Mouse *mouse = ssi_create (Mouse, "mouse", true);
ITransformable *cursor_p = frame->AddProvider(mouse, SSI_MOUSE_CURSOR_PROVIDER_NAME);
frame->AddSensor(mouse);
// start sender and receiver
SocketWriter *socket_writer_bin = ssi_create (SocketWriter, 0, true);
socket_writer_bin->getOptions()->setUrl(*type, "localhost", 1111);
socket_writer_bin->getOptions()->format = SocketWriter::Options::FORMAT::BINARY;
frame->AddConsumer(cursor_p, socket_writer_bin, "0.25s");
SocketReader *socket_reader_bin = ssi_create (SocketReader, 0, true);
socket_reader_bin->getOptions()->setUrl(*type, "localhost", 1111);
socket_reader_bin->getOptions()->format = SocketReader::Options::FORMAT::BINARY;
socket_reader_bin->getOptions()->setSampleInfo(cursor_p->getSampleRate(), cursor_p->getSampleDimension(), cursor_p->getSampleBytes(), cursor_p->getSampleType());
ITransformable *socket_reader_bin_p = frame->AddProvider(socket_reader_bin, SSI_SOCKETREADER_PROVIDER_NAME);
frame->AddSensor(socket_reader_bin);
SocketWriter *socket_writer_asc = ssi_create (SocketWriter, 0, true);
socket_writer_asc->getOptions()->setUrl(*type, "localhost", 2222);
socket_writer_asc->getOptions()->format = SocketWriter::Options::FORMAT::ASCII;
frame->AddConsumer(cursor_p, socket_writer_asc, "0.25s");
SocketReader *socket_reader_asc = ssi_create (SocketReader, 0, true);
socket_reader_asc->getOptions()->setUrl(*type, "localhost", 2222);
socket_reader_asc->getOptions()->format = SocketReader::Options::FORMAT::ASCII;
socket_reader_asc->getOptions()->setSampleInfo(cursor_p->getSampleRate(), cursor_p->getSampleDimension(), cursor_p->getSampleBytes(), cursor_p->getSampleType());
ITransformable *socket_reader_asc_p = frame->AddProvider(socket_reader_asc, SSI_SOCKETREADER_PROVIDER_NAME);
frame->AddSensor(socket_reader_asc);
SocketWriter *socket_writer_osc = ssi_create (SocketWriter, 0, true);
socket_writer_osc->getOptions()->setUrl(*type, "localhost", 3333);
socket_writer_osc->getOptions()->format = SocketWriter::Options::FORMAT::OSC;
socket_writer_osc->getOptions()->setId("mouse");
frame->AddConsumer(cursor_p, socket_writer_osc, "0.25s");
SocketReader *socket_reader_osc = ssi_create (SocketReader, 0, true);
socket_reader_osc->getOptions()->setUrl(*type, "localhost", 3333);
socket_reader_osc->getOptions()->format = SocketReader::Options::FORMAT::OSC;
socket_reader_osc->getOptions()->setSampleInfo(cursor_p->getSampleRate(), cursor_p->getSampleDimension(), cursor_p->getSampleBytes(), cursor_p->getSampleType());
ITransformable *socket_reader_osc_p = frame->AddProvider(socket_reader_osc, SSI_SOCKETREADER_PROVIDER_NAME);
frame->AddSensor(socket_reader_osc);
SignalPainter *plot;
plot =ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->size = 10;
plot->getOptions()->setTitle("Local Sensor");
frame->AddConsumer(cursor_p, plot, "5");
plot =ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->size = 10;
plot->getOptions()->setTitle("Socker Reader(Binary)");
frame->AddConsumer(socket_reader_bin_p, plot, "5");
plot =ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->size = 10;
plot->getOptions()->setTitle("Socker Reader(ASCII)");
frame->AddConsumer(socket_reader_asc_p, plot, "5");
plot =ssi_create_id(SignalPainter, 0, "plot");
plot->getOptions()->size = 10;
plot->getOptions()->setTitle("Socker Reader(OSC)");
frame->AddConsumer(socket_reader_osc_p, plot, "5");
decorator->add("plot*", 0, 0, 400, CONSOLE_HEIGHT);
frame->Start();
frame->Wait();
frame->Stop();
frame->Clear();
return true;
}
示例12: ex_samples
bool ex_samples(void *arg) {
ITheFramework *frame = Factory::GetFramework();
Decorator *decorator = ssi_create (Decorator, 0, true);
frame->AddDecorator(decorator);
ITheEventBoard *board = Factory::GetEventBoard();
ssi_event_t e_class;
ssi_event_init(e_class, SSI_ETYPE_STRING, Factory::AddString("sender"), Factory::AddString("class"), 0, 0, SSI_MAX_CHAR);
Mouse *mouse = ssi_create(Mouse, 0, false);
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);
FileSampleWriter *writer = 0;
writer = ssi_create(FileSampleWriter, 0, true);
writer->getOptions()->type = File::ASCII;
writer->getOptions()->setClasses("A;B");
writer->getOptions()->setUser("user");
frame->AddConsumer(cursor_p, writer, "1.0s");
board->RegisterListener(*writer, "[email protected]");
writer = ssi_create(FileSampleWriter, 0, true);
writer->getOptions()->setPath("test");
writer->getOptions()->type = File::BINARY;
writer->getOptions()->setClasses("A;B");
writer->getOptions()->setUser("user");
frame->AddConsumer(cursor_p, writer, "1.0s");
board->RegisterListener(*writer, "[email protected]");
writer = ssi_create(FileSampleWriter, 0, true);
writer->getOptions()->type = File::ASCII;
writer->getOptions()->setClasses("A;B");
writer->getOptions()->setUser("user");
writer->getOptions()->streamClassIndex = 1;
ITransformable *input[2] = { cursor_p, cursor_p };
frame->AddConsumer(2, input, writer, "1.0s");
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();
Sleep(2000);
ssi_strcpy(e_class.ptr, "B");
board->update(e_class);
Sleep(2000);
ssi_strcpy(e_class.ptr, "A");
board->update(e_class);
Sleep(2000);
ssi_strcpy(e_class.ptr, "");
board->update(e_class);
frame->Wait();
frame->Stop();
board->Stop();
frame->Clear();
board->Clear();
return true;
}
示例13: 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();
//.........这里部分代码省略.........
示例14: 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;
}
示例15: 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();
}