Compare commits
No commits in common. "4ee82c5e5fd7ec1f1d00ef174278c46875babb3e" and "3613d8fa517dc36ccb287a55994be25909ea3ec5" have entirely different histories.
4ee82c5e5f
...
3613d8fa51
20 changed files with 355 additions and 86 deletions
|
@ -12,6 +12,8 @@ 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 \
|
||||||
|
@ -23,8 +25,12 @@ 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,9 +1,20 @@
|
||||||
#ifndef AUDIOLAYERWIDGET_H
|
#ifndef AUDIOLAYERWIDGET_H
|
||||||
#define AUDIOLAYERWIDGET_H
|
#define AUDIOLAYERWIDGET_H
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <iostream>
|
||||||
#include <QTimeEdit>
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QTimeEdit>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "slidergroup.h"
|
#include "slidergroup.h"
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
#ifndef AUDIOWIDGET_H
|
#ifndef AUDIOWIDGET_H
|
||||||
#define AUDIOWIDGET_H
|
#define AUDIOWIDGET_H
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QObject>
|
||||||
|
#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" // MAX_LAYERS
|
#include "defines.h"
|
||||||
|
|
||||||
|
|
||||||
class AudioWidget : public QWidget
|
class AudioWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
friend class libreMediaServerAudio;
|
||||||
|
friend class AudioLayerWidget;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -17,6 +24,8 @@ 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,10 +1,13 @@
|
||||||
#ifndef DEFINES_H
|
#ifndef DEFINES_H
|
||||||
#define DEFINES_H
|
#define DEFINES_H
|
||||||
|
|
||||||
//#define VERSION "LibreMediaServerAudio 0.2.0 Antigona Release"
|
#include <QString>
|
||||||
#define VERSION "Kike Substitutor - No AI required - v0.2.0"
|
#include <QList>
|
||||||
#define COPYRIGHT "(C) 2014-2024 Santi Noreña <lms@criptomart.net>"
|
#include <QtGlobal>
|
||||||
#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
|
||||||
|
@ -12,10 +15,26 @@
|
||||||
// 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;
|
||||||
unsigned int universe;
|
quint8 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,
|
||||||
|
@ -30,7 +49,7 @@ static const char* StatusStr[] =
|
||||||
"Pause",
|
"Pause",
|
||||||
"Playing One",
|
"Playing One",
|
||||||
"Playing Loop",
|
"Playing Loop",
|
||||||
0x0
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Slider
|
enum Slider
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
11 - Pitch
|
11 - Pitch
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ToDo: Mejor inicializacion, primero folder, file, después params, ultimo playback.7
|
// ToDo: Tiene bastante sentido cambiar estos defines por un enum
|
||||||
// quitar CONTROL no usado
|
// ¿Ganaría algo en eficiencia? En claridad del código sí.
|
||||||
|
|
||||||
#define VOLUME_COARSE 0
|
#define VOLUME_COARSE 0
|
||||||
#define PAN 1
|
#define PAN 1
|
||||||
#define DMX_FOLDER 2
|
#define DMX_FOLDER 2
|
||||||
|
|
|
@ -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,10 +1,13 @@
|
||||||
#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 <QTimer>
|
#include <QWidget>
|
||||||
|
|
||||||
class dmxWidget : public QGroupBox
|
class dmxWidget : public QGroupBox
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,39 +25,73 @@ 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();
|
||||||
m_mediaLibrary = new MediaLibrary;
|
connect(set, SIGNAL(audioDeviceChanged(int)), this, SLOT(audioDeviceChanged(int)));
|
||||||
m_mediaLibrary->initMediaLibrary();
|
this->setWindowTitle(VERSION);
|
||||||
m_aw = new AudioWidget;
|
qDebug() << VERSION;
|
||||||
setCentralWidget(m_aw);
|
qDebug() << COPYRIGHT;
|
||||||
|
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);
|
||||||
m_ola = new olaThread(this, set->getLayersNumber());
|
ola = new olaThread(this, set->getLayersNumber());
|
||||||
Q_CHECK_PTR(m_ola);
|
Q_CHECK_PTR(ola);
|
||||||
m_ola->blockSignals(true);
|
ola->blockSignals(true);
|
||||||
connect(m_ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
connect(set, SIGNAL(registerUniverse(int)), ola, SLOT(registerUniverse(int)));
|
||||||
connect(m_ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
connect(ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
||||||
m_ola->registerUniverse();
|
connect(ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
||||||
|
ola->registerUniverse();
|
||||||
|
ola->start(QThread::TimeCriticalPriority );
|
||||||
|
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||||
|
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()));
|
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||||
m_aw->startEngine();
|
aw->startEngine();
|
||||||
qDebug("Init Complete.");
|
qDebug("Init Complete.");
|
||||||
m_ola->blockSignals(false);
|
ola->blockSignals(false);
|
||||||
m_ola->start(QThread::TimeCriticalPriority );
|
ola->resendDmx();
|
||||||
}
|
}
|
||||||
|
|
||||||
libreMediaServerAudio::~libreMediaServerAudio()
|
libreMediaServerAudio::~libreMediaServerAudio()
|
||||||
{
|
{
|
||||||
m_ola->stop();
|
ola->stop();
|
||||||
m_aw->stopEngine();
|
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()
|
||||||
|
@ -75,30 +109,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 = m_ola->getValue(layer, DMX_FILE);
|
aux = ola->getValue(layer, DMX_FILE);
|
||||||
mediaFile = m_mediaLibrary->requestNewFile(value, aux);
|
mediaFile = MediaLibrary::getInstance()->requestNewFile(value, aux);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
m_aw->mediaLoaded(layer, mediaFile);
|
aw->mediaLoaded(layer, mediaFile);
|
||||||
break;
|
break;
|
||||||
case DMX_FILE:
|
case DMX_FILE:
|
||||||
aux = m_ola->getValue(layer, DMX_FOLDER);
|
aux = ola->getValue(layer, DMX_FOLDER);
|
||||||
mediaFile = m_mediaLibrary->requestNewFile(aux, value);
|
mediaFile = MediaLibrary::getInstance()->requestNewFile(aux, value);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
m_aw->mediaLoaded(layer, mediaFile);
|
aw->mediaLoaded(layer, mediaFile);
|
||||||
break;
|
break;
|
||||||
case VOLUME_COARSE:
|
case VOLUME_COARSE:
|
||||||
case VOLUME_FINE:
|
case VOLUME_FINE:
|
||||||
m_aw->volChanged(layer, (value / 65025.0f));
|
aw->volChanged(layer, (value / 65025.0f));
|
||||||
break;
|
break;
|
||||||
case PAN:
|
case PAN:
|
||||||
m_aw->panChanged(layer, value);
|
aw->panChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case PITCH:
|
case PITCH:
|
||||||
m_aw->pitchChanged(layer, value);
|
aw->pitchChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case ENTRY_POINT_COARSE:
|
case ENTRY_POINT_COARSE:
|
||||||
case ENTRY_POINT_FINE:
|
case ENTRY_POINT_FINE:
|
||||||
m_aw->entryPointChanged(layer, value);
|
aw->entryPointChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
case PLAYBACK:
|
case PLAYBACK:
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
@ -106,16 +140,16 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
aux = value / 25;
|
aux = value / 25;
|
||||||
switch (aux) {
|
switch (aux) {
|
||||||
case 0 :
|
case 0 :
|
||||||
m_aw->playbackChanged(layer, PlayingOnce);
|
aw->playbackChanged(layer, PlayingOnce);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
m_aw->playbackChanged(layer, Stopped);
|
aw->playbackChanged(layer, Stopped);
|
||||||
break;
|
break;
|
||||||
case 2 :
|
case 2 :
|
||||||
m_aw->playbackChanged(layer, Paused);
|
aw->playbackChanged(layer, Paused);
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
m_aw->playbackChanged(layer, PlayingLoop);
|
aw->playbackChanged(layer, PlayingLoop);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
|
@ -124,3 +158,9 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void libreMediaServerAudio::audioDeviceChanged(int id)
|
||||||
|
{
|
||||||
|
aw->stopEngine();
|
||||||
|
aw->startEngine(id);
|
||||||
|
}
|
||||||
|
|
|
@ -20,17 +20,31 @@
|
||||||
#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
|
||||||
|
@ -41,14 +55,25 @@ public:
|
||||||
Ui::LibreMediaServerAudio ui;
|
Ui::LibreMediaServerAudio ui;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioWidget *m_aw;
|
AudioWidget *aw;
|
||||||
dmxWidget *m_dmxWidget;
|
dmxWidget *m_dmxWidget;
|
||||||
olaThread *m_ola;
|
olaThread *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,9 +28,18 @@
|
||||||
<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,5 +1,15 @@
|
||||||
#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)
|
||||||
|
@ -51,7 +61,7 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||||
|
|
||||||
QString MediaLibrary::requestNewFile(int folder, int file){
|
QString MediaLibrary::requestNewFile(int folder, int file){
|
||||||
if (!m_media) {
|
if (!m_media) {
|
||||||
qWarning("MediaLibrary is not init, set a correct path.");
|
qWarning("MediaLibrary is not init. Set a correct path to media library");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
QString newfile;
|
QString newfile;
|
||||||
|
|
|
@ -1,32 +1,25 @@
|
||||||
#ifndef MEDIALIBRARY_H
|
#ifndef MEDIALIBRARY_H
|
||||||
#define MEDIALIBRARY_H
|
#define MEDIALIBRARY_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "settings.h"
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "settings.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
|
||||||
|
@ -34,12 +27,43 @@ 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();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
QList<MediaFolder> *m_media;
|
|
||||||
QList<MediaFile> getMediaInformation(QDir dir);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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:
|
||||||
|
|
||||||
|
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,11 +183,15 @@ ma_result MiniAudioEngine::printFormatInfo(int layer)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expects between 0 and 1 vol value
|
// Expects between 0 and 1 vol value in db
|
||||||
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 <QDebug> // prints messages
|
#include <stdio.h> // for printf
|
||||||
|
|
||||||
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 VOLUME_COARSE:
|
case 0:
|
||||||
value = (value * 0x100) + buffer.Get(i.address + VOLUME_FINE);
|
value = (value * 0x100) + buffer.Get(i.address + 6);
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
volSent = true;
|
volSent = true;
|
||||||
break;
|
break;
|
||||||
case ENTRY_POINT_COARSE:
|
case 7:
|
||||||
value = (value * 0x100) + buffer.Get(i.address + ENTRY_POINT_FINE);
|
value = (value * 0x100) + buffer.Get(i.address + 8);
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
entrySent = true;
|
entrySent = true;
|
||||||
break;
|
break;
|
||||||
case VOLUME_FINE:
|
case 6:
|
||||||
if (volSent == false)
|
if (volSent == false)
|
||||||
{
|
{
|
||||||
value = (buffer.Get(i.address + VOLUME_COARSE) * 0x100) + value;
|
value = (buffer.Get(i.address) * 0x100) + value;
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ENTRY_POINT_FINE:
|
case 8:
|
||||||
if (entrySent == false)
|
if (entrySent == false)
|
||||||
{
|
{
|
||||||
value = (buffer.Get(i.address + ENTRY_POINT_COARSE) * 0x100) + value;
|
value = (buffer.Get(i.address + 7) * 0x100) + value;
|
||||||
emit dmxOutput(i.layer,j,value);
|
emit dmxOutput(i.layer,j,value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -125,6 +125,15 @@ bool olaThread::CheckDataLoss() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void olaThread::resendDmx()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_layers; i++) {
|
||||||
|
for (int j = 0; j < LAYER_CHANNELS; j++){
|
||||||
|
emit dmxOutput(i, j, m_dmx[i][j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void olaThread::socketClosed()
|
void olaThread::socketClosed()
|
||||||
{
|
{
|
||||||
qWarning("ola closed connection. Try reopening it... ");
|
qWarning("ola closed connection. Try reopening it... ");
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#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>
|
||||||
|
@ -11,9 +14,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
|
||||||
{
|
{
|
||||||
|
@ -32,9 +35,11 @@ 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;
|
||||||
|
@ -43,6 +48,7 @@ private:
|
||||||
int m_layers;
|
int m_layers;
|
||||||
int m_dmx[MAX_LAYERS][LAYER_CHANNELS];
|
int m_dmx[MAX_LAYERS][LAYER_CHANNELS];
|
||||||
QList<dmxSetting> m_dmxSettings;
|
QList<dmxSetting> m_dmxSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Callback from ola. Control de errores en el registro de Universos en OLA
|
* @brief Callback from ola. Control de errores en el registro de Universos en OLA
|
||||||
* typedef SingleUseCallback1<void, const Result&> ola::client::SetCallback
|
* typedef SingleUseCallback1<void, const Result&> ola::client::SetCallback
|
||||||
|
@ -95,4 +101,6 @@ signals:
|
||||||
void universeReceived(int uni);
|
void universeReceived(int uni);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using namespace ola;
|
||||||
|
|
||||||
#endif // OLATHREAD_H
|
#endif // OLATHREAD_H
|
||||||
|
|
|
@ -17,6 +17,12 @@ 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
|
||||||
|
@ -86,3 +92,60 @@ 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,6 +1,7 @@
|
||||||
#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>
|
||||||
|
@ -18,10 +19,23 @@ 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;
|
||||||
|
@ -33,7 +47,14 @@ 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,10 +2,17 @@
|
||||||
#define SLIDERGROUP_H
|
#define SLIDERGROUP_H
|
||||||
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QDoubleSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QVBoxLayout>
|
#include <QLabel>
|
||||||
|
#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