diff --git a/test/Windows.cpp b/test/Windows.cpp index 126d862..929264d 100644 --- a/test/Windows.cpp +++ b/test/Windows.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,7 @@ appl::Windows::Windows() { } void appl::Windows::init() { + ewol::widget::Windows::init(); setTitle("example 001_HelloWord"); std::string composition = std::string(""); composition += "\n"; @@ -53,88 +55,86 @@ void appl::Windows::init() { return; } setSubWidget(m_composer); - m_composer->registerOnEventNameWidget(shared_from_this(), "bt-play1", "pressed", g_eventPlay1); - m_composer->registerOnEventNameWidget(shared_from_this(), "bt-play2", "pressed", g_eventPlay2); + composerBind(ewol::widget::Button, "bt-play1", signalPressed, shared_from_this(), &appl::Windows::onCallbackPlay); + composerBind(ewol::widget::Button, "bt-play2", signalPressed, shared_from_this(), &appl::Windows::onCallbackStop); } eaudiofx::Processing* process = NULL; -void appl::Windows::onReceiveMessage(const ewol::object::Message& _msg) { - if (_msg.getMessage() == g_eventPlay1) { - #if 0 - APPL_INFO("Play Requested ..."); - process = new eaudiofx::Processing(); - if (process == NULL) { - APPL_ERROR("can not create processing ..."); - return; - } - APPL_INFO("Create Generator ..."); - eaudiofx::GeneratorSignal* generator = new eaudiofx::GeneratorSignal(); - if (generator == NULL) { - APPL_ERROR("can not create Generator ..."); - return; - } - generator->setName("myGenerator"); - process->addBlock(generator); - APPL_INFO("Create Receiver ..."); - eaudiofx::ReceiverRtAudio* receiver = new eaudiofx::ReceiverRtAudio(); - if (receiver == NULL) { - APPL_ERROR("can not create Receiver ..."); - return; - } - receiver->setName("myReceiver"); - process->addBlock(receiver); - - process->linkBlock("myGenerator", "out","myReceiver", "in"); - - process->start(); +void appl::Windows::onCallbackPlay() { + #if 0 + APPL_INFO("Play Requested ..."); + process = new eaudiofx::Processing(); + if (process == NULL) { + APPL_ERROR("can not create processing ..."); return; - #else - APPL_INFO("Play Requested ..."); - process = new eaudiofx::Processing(); - if (process == NULL) { - APPL_ERROR("can not create processing ..."); - return; - } - APPL_INFO("Create Generator ..."); - eaudiofx::GeneratorFile* generator = new eaudiofx::GeneratorFile(); - if (generator == NULL) { - APPL_ERROR("can not create Generator ..."); - return; - } - generator->setName("myGenerator"); - process->addBlock(generator); - - APPL_INFO("Create DECODER ..."); - eaudiofx::BlockDecoder* decoder = new eaudiofx::BlockDecoder(); - if (decoder == NULL) { - APPL_ERROR("can not create Generator ..."); - return; - } - decoder->setName("myDecoder"); - process->addBlock(decoder); - - APPL_INFO("Create Receiver ..."); - eaudiofx::ReceiverRtAudio* receiver = new eaudiofx::ReceiverRtAudio(); - 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; - #endif - } - if (_msg.getMessage() == g_eventPlay2) { - if (process != NULL) { - process->stop(); } + APPL_INFO("Create Generator ..."); + eaudiofx::GeneratorSignal* generator = new eaudiofx::GeneratorSignal(); + if (generator == NULL) { + APPL_ERROR("can not create Generator ..."); + return; + } + generator->setName("myGenerator"); + process->addBlock(generator); + APPL_INFO("Create Receiver ..."); + eaudiofx::ReceiverRtAudio* receiver = new eaudiofx::ReceiverRtAudio(); + 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; + #else + APPL_INFO("Play Requested ..."); + process = new eaudiofx::Processing(); + if (process == NULL) { + APPL_ERROR("can not create processing ..."); + return; + } + APPL_INFO("Create Generator ..."); + eaudiofx::GeneratorFile* generator = new eaudiofx::GeneratorFile(); + if (generator == NULL) { + APPL_ERROR("can not create Generator ..."); + return; + } + generator->setName("myGenerator"); + process->addBlock(generator); + + APPL_INFO("Create DECODER ..."); + eaudiofx::BlockDecoder* decoder = new eaudiofx::BlockDecoder(); + if (decoder == NULL) { + APPL_ERROR("can not create Generator ..."); + return; + } + decoder->setName("myDecoder"); + process->addBlock(decoder); + + APPL_INFO("Create Receiver ..."); + eaudiofx::ReceiverRtAudio* receiver = new eaudiofx::ReceiverRtAudio(); + 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; + #endif +} + +void appl::Windows::onCallbackStop() { + if (process != NULL) { + process->stop(); } } diff --git a/test/Windows.h b/test/Windows.h index 0bbe533..8b86b88 100644 --- a/test/Windows.h +++ b/test/Windows.h @@ -21,8 +21,10 @@ namespace appl { void init(); public: DECLARE_FACTORY(Windows); - public: // herited functions - virtual void onReceiveMessage(const ewol::object::Message& _msg); + public: // callback functions + void onCallbackPlay(); + void onCallbackStop(); + }; };