limpieza código no usado e includes
This commit is contained in:
parent
3613d8fa51
commit
66c2850e06
19 changed files with 83 additions and 338 deletions
|
@ -12,8 +12,6 @@ HEADERS += src/libremediaserver-audio.h \
|
||||||
src/audiowidget.h \
|
src/audiowidget.h \
|
||||||
src/defines.h \
|
src/defines.h \
|
||||||
src/settings.h \
|
src/settings.h \
|
||||||
src/settingsdialog.h \
|
|
||||||
src/layersettingswidget.h \
|
|
||||||
src/slidergroup.h
|
src/slidergroup.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/dmxwidget.cpp \
|
src/dmxwidget.cpp \
|
||||||
|
@ -25,12 +23,8 @@ SOURCES += src/main.cpp \
|
||||||
src/audiolayerwidget.cpp \
|
src/audiolayerwidget.cpp \
|
||||||
src/audiowidget.cpp \
|
src/audiowidget.cpp \
|
||||||
src/settings.cpp \
|
src/settings.cpp \
|
||||||
src/settingsdialog.cpp \
|
|
||||||
src/layersettingswidget.cpp \
|
|
||||||
src/slidergroup.cpp
|
src/slidergroup.cpp
|
||||||
FORMS += src/libremediaserver-audio.ui \
|
FORMS += src/libremediaserver-audio.ui
|
||||||
src/settingsdialog.ui \
|
|
||||||
src/layersettingswidget.ui
|
|
||||||
CCFLAG += -msse2 -mavx2 #-fsanitize=address -g -O0
|
CCFLAG += -msse2 -mavx2 #-fsanitize=address -g -O0
|
||||||
QMAKE_CXXFLAGS += $$(CXXFLAG)
|
QMAKE_CXXFLAGS += $$(CXXFLAG)
|
||||||
#QMAKE_CXXFLAGS += -fsanitize=address -g -O0
|
#QMAKE_CXXFLAGS += -fsanitize=address -g -O0
|
||||||
|
|
|
@ -1,20 +1,9 @@
|
||||||
#ifndef AUDIOLAYERWIDGET_H
|
#ifndef AUDIOLAYERWIDGET_H
|
||||||
#define AUDIOLAYERWIDGET_H
|
#define AUDIOLAYERWIDGET_H
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QTime>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSlider>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QTimeEdit>
|
#include <QTimeEdit>
|
||||||
#include <QGroupBox>
|
#include <QLabel>
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QSpinBox>
|
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "slidergroup.h"
|
#include "slidergroup.h"
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
#ifndef AUDIOWIDGET_H
|
#ifndef AUDIOWIDGET_H
|
||||||
#define AUDIOWIDGET_H
|
#define AUDIOWIDGET_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
#include "dmxwidget.h"
|
|
||||||
#include "audiolayerwidget.h"
|
#include "audiolayerwidget.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "miniaudioengine.h"
|
#include "miniaudioengine.h"
|
||||||
#include "defines.h"
|
#include "defines.h" // MAX_LAYERS
|
||||||
|
|
||||||
|
|
||||||
class AudioWidget : public QWidget
|
class AudioWidget : public QWidget
|
||||||
{
|
{
|
||||||
friend class libreMediaServerAudio;
|
|
||||||
friend class AudioLayerWidget;
|
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -24,8 +17,6 @@ public:
|
||||||
bool startEngine();
|
bool startEngine();
|
||||||
bool startEngine(int id);
|
bool startEngine(int id);
|
||||||
void stopEngine();
|
void stopEngine();
|
||||||
|
|
||||||
protected:
|
|
||||||
void mediaLoaded(int layer, QString media );
|
void mediaLoaded(int layer, QString media );
|
||||||
void volChanged(int layer, float vol);
|
void volChanged(int layer, float vol);
|
||||||
void panChanged(int layer, int pan);
|
void panChanged(int layer, int pan);
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
#ifndef DEFINES_H
|
#ifndef DEFINES_H
|
||||||
#define DEFINES_H
|
#define DEFINES_H
|
||||||
|
|
||||||
#include <QString>
|
//#define VERSION "LibreMediaServerAudio 0.2.0 Antigona Release"
|
||||||
#include <QList>
|
#define VERSION "Kike Substitutor - No AI required - v0.2.0"
|
||||||
#include <QtGlobal>
|
#define COPYRIGHT "(C) 2014-2024 Santi Noreña <lms@criptomart.net>"
|
||||||
|
#define LICENSE "GPL 3 Licensed. See LICENSE.txt.\nSound guys are not allowed to use this software."
|
||||||
#define VERSION "LibreMediaServerAudio 0.2.0 Antigona Release"
|
|
||||||
#define COPYRIGHT "(C) 2014-2024 Santi Norena lms@criptomart.net"
|
|
||||||
#define LICENSE "GPL 3 License. See LICENSE.txt and credits.txt for details"
|
|
||||||
#define DEFAULT_FILE "lms-audio.xlm"
|
#define DEFAULT_FILE "lms-audio.xlm"
|
||||||
#define MAX_LAYERS 16
|
#define MAX_LAYERS 16
|
||||||
#define UI_REFRESH_TIME 200
|
#define UI_REFRESH_TIME 200
|
||||||
|
@ -15,26 +12,10 @@
|
||||||
// struct where save the DMX settings for each layer
|
// struct where save the DMX settings for each layer
|
||||||
struct dmxSetting {
|
struct dmxSetting {
|
||||||
int address;
|
int address;
|
||||||
quint8 universe;
|
unsigned int universe;
|
||||||
bool updated;
|
|
||||||
int layer;
|
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
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
Stopped,
|
Stopped,
|
||||||
|
@ -49,7 +30,7 @@ static const char* StatusStr[] =
|
||||||
"Pause",
|
"Pause",
|
||||||
"Playing One",
|
"Playing One",
|
||||||
"Playing Loop",
|
"Playing Loop",
|
||||||
NULL
|
0x0
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Slider
|
enum Slider
|
||||||
|
|
|
@ -7,7 +7,7 @@ dmxWidget::dmxWidget(QWidget *parent) :
|
||||||
{
|
{
|
||||||
this->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
this->setFocusPolicy(Qt::FocusPolicy::NoFocus);
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
QVBoxLayout *vbox = new QVBoxLayout;
|
||||||
m_receiveDMX->setText("DMX signal");
|
m_receiveDMX->setText("DMX Signal");
|
||||||
vbox->addWidget(m_receiveDMX);
|
vbox->addWidget(m_receiveDMX);
|
||||||
this->setLayout(vbox);
|
this->setLayout(vbox);
|
||||||
connect(m_watchDMX, SIGNAL(timeout()),
|
connect(m_watchDMX, SIGNAL(timeout()),
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
#ifndef DMXWIDGET_H
|
#ifndef DMXWIDGET_H
|
||||||
#define DMXWIDGET_H
|
#define DMXWIDGET_H
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QTimer>
|
||||||
|
|
||||||
class dmxWidget : public QGroupBox
|
class dmxWidget : public QGroupBox
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,73 +25,40 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
Q_UNUSED(args);
|
Q_UNUSED(args);
|
||||||
|
qDebug() << VERSION;
|
||||||
|
qDebug() << COPYRIGHT;
|
||||||
|
qDebug() << LICENSE;
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
this->setWindowTitle(VERSION);
|
this->setWindowTitle(VERSION);
|
||||||
Settings *set = Settings::getInstance();
|
Settings *set = Settings::getInstance();
|
||||||
set->readFile();
|
set->readFile();
|
||||||
connect(set, SIGNAL(audioDeviceChanged(int)), this, SLOT(audioDeviceChanged(int)));
|
m_mediaLibrary = new MediaLibrary;
|
||||||
this->setWindowTitle(VERSION);
|
m_mediaLibrary->initMediaLibrary();
|
||||||
qDebug() << VERSION;
|
m_aw = new AudioWidget;
|
||||||
qDebug() << COPYRIGHT;
|
setCentralWidget(m_aw);
|
||||||
qDebug() << LICENSE;
|
|
||||||
MediaLibrary::getInstance()->initMediaLibrary();
|
|
||||||
aw = new AudioWidget;
|
|
||||||
setCentralWidget(aw);
|
|
||||||
m_dmxWidget = new dmxWidget(this);
|
m_dmxWidget = new dmxWidget(this);
|
||||||
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
QDockWidget *topWidget = new QDockWidget(tr("Master"), this);
|
||||||
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
topWidget->setAllowedAreas(Qt::TopDockWidgetArea);
|
||||||
topWidget->setWidget(m_dmxWidget);
|
topWidget->setWidget(m_dmxWidget);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||||
ola = new olaThread(this, set->getLayersNumber());
|
m_ola = new olaThread(this, set->getLayersNumber());
|
||||||
Q_CHECK_PTR(ola);
|
Q_CHECK_PTR(m_ola);
|
||||||
ola->blockSignals(true);
|
m_ola->blockSignals(true);
|
||||||
connect(set, SIGNAL(registerUniverse(int)), ola, SLOT(registerUniverse(int)));
|
connect(m_ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
||||||
connect(ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
connect(m_ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
||||||
connect(ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
m_ola->registerUniverse();
|
||||||
ola->registerUniverse();
|
m_ola->start(QThread::TimeCriticalPriority );
|
||||||
ola->start(QThread::TimeCriticalPriority );
|
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||||
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
m_aw->startEngine();
|
||||||
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
|
||||||
connect(ui.action_Settings, SIGNAL(triggered()), this, SLOT(settings()));
|
|
||||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
|
||||||
aw->startEngine();
|
|
||||||
qDebug("Init Complete.");
|
qDebug("Init Complete.");
|
||||||
ola->blockSignals(false);
|
m_ola->blockSignals(false);
|
||||||
ola->resendDmx();
|
m_ola->resendDmx();
|
||||||
}
|
}
|
||||||
|
|
||||||
libreMediaServerAudio::~libreMediaServerAudio()
|
libreMediaServerAudio::~libreMediaServerAudio()
|
||||||
{
|
{
|
||||||
ola->stop();
|
m_ola->stop();
|
||||||
aw->stopEngine();
|
m_aw->stopEngine();
|
||||||
}
|
|
||||||
|
|
||||||
void libreMediaServerAudio::openFile()
|
|
||||||
{
|
|
||||||
QFileDialog dialog(this);
|
|
||||||
if (!dialog.exec())
|
|
||||||
return;
|
|
||||||
QStringList fileNames;
|
|
||||||
fileNames = dialog.selectedFiles();
|
|
||||||
QFile file(fileNames.at(0));
|
|
||||||
// open(&file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libreMediaServerAudio::saveFile()
|
|
||||||
{
|
|
||||||
QFileDialog dialog(this);
|
|
||||||
if (!dialog.exec())
|
|
||||||
return;
|
|
||||||
QStringList fileNames;
|
|
||||||
fileNames = dialog.selectedFiles();
|
|
||||||
QFile file(fileNames.at(0));
|
|
||||||
// save(&file);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libreMediaServerAudio::settings()
|
|
||||||
{
|
|
||||||
SettingsDialog *sd = new SettingsDialog();
|
|
||||||
sd->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void libreMediaServerAudio::olasetup()
|
void libreMediaServerAudio::olasetup()
|
||||||
|
@ -109,30 +76,30 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
int aux;
|
int aux;
|
||||||
switch(channel){
|
switch(channel){
|
||||||
case DMX_FOLDER:
|
case DMX_FOLDER:
|
||||||
aux = ola->getValue(layer, DMX_FILE);
|
aux = m_ola->getValue(layer, DMX_FILE);
|
||||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(value, aux);
|
mediaFile = m_mediaLibrary->requestNewFile(value, aux);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
aw->mediaLoaded(layer, mediaFile);
|
m_aw->mediaLoaded(layer, mediaFile);
|
||||||
break;
|
break;
|
||||||
case DMX_FILE:
|
case DMX_FILE:
|
||||||
aux = ola->getValue(layer, DMX_FOLDER);
|
aux = m_ola->getValue(layer, DMX_FOLDER);
|
||||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(aux, value);
|
mediaFile = m_mediaLibrary->requestNewFile(aux, value);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
aw->mediaLoaded(layer, mediaFile);
|
m_aw->mediaLoaded(layer, mediaFile);
|
||||||
break;
|
break;
|
||||||
case VOLUME_COARSE:
|
case VOLUME_COARSE:
|
||||||
case VOLUME_FINE:
|
case VOLUME_FINE:
|
||||||
aw->volChanged(layer, (value / 65025.0f));
|
m_aw->volChanged(layer, (value / 65025.0f));
|
||||||
break;
|
break;
|
||||||
case PAN:
|
case PAN:
|
||||||
aw->panChanged(layer, value);
|
m_aw->panChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case PITCH:
|
case PITCH:
|
||||||
aw->pitchChanged(layer, value);
|
m_aw->pitchChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case ENTRY_POINT_COARSE:
|
case ENTRY_POINT_COARSE:
|
||||||
case ENTRY_POINT_FINE:
|
case ENTRY_POINT_FINE:
|
||||||
aw->entryPointChanged(layer, value);
|
m_aw->entryPointChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case PLAYBACK:
|
case PLAYBACK:
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
@ -140,16 +107,16 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
aux = value / 25;
|
aux = value / 25;
|
||||||
switch (aux) {
|
switch (aux) {
|
||||||
case 0 :
|
case 0 :
|
||||||
aw->playbackChanged(layer, PlayingOnce);
|
m_aw->playbackChanged(layer, PlayingOnce);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
aw->playbackChanged(layer, Stopped);
|
m_aw->playbackChanged(layer, Stopped);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
aw->playbackChanged(layer, Paused);
|
m_aw->playbackChanged(layer, Paused);
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
aw->playbackChanged(layer, PlayingLoop);
|
m_aw->playbackChanged(layer, PlayingLoop);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
|
@ -158,9 +125,3 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void libreMediaServerAudio::audioDeviceChanged(int id)
|
|
||||||
{
|
|
||||||
aw->stopEngine();
|
|
||||||
aw->startEngine(id);
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,31 +20,17 @@
|
||||||
#ifndef LIBREMEDIASERVERAUDIO_H
|
#ifndef LIBREMEDIASERVERAUDIO_H
|
||||||
#define LIBREMEDIASERVERAUDIO_H
|
#define LIBREMEDIASERVERAUDIO_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QFile>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QTextStream>
|
|
||||||
#include <QWebView>
|
#include <QWebView>
|
||||||
#include <QApplication>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QString>
|
|
||||||
#include <QList>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#include "audiowidget.h"
|
#include "audiowidget.h"
|
||||||
#include "medialibrary.h"
|
#include "medialibrary.h"
|
||||||
#include "olathread.h"
|
#include "olathread.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "dmxwidget.h"
|
#include "dmxwidget.h"
|
||||||
#include "settingsdialog.h"
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
#include "ui_libremediaserver-audio.h"
|
#include "ui_libremediaserver-audio.h"
|
||||||
|
|
||||||
class QMenu;
|
|
||||||
|
|
||||||
class libreMediaServerAudio : public QMainWindow
|
class libreMediaServerAudio : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -55,25 +41,14 @@ public:
|
||||||
Ui::LibreMediaServerAudio ui;
|
Ui::LibreMediaServerAudio ui;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioWidget *aw;
|
AudioWidget *m_aw;
|
||||||
dmxWidget *m_dmxWidget;
|
dmxWidget *m_dmxWidget;
|
||||||
olaThread *ola;
|
olaThread *m_ola;
|
||||||
|
MediaLibrary *m_mediaLibrary;
|
||||||
void open_start();
|
|
||||||
void save_finish();
|
|
||||||
void open(QFile *file);
|
|
||||||
void save(QFile *file);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void audioDeviceChanged(int id);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void olasetup();
|
void olasetup();
|
||||||
void dmxInput(int layer, int channel, int value);
|
void dmxInput(int layer, int channel, int value);
|
||||||
void openFile();
|
|
||||||
void saveFile();
|
|
||||||
void settings();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIBREMEDIASERVERAUDIO_H
|
#endif // LIBREMEDIASERVERAUDIO_H
|
||||||
|
|
|
@ -28,18 +28,9 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionOpen_conf"/>
|
|
||||||
<addaction name="actionSave_conf"/>
|
|
||||||
<addaction name="action_Settings"/>
|
|
||||||
<addaction name="actionLaunch_OLA_Setup"/>
|
<addaction name="actionLaunch_OLA_Setup"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuHelp">
|
|
||||||
<property name="title">
|
|
||||||
<string>Help</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuHelp"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionExit">
|
<action name="actionExit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
#include "medialibrary.h"
|
#include "medialibrary.h"
|
||||||
|
|
||||||
MediaLibrary *MediaLibrary::_instance = 0;
|
|
||||||
|
|
||||||
MediaLibrary *MediaLibrary::getInstance() {
|
|
||||||
|
|
||||||
if (_instance == 0) {
|
|
||||||
_instance = new MediaLibrary();
|
|
||||||
Q_CHECK_PTR(_instance);
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
MediaLibrary::MediaLibrary(QObject *parent) :
|
MediaLibrary::MediaLibrary(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
|
|
|
@ -1,25 +1,32 @@
|
||||||
#ifndef MEDIALIBRARY_H
|
#ifndef MEDIALIBRARY_H
|
||||||
#define MEDIALIBRARY_H
|
#define MEDIALIBRARY_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
|
// 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
|
||||||
|
};
|
||||||
|
|
||||||
class MediaLibrary : public QObject
|
class MediaLibrary : public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
friend class libreMediaserverAudio; // Not working... WHY?
|
|
||||||
friend class Settings; // working...
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
MediaLibrary(QObject *parent = 0);
|
||||||
static MediaLibrary *getInstance();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief request a new file from the media library
|
* @brief request a new file from the media library
|
||||||
* @param int folder - the folder required
|
* @param int folder - the folder required
|
||||||
|
@ -27,43 +34,12 @@ public:
|
||||||
* @return QString the file required with full path
|
* @return QString the file required with full path
|
||||||
*/
|
*/
|
||||||
QString requestNewFile(int folder, int layer);
|
QString requestNewFile(int folder, int layer);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Inicia la biblioteca de medios
|
|
||||||
*/
|
|
||||||
void initMediaLibrary();
|
void initMediaLibrary();
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reload the media library on change of path or change the media files
|
|
||||||
*/
|
|
||||||
inline void rescanMediaLibrary() {
|
|
||||||
if (m_media != NULL)
|
|
||||||
delete m_media;
|
|
||||||
initMediaLibrary();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QList<MediaFolder> *m_media;
|
||||||
|
QList<MediaFile> getMediaInformation(QDir dir);
|
||||||
|
|
||||||
explicit MediaLibrary(QObject *parent = 0);
|
|
||||||
static MediaLibrary *_instance;
|
|
||||||
|
|
||||||
// Wich structure is more efficient for us?
|
|
||||||
// QList, QMap, QSet, QVector?
|
|
||||||
QList<MediaFolder> *m_media; // Library to save the folders/media libraries and index each media file inside
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns a list withe the medias contained in a folder
|
|
||||||
* @param QDir - the directory when are the media
|
|
||||||
* @return QList<MediaFile> The list with the medias in a folder
|
|
||||||
*/
|
|
||||||
QList<MediaFile> getMediaInformation(QDir dir); // Get all the information of each media file in a dir
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MEDIALIBRARY_H
|
#endif // MEDIALIBRARY_H
|
||||||
|
|
|
@ -183,15 +183,11 @@ ma_result MiniAudioEngine::printFormatInfo(int layer)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expects between 0 and 1 vol value in db
|
// Expects between 0 and 1 vol value
|
||||||
void MiniAudioEngine::volChanged(int layer, float vol)
|
void MiniAudioEngine::volChanged(int layer, float vol)
|
||||||
{
|
{
|
||||||
//float result;
|
|
||||||
|
|
||||||
if (m_mediaLoaded[layer] == false)
|
if (m_mediaLoaded[layer] == false)
|
||||||
return;
|
return;
|
||||||
//result = ma_volume_linear_to_db(1.00000000 + (vol / 8.0));
|
|
||||||
//qInfo("vol %f %f", vol, result);
|
|
||||||
ma_sound_group_set_volume(&m_currentSound[layer], vol);
|
ma_sound_group_set_volume(&m_currentSound[layer], vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#define MINIAUDIO_IMPLEMENTATION
|
||||||
#include "miniaudio.h"
|
#include "miniaudio.h"
|
||||||
#include "defines.h" //MAX_LAYERS
|
#include "defines.h" // MAX_LAYERS
|
||||||
#include <stdio.h> // for printf
|
#include <QDebug> // prints messages
|
||||||
|
|
||||||
class MiniAudioEngine
|
class MiniAudioEngine
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,27 +73,27 @@ void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
||||||
if (m_dmx[i.layer][j] != value) {
|
if (m_dmx[i.layer][j] != value) {
|
||||||
m_dmx[i.layer][j] = value;
|
m_dmx[i.layer][j] = value;
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case 0:
|
case VOLUME_COARSE:
|
||||||
value = (value * 0x100) + buffer.Get(i.address + 6);
|
value = (value * 0x100) + buffer.Get(i.address + VOLUME_FINE);
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
volSent = true;
|
volSent = true;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case ENTRY_POINT_COARSE:
|
||||||
value = (value * 0x100) + buffer.Get(i.address + 8);
|
value = (value * 0x100) + buffer.Get(i.address + ENTRY_POINT_FINE);
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
entrySent = true;
|
entrySent = true;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case VOLUME_FINE:
|
||||||
if (volSent == false)
|
if (volSent == false)
|
||||||
{
|
{
|
||||||
value = (buffer.Get(i.address) * 0x100) + value;
|
value = (buffer.Get(i.address + VOLUME_COARSE) * 0x100) + value;
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case ENTRY_POINT_FINE:
|
||||||
if (entrySent == false)
|
if (entrySent == false)
|
||||||
{
|
{
|
||||||
value = (buffer.Get(i.address + 7) * 0x100) + value;
|
value = (buffer.Get(i.address + ENTRY_POINT_COARSE) * 0x100) + value;
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#ifndef OLATHREAD_H
|
#ifndef OLATHREAD_H
|
||||||
#define OLATHREAD_H
|
#define OLATHREAD_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <ola/DmxBuffer.h>
|
#include <ola/DmxBuffer.h>
|
||||||
|
@ -14,9 +11,9 @@
|
||||||
#include <ola/client/ClientTypes.h>
|
#include <ola/client/ClientTypes.h>
|
||||||
#include <ola/Callback.h>
|
#include <ola/Callback.h>
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "dmxPersonality.h"
|
#include "dmxPersonality.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
class olaThread : public QThread
|
class olaThread : public QThread
|
||||||
{
|
{
|
||||||
|
@ -35,11 +32,9 @@ public:
|
||||||
inline int getValue(int layer, int channel) {
|
inline int getValue(int layer, int channel) {
|
||||||
return m_dmx[layer][channel];
|
return m_dmx[layer][channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
void resendDmx();
|
void resendDmx();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void run ();
|
void run ();
|
||||||
ola::client::OlaClientWrapper *m_clientWrapper;
|
ola::client::OlaClientWrapper *m_clientWrapper;
|
||||||
ola::client::OlaClient *m_client;
|
ola::client::OlaClient *m_client;
|
||||||
|
|
|
@ -17,12 +17,6 @@ Settings::Settings(QObject *parent) :
|
||||||
m_layersNumber = 0;
|
m_layersNumber = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::setPathMedia(QString path)
|
|
||||||
{
|
|
||||||
m_pathmedia = path;
|
|
||||||
MediaLibrary::getInstance()->rescanMediaLibrary();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the dmx settings for dmx.xml At the moment we need:
|
// Read the dmx settings for dmx.xml At the moment we need:
|
||||||
// - The path to the medias folder tree
|
// - The path to the medias folder tree
|
||||||
// - The number of sources/layers controlled by DMX
|
// - The number of sources/layers controlled by DMX
|
||||||
|
@ -92,60 +86,3 @@ void Settings::readFromFile(QString file) {
|
||||||
void Settings::readFile() {
|
void Settings::readFile() {
|
||||||
readFromFile(DEFAULT_FILE);
|
readFromFile(DEFAULT_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::changeLayerSetup(int layer, int universe, int address)
|
|
||||||
{
|
|
||||||
dmxSetting temp;
|
|
||||||
temp.address = address;
|
|
||||||
temp.universe = universe;
|
|
||||||
temp.layer = layer;
|
|
||||||
m_settings.replace(layer, temp);
|
|
||||||
if (!m_universe.contains(temp.universe)) {
|
|
||||||
m_universe.insert(temp.universe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::addLayer()
|
|
||||||
{
|
|
||||||
dmxSetting temp;
|
|
||||||
temp.address = -1;
|
|
||||||
temp.universe = -1;
|
|
||||||
temp.layer = -1;
|
|
||||||
m_settings.append(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::removeLayer(int layer)
|
|
||||||
{
|
|
||||||
m_settings.removeAt(layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
void Settings::writeFile(QString filename)
|
|
||||||
{
|
|
||||||
QFile* xmlFile = new QFile(filename);
|
|
||||||
if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
||||||
QMessageBox::critical(NULL,"Load XML File Problem",
|
|
||||||
QString("Couldn't open %1 to load settings for olaInterface").arg(file),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QXmlStreamWriter* xmlWriter = new QXmlStreamWriter(xmlFile);
|
|
||||||
|
|
||||||
QXmlStreamWriter stream(&output);
|
|
||||||
stream.setAutoFormatting(true);
|
|
||||||
stream.writeStartDocument();
|
|
||||||
|
|
||||||
stream.writeStartElement("dmxSettings");
|
|
||||||
stream.writeAttribute("href", "http://qt.nokia.com/");
|
|
||||||
stream.writeTextElement("title", "Qt Home");
|
|
||||||
stream.writeEndElement();
|
|
||||||
|
|
||||||
stream.writeEndDocument();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::writeFile()
|
|
||||||
{
|
|
||||||
writeFile(DEFAULT_FILE);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef SETTINGS_H
|
#ifndef SETTINGS_H
|
||||||
#define SETTINGS_H
|
#define SETTINGS_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -19,23 +18,10 @@ public:
|
||||||
static Settings *getInstance();
|
static Settings *getInstance();
|
||||||
inline QSet<int> getUniverses() { return m_universe; }
|
inline QSet<int> getUniverses() { return m_universe; }
|
||||||
inline QString getPathMedia() { return m_pathmedia; }
|
inline QString getPathMedia() { return m_pathmedia; }
|
||||||
void setPathMedia(QString path);
|
|
||||||
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
||||||
inline int getLayersNumber() { return m_layersNumber; }
|
inline int getLayersNumber() { return m_layersNumber; }
|
||||||
inline int getUniverseNumber() { return m_universe.size(); }
|
|
||||||
void readFile();
|
void readFile();
|
||||||
void changeLayerSetup(int layer, int universe, int address);
|
|
||||||
void removeLayer(int layer);
|
|
||||||
void addLayer();
|
|
||||||
inline void setLayersNumber(int layersNumber)
|
|
||||||
{
|
|
||||||
if (layersNumber <= MAX_LAYERS)
|
|
||||||
m_layersNumber = layersNumber;
|
|
||||||
else
|
|
||||||
m_layersNumber = MAX_LAYERS;
|
|
||||||
}
|
|
||||||
inline int getAudioDeviceId() { return m_audioDeviceId; }
|
inline int getAudioDeviceId() { return m_audioDeviceId; }
|
||||||
inline void setAudioDeviceId(int id) { m_audioDeviceId = id; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Settings *_instance;
|
static Settings *_instance;
|
||||||
|
@ -47,14 +33,7 @@ private:
|
||||||
|
|
||||||
explicit Settings(QObject *parent = 0);
|
explicit Settings(QObject *parent = 0);
|
||||||
void readFromFile(QString file);
|
void readFromFile(QString file);
|
||||||
// void writeFile(QString filename); // Not implemented yet
|
|
||||||
// void writeFile(); // Not implemented yet
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void pathChanged(QString path);
|
|
||||||
void layersNumber(int number);
|
|
||||||
void registerUniverse(int universe);
|
|
||||||
void audioDeviceChanged(int id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "layersettingswidget.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
|
|
|
@ -2,17 +2,10 @@
|
||||||
#define SLIDERGROUP_H
|
#define SLIDERGROUP_H
|
||||||
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include <QLabel>
|
#include <QVBoxLayout>
|
||||||
#include <QBoxLayout>
|
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QDial;
|
|
||||||
class QScrollBar;
|
|
||||||
class QSlider;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class SliderGroup : public QGroupBox
|
class SliderGroup : public QGroupBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Add table
Reference in a new issue