[DEV] update to new binding

This commit is contained in:
Edouard DUPIN 2014-08-22 23:30:19 +02:00
parent 69e1259b27
commit e1e95e46e0
2 changed files with 79 additions and 77 deletions

View File

@ -12,6 +12,7 @@
#include <ewol/widget/Label.h>
#include <etk/tool.h>
#include <eaudiofx/eaudiofx.h>
#include <ewol/widget/Button.h>
#include <eaudiofx/base/GeneratorFile.h>
#include <eaudiofx/core/BlockDecoder.h>
@ -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 += "<sizer mode='vert'>\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();
}
}

View File

@ -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();
};
};