source: pacpusframework/trunk/src/DBITEPlayerLib/DbtPlyTrigger.cpp@ 290

Last change on this file since 290 was 290, checked in by Marek Kurdej, 10 years ago

Some clean-up.

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @version $Id: DbtPlyTrigger.cpp 76 2013-01-10 17:05:10Z kurdejma $
6
7#include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
8
9#include <Pacpus/kernel/ComponentManager.h>
10#include <Pacpus/kernel/Log.h>
11
12namespace pacpus {
13
14DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyTrigger");
15
16// Construction de la fabrique de composant DbtPlyTrigger
17//static ComponentFactory<DbtPlyTrigger> factory("DbtPlyTrigger");
18
19DbtPlyTrigger::DbtPlyTrigger(QString name)
20 : ComponentBase(name)
21 , mEngine(NULL)
22{
23}
24
25DbtPlyTrigger::~DbtPlyTrigger()
26{
27}
28
29void DbtPlyTrigger::addInputs()
30{
31 // empty: no inputs
32}
33
34void DbtPlyTrigger::addOutputs()
35{
36 // empty: no outputs
37}
38
39ComponentBase::COMPONENT_CONFIGURATION DbtPlyTrigger::configureComponent(XmlComponentConfig /*config*/)
40{
41 using boost::dynamic_pointer_cast;
42
43 ComponentManager * mgr = ComponentManager::getInstance();
44 // we get a pointer to the engine component
45 mEngine = dynamic_pointer_cast<DbtPlyEngine>(mgr->getComponent("dbiteEngine"));
46 if (!mEngine) {
47 LOG_FATAL("cannot get a pointer of the 'dbiteEngine' component");
48 return CONFIGURED_FAILED;
49 }
50 QObject::connect(this, SIGNAL(triggerSig()),
51 mEngine.get(), SLOT(engReceiver()),
52 Qt::DirectConnection);
53
54 return CONFIGURED_OK;
55}
56
57void DbtPlyTrigger::startActivity()
58{
59 start();
60}
61
62void DbtPlyTrigger::stopActivity()
63{
64}
65
66// The thread is started when the user press the play button
67void DbtPlyTrigger::run()
68{
69#ifdef WIN32
70 timeBeginPeriod(1);
71#endif
72
73 while(isActive()) {
74 if (mEngine->isPlaying()) {
75 Q_EMIT triggerSig();
76 }
77 msleep(1);
78 }
79
80#ifdef WIN32
81 timeEndPeriod(1);
82#endif
83}
84
85} // namespace pacpus
Note: See TracBrowser for help on using the repository browser.