/** * @author Edouard DUPIN * * @copyright 2010, Edouard DUPIN, all right reserved * * @license BSD 3 clauses (see license file) */ #include #include #include #include #include #include #include #include #include #include #undef __class__ #define __class__ "Windows" static const char* const g_eventPlay1 = "appl-play-1"; static const char* const g_eventPlay2 = "appl-play-2"; appl::Windows::Windows() { addObjectType("appl::Windows"); } void appl::Windows::init() { ewol::widget::Windows::init(); setTitle("example 001_HelloWord"); std::string composition = std::string(""); composition += "\n"; composition += " \n"; composition += " \n"; composition += " \n"; composition += " \n"; composition += " \n"; composition += " \n"; composition += "\n"; m_composer = ewol::widget::Composer::create(ewol::widget::Composer::String, composition); if (m_composer == NULL) { APPL_CRITICAL(" An error occured ... in the windows creatrion ..."); return; } setSubWidget(m_composer); subBind(ewol::widget::Button, "bt-play1", signalPressed, shared_from_this(), &appl::Windows::onCallbackPlay); subBind(ewol::widget::Button, "bt-stop1", signalPressed, shared_from_this(), &appl::Windows::onCallbackStop); subBind(ewol::widget::Button, "bt-play-stop", signalPressed, shared_from_this(), &appl::Windows::onCallbackPlayStop); } std::shared_ptr process = NULL; void appl::Windows::onCallbackPlayStop() { onCallbackPlay(); usleep(500000); onCallbackStop(); } void appl::Windows::onCallbackPlay() { #if 0 APPL_INFO("Play Requested ..."); process = eaudiofx::Processing::create(); if (process == NULL) { APPL_ERROR("can not create processing ..."); return; } APPL_INFO("Create Generator ..."); std::shared_ptr generator = eaudiofx::GeneratorFile::create(); if (generator == NULL) { APPL_ERROR("can not create Generator ..."); return; } generator->setName("myGenerator"); process->addBlock(generator); APPL_INFO("Create DECODER ..."); std::shared_ptr decoder = eaudiofx::BlockDecoder::create(); if (decoder == NULL) { APPL_ERROR("can not create Generator ..."); return; } decoder->setName("myDecoder"); process->addBlock(decoder); APPL_INFO("Create Receiver ..."); std::shared_ptr receiver = eaudiofx::ReceiverRtAudio::create(); if (receiver == NULL) { APPL_ERROR("can not create Receiver ..."); return; } receiver->setName("myReceiver"); process->addBlock(receiver); process->linkBlock("myGenerator", "out","myDecoder", "in"); process->linkBlock("myDecoder", "out","myReceiver", "in"); process->start(); return; #else APPL_INFO("Play Requested ..."); process = eaudiofx::Processing::create(); if (process == NULL) { APPL_ERROR("can not create processing ..."); return; } process->setName("main Process"); APPL_INFO("Create Generator Sinus"); std::shared_ptr generator = eaudiofx::GeneratorSignal::create(); if (generator == NULL) { APPL_ERROR("can not create Generator ..."); return; } generator->setName("myGenerator"); process->addBlock(generator); APPL_INFO("Create Receiver ..."); std::shared_ptr receiver = eaudiofx::ReceiverRiver::create(); if (receiver == NULL) { APPL_ERROR("can not create Receiver ..."); return; } receiver->setName("myReceiver"); process->addBlock(receiver); process->linkBlock("myGenerator", "out","myReceiver", "in"); process->start(); return; #endif } void appl::Windows::onCallbackStop() { if (process != NULL) { process->stop(); } }