Added a DMX watchdog. Changed the play methos, now play reset to 0 and stop not.

This commit is contained in:
santi 2014-07-12 21:53:07 +02:00
parent a6909f8c16
commit 69ffe79742
13 changed files with 276 additions and 154 deletions

View file

@ -33,14 +33,21 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
Q_UNUSED(args);
ui.setupUi(this);
// Inicia el widget Terminal
textEdit = new QTextEdit;
textEdit->setReadOnly(true);
QDockWidget *bottomWidget = new QDockWidget(tr("Terminal"), this);
bottomWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
bottomWidget->setWidget(textEdit);
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
// Inicia la lectura de dmx a través de ola
ola = new olaThread();
Q_CHECK_PTR(ola);
if (args.contains("-log")) {
// Inicia el widget Terminal
textEdit = new QTextEdit;
textEdit->setReadOnly(true);
QDockWidget *bottomWidget = new QDockWidget(tr("Terminal"), this);
bottomWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
bottomWidget->setWidget(textEdit);
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
connect(ola, SIGNAL(toTerminal(QString)),
textEdit, SLOT(append(QString)), Qt::QueuedConnection);
}
this->setWindowTitle(VERSION);
// qDebug() << QDate::currentDate().toString() << " "<< QTime::currentTime().toString();
@ -52,13 +59,7 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
aw = new AudioWidget(this);
setCentralWidget(aw);
// Inicia la lectura de dmx a través de ola
ola = new olaThread();
Q_CHECK_PTR(ola);
connect(ola, SIGNAL(toTerminal(QString)),
textEdit, SLOT(append(QString)), Qt::QueuedConnection);
// Inicia la lectur de datos DMX
ola->blockSignals(true);
ola->start(QThread::TimeCriticalPriority );
@ -88,13 +89,14 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
ola, SLOT( setLayersNumber(int)));
connect(set, SIGNAL( DMXConf(dmxSetting ) ),
ola, SLOT( setDMXConf(dmxSetting) ) );
connect(ola, SIGNAL( dmxOutput(int, int, int) ),
this, SLOT( dmxInput(int, int, int) ) );
connect(ola, SIGNAL (layerReceived(int)),
aw, SLOT(layerReceived(int)));
// Lee la configuración por defecto
set->readDefaultFile();
ola->blockSignals(false);
connect(ola, SIGNAL( dmxOutput(int, int, int) ),
this, SLOT( dmxInput(int, int, int) ) );
ola->resendDmx();
}
@ -173,6 +175,8 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
{
// This qDebug slows all the program. Uncomment only for debugging purpouse and comment again in normal use
// qDebug() << tr("olaInterface|") << "newdmx layer" << layer << "channel" << channel << "value" << value;
if (layer > LAYER_CHANNELS)
return;
QString mediaFile = NULL;
int aux;
qreal f;
@ -201,6 +205,8 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
f = (float)value / 255;
break;
case PLAYBACK:
if (value == 0)
break;
aux = value / 25;
switch (aux) {
case 0 :