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

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

Fixed: GCC compilation problems with shared_ptr.

  • 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{
22}
23
24DbtPlyTrigger::~DbtPlyTrigger()
25{
26}
27
28void DbtPlyTrigger::addInputs()
29{
30 // empty: no inputs
31}
32
33void DbtPlyTrigger::addOutputs()
34{
35 // empty: no outputs
36}
37
38ComponentBase::COMPONENT_CONFIGURATION DbtPlyTrigger::configureComponent(XmlComponentConfig /*config*/)
39{
40 using boost::dynamic_pointer_cast;
41
42 ComponentManager * mgr = ComponentManager::getInstance();
43 // we get a pointer to the engine component
44 mEngine = dynamic_pointer_cast<DbtPlyEngine>(mgr->getComponent("dbiteEngine"));
45 if (!mEngine) {
46 LOG_FATAL("cannot get a pointer of the 'dbiteEngine' component");
47 return CONFIGURED_FAILED;
48 }
49 QObject::connect(this, SIGNAL(triggerSig()),
50 mEngine.get(), SLOT(engReceiver()),
51 Qt::DirectConnection);
52
53 return CONFIGURED_OK;
54}
55
56void DbtPlyTrigger::startActivity()
57{
58 start();
59}
60
61void DbtPlyTrigger::stopActivity()
62{
63}
64
65// The thread is started when the user press the play button
66void DbtPlyTrigger::run()
67{
68#ifdef WIN32
69 timeBeginPeriod(1);
70#endif
71
72 while(isActive()) {
73 if (mEngine->isPlaying()) {
74 Q_EMIT triggerSig();
75 }
76 msleep(1);
77 }
78
79#ifdef WIN32
80 timeEndPeriod(1);
81#endif
82}
83
84} // namespace pacpus
Note: See TracBrowser for help on using the repository browser.