Moved defines to defines.h
Work on sigsev alt init media library without path, not fixed yet.
This commit is contained in:
parent
7616d963fa
commit
87e1a22e47
13 changed files with 108 additions and 65 deletions
|
@ -2,19 +2,36 @@
|
|||
|
||||
AudioMasterWidget::AudioMasterWidget(QWidget *parent) :
|
||||
QGroupBox(parent)
|
||||
, m_file(new QLabel)
|
||||
, m_folder(new QLabel)
|
||||
, m_vol(new QSlider)
|
||||
, m_mute(new QCheckBox)
|
||||
, m_status(new QLabel)
|
||||
, m_receiveDMX(new QCheckBox)
|
||||
, m_watchDMX(new QTimer)
|
||||
{
|
||||
status = new QLabel(this);
|
||||
vol = new QSlider(this);
|
||||
mute = new QCheckBox(this);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
vbox->addWidget(status);
|
||||
vbox->addWidget(vol);
|
||||
vbox->addWidget(mute);
|
||||
// vbox->addWidget(status);
|
||||
// vbox->addWidget(vol);
|
||||
// vbox->addWidget(mute);
|
||||
vbox->addWidget(m_receiveDMX);
|
||||
this->setLayout(vbox);
|
||||
connect(m_watchDMX, SIGNAL(timeout()),
|
||||
this, SLOT(watchDMXExpired()));
|
||||
m_watchDMX->start(1000);
|
||||
|
||||
}
|
||||
|
||||
AudioMasterWidget::~AudioMasterWidget()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AudioMasterWidget::watchDMXExpired() {
|
||||
m_receiveDMX->setChecked(false);
|
||||
}
|
||||
|
||||
void AudioMasterWidget::updateWatchDMX()
|
||||
{
|
||||
m_receiveDMX->setChecked(true);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#ifndef AUDIOMASTERWIDGET_H
|
||||
#define AUDIOMASTERWIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QtGui>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <QCheckBox>
|
||||
|
||||
//#include "ui_audiomasterwidget.h"
|
||||
|
||||
|
@ -20,13 +22,22 @@ public:
|
|||
|
||||
~AudioMasterWidget();
|
||||
|
||||
private:
|
||||
public slots:
|
||||
void updateWatchDMX();
|
||||
|
||||
private:
|
||||
QLabel *m_file;
|
||||
QLabel *m_folder;
|
||||
QSlider *m_vol;
|
||||
QCheckBox *m_mute;
|
||||
QLabel *m_status;
|
||||
QCheckBox *m_receiveDMX;
|
||||
QTimer *m_watchDMX;
|
||||
|
||||
private slots:
|
||||
void watchDMXExpired();
|
||||
|
||||
|
||||
QLabel *file;
|
||||
QLabel *folder;
|
||||
QSlider *vol;
|
||||
QCheckBox *mute;
|
||||
QLabel *status;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
#include <QChar>
|
||||
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
#define PDPORT 9198
|
||||
#define SOCKET 9197 // "/tmp/socket"
|
||||
#include "defines.h"
|
||||
|
||||
class AudioMotor : public QObject
|
||||
{
|
||||
|
|
|
@ -28,4 +28,3 @@ void AudioWidget::volChanged(int layer, int vol) {
|
|||
<< "Vol : " << vol;*/
|
||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setVol(vol);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,38 @@
|
|||
|
||||
#define LAYERS_NUMBER 3
|
||||
|
||||
// Ports tcp to comunicate with Pure Data
|
||||
#define PDPORT 9198
|
||||
#define SOCKET 9197 // "/tmp/socket"
|
||||
|
||||
#define VERSION "Libre Media Server Audio 0.1.0"
|
||||
#define COPYRIGHT "(C) 2014 Santi Norena libremediaserver@gmail.com"
|
||||
#define LICENSE "GPL 3 License. See LICENSE.txt and credits.txt for details"
|
||||
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
int address;
|
||||
uint universe;
|
||||
bool updated;
|
||||
int layer;
|
||||
};
|
||||
|
||||
// Media Information for MELIn packages. v1.0
|
||||
struct MediaFile {
|
||||
quint8 Number; // 0-based contiguous index of the media.
|
||||
QString MediaName;// Media name.
|
||||
quint32 MediaLength;// Media length (in frames).
|
||||
};
|
||||
|
||||
// Media Library for ELin packages v1.0
|
||||
struct MediaFolder {
|
||||
quint8 m_Id; // Library id.
|
||||
QString m_Name;// Library name.
|
||||
quint8 m_ElementCount;// Number of elements in the library.
|
||||
QList<MediaFile> m_MediaInformation; // Pointer to the Medias Information List of this Library
|
||||
};
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
||||
|
|
|
@ -45,27 +45,19 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
bottomWidget->setWidget(textEdit);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, bottomWidget);
|
||||
|
||||
// Inicia la lectura de dmx a través de ola
|
||||
ola = new olaThread();
|
||||
Q_CHECK_PTR(ola);
|
||||
connect(ola, SIGNAL(toTerminal(QString)),
|
||||
this, SLOT(toTerminal(QString)));
|
||||
ola->start(QThread::TimeCriticalPriority );
|
||||
ola->blockSignals(true);
|
||||
|
||||
// Inicia el widget central de audio
|
||||
|
||||
aw = new AudioWidget(this);
|
||||
setCentralWidget(aw);
|
||||
|
||||
// Inicia el widget Master. No implementado todavía
|
||||
/*
|
||||
|
||||
amw = new AudioMasterWidget(this);
|
||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||
topWidget->setWidget(amw);
|
||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||
*/
|
||||
|
||||
// Parse the command line options
|
||||
if (args.contains("-gui"))
|
||||
{
|
||||
|
@ -90,8 +82,13 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
|
||||
Settings *set = new Settings();
|
||||
|
||||
// Iniciamos Pure Data
|
||||
AudioMotor::getInstance()->init();
|
||||
// Inicia la lectura de dmx a través de ola
|
||||
ola = new olaThread();
|
||||
Q_CHECK_PTR(ola);
|
||||
connect(ola, SIGNAL(toTerminal(QString)),
|
||||
this, SLOT(toTerminal(QString)));
|
||||
ola->start(QThread::TimeCriticalPriority );
|
||||
ola->blockSignals(true);
|
||||
|
||||
connect(set, SIGNAL( layersNumber(int)),
|
||||
ola, SLOT( setLayersNumber(int)));
|
||||
|
@ -99,6 +96,12 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
connect(set, SIGNAL( DMXConf(dmxSetting ) ),
|
||||
ola, SLOT( setDMXConf(dmxSetting) ) );
|
||||
|
||||
// Lee la configuración por defecto
|
||||
set->readDefaultFile();
|
||||
|
||||
// Iniciamos Pure Data
|
||||
AudioMotor::getInstance()->init();
|
||||
|
||||
connect(AudioMotor::getInstance(), SIGNAL(mediaLoaded(int, QString, QString)),
|
||||
aw, SLOT(mediaLoaded(int, QString, QString)));
|
||||
|
||||
|
@ -111,8 +114,9 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
|||
connect(ola, SIGNAL( dmxOutput(int, int, int) ),
|
||||
this, SLOT( dmxInput(int, int, int) ) );
|
||||
|
||||
// Lee la configuración por defecto
|
||||
set->readDefaultFile();
|
||||
connect(ola, SIGNAL(universeReceived(uint)),
|
||||
amw, SLOT(updateWatchDMX()));
|
||||
|
||||
ola->blockSignals(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,10 @@
|
|||
#include "audiolayerwidget.h"
|
||||
#include "audiomasterwidget.h"
|
||||
#include "audiowidget.h"
|
||||
#include "defines.h"
|
||||
|
||||
#include "ui_libremediaserver-audio.h"
|
||||
|
||||
#define VERSION "Libre Media Server Audio 0.1.0"
|
||||
#define COPYRIGHT "(C) 2014 Santi Norena libremediaserver@gmail.com"
|
||||
#define LICENSE "GPL 3 License. See LICENSE.txt and credits.txt for details"
|
||||
|
||||
class QMenu;
|
||||
//class QProcess;
|
||||
|
||||
|
@ -72,7 +69,7 @@ private:
|
|||
|
||||
QTextEdit *textEdit; // Terminal de feedback
|
||||
AudioMasterWidget *amw;
|
||||
// AudioLayerWidget *alw;
|
||||
|
||||
AudioWidget *aw;
|
||||
|
||||
olaThread *ola;
|
||||
|
|
|
@ -14,6 +14,8 @@ MediaLibrary *MediaLibrary::getInstance() {
|
|||
|
||||
MediaLibrary::MediaLibrary(QObject *parent) :
|
||||
QObject(parent)
|
||||
,m_media(new QList<MediaFolder>)
|
||||
, m_pathmedia()
|
||||
{
|
||||
initMediaLibrary();
|
||||
qDebug("Init MediaLibrary");
|
||||
|
@ -30,7 +32,7 @@ void MediaLibrary::initMediaLibrary() {
|
|||
qWarning(m_pathmedia.toAscii().constData());
|
||||
return;
|
||||
}
|
||||
m_media = new QList<MediaFolder>;
|
||||
// m_media = new QList<MediaFolder>;
|
||||
dir.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
|
||||
QFileInfoList filelist = dir.entryInfoList();
|
||||
dir.setFilter(QDir::Files);
|
||||
|
@ -76,6 +78,10 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
|||
|
||||
QString MediaLibrary::requestNewFile(int folder, int file){
|
||||
// Select one mediafile from the media library
|
||||
if (m_pathmedia.isNull()) {
|
||||
qWarning("Path not set yet");
|
||||
return NULL;
|
||||
}
|
||||
QString newfile;
|
||||
if (folder < m_media->size()) {
|
||||
if (file < m_media->at(folder).m_MediaInformation.size()) {
|
||||
|
|
|
@ -4,21 +4,7 @@
|
|||
#include <QObject>
|
||||
#include <QDir>
|
||||
|
||||
// Media Information for MELIn packages. v1.0
|
||||
struct MediaFile {
|
||||
quint8 Number; // 0-based contiguous index of the media.
|
||||
QString MediaName;// Media name.
|
||||
quint32 MediaLength;// Media length (in frames).
|
||||
};
|
||||
|
||||
// Media Library for ELin packages v1.0
|
||||
struct MediaFolder {
|
||||
quint8 m_Id; // Library id.
|
||||
QString m_Name;// Library name.
|
||||
quint8 m_ElementCount;// Number of elements in the library.
|
||||
QList<MediaFile> m_MediaInformation; // Pointer to the Medias Information List of this Library
|
||||
};
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
class MediaLibrary : public QObject
|
||||
{
|
||||
|
|
|
@ -86,10 +86,10 @@ void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
|||
m_counter++;
|
||||
gettimeofday(&m_last_data, NULL);
|
||||
uint universe = data.universe;
|
||||
emit universeReceived(universe);
|
||||
for (int i = 0; i < m_layersNumber; i++) { // loop for reading the channels by layer.
|
||||
if((m_settings.at(i).universe == universe)
|
||||
&& ( m_settings.at(i).address > -1 )) { // Compare if the layer is from this universe
|
||||
// AND if the DMX address is 0 or greater, process this layer.
|
||||
&& ( m_settings.at(i).address > -1 )) { // Compare if the layer is from this universe AND if the DMX address is 0 or greater, process this layer.
|
||||
for (int j = 0; j < LAYER_CHANNELS; j++){
|
||||
int value = buffer.Get((m_settings.at(i).address) + j); // Get the value for this channel.
|
||||
if (m_dmx[i][j] != value) { // Compare the new value with the old value.
|
||||
|
|
|
@ -17,14 +17,6 @@
|
|||
#include "defines.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
int address;
|
||||
uint universe;
|
||||
bool updated;
|
||||
int layer;
|
||||
};
|
||||
|
||||
class olaThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -121,6 +113,7 @@ signals:
|
|||
void finished(); // Signal for closing. Not used now.
|
||||
void dmxOutput(int layer, int channel, int value); // Signal when a channel has changed
|
||||
void toTerminal(QString message);
|
||||
void universeReceived(uint universe);
|
||||
};
|
||||
|
||||
#endif // OLATHREAD_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Settings::Settings(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
readDefaultFile();
|
||||
// readDefaultFile();
|
||||
}
|
||||
|
||||
// Read the dmx settings for dmx.xml At the moment we need:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "audiomotor.h"
|
||||
#include "medialibrary.h"
|
||||
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue