funcionando sin la parte de las settings.
This commit is contained in:
parent
b59cc92c5f
commit
8b5d9414d1
20 changed files with 239 additions and 343 deletions
|
@ -6,15 +6,14 @@ https://git.criptomart.net/libremediaserver
|
||||||
|
|
||||||
Lbre Media Server ChangeLog
|
Lbre Media Server ChangeLog
|
||||||
|
|
||||||
v 1.4
|
v 0.1.4
|
||||||
- change engine to miniaudio.
|
+ change engine to miniaudio. Refactor all audio methods to MiniAudioEngine.
|
||||||
- Select sound device output.
|
+ Select sound device output.
|
||||||
- pan.
|
+ pan.
|
||||||
- Show faders values.
|
+ Show faders values.
|
||||||
--> Hacer UI por fader: mute/centrado, valor, visualizador:
|
+ play offset.
|
||||||
--> Hacer UI con la visualización de tiempos.
|
+ Refactor AudioMasterWidget to AudioDMXReceptionWidget. Master functions will be in AudioWidget.
|
||||||
- SettingsDialog.
|
+ mp3, flac, wav (mp3 has given some errors seeking cursor...).
|
||||||
- Load/save conf file.
|
|
||||||
|
|
||||||
v 0.1.3 (19/04/2024)
|
v 0.1.3 (19/04/2024)
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,6 @@ v 1.5
|
||||||
- Play all medias found in folder consecutevily or random, with loop.
|
- Play all medias found in folder consecutevily or random, with loop.
|
||||||
- Play all medias, consecutevily and random, with loop.
|
- Play all medias, consecutevily and random, with loop.
|
||||||
- mute/panic on layer.
|
- mute/panic on layer.
|
||||||
- loop points.
|
|
||||||
- play offset. ¿stop offset?
|
|
||||||
- number of layers configured in conf file, up to 256.
|
- number of layers configured in conf file, up to 256.
|
||||||
- Master Bus Layer:
|
- Master Bus Layer:
|
||||||
- each layer will have one "Gain" prefader that acts in source, "Vol" in v 1.3.
|
- each layer will have one "Gain" prefader that acts in source, "Vol" in v 1.3.
|
||||||
|
@ -44,10 +42,12 @@ v 1.5
|
||||||
- magicq .hed
|
- magicq .hed
|
||||||
- audio device linked, outputs will be redirected there.
|
- audio device linked, outputs will be redirected there.
|
||||||
- dmx address + universe settings.
|
- dmx address + universe settings.
|
||||||
- Keyboards strokes, select files from ui.
|
- Keyboards strokes, load media files from ui.
|
||||||
- Dar la opción clickeando en el widget de tiempo de poner una cuenta atrás en vez de hacia delante.
|
- Dar la opción clickeando en el widget de tiempo de poner una cuenta atrás en vez de hacia delante.
|
||||||
- LOGs y entrada de comandos.
|
- LOGs y entrada de comandos.
|
||||||
- Bufgix: depurar errores cuando no carga la librería de medias, cambia el númmero de capas, cambia el universo, etc.
|
- Bufgix: depurar errores cuando no carga la librería de medias, cambia el númmero de capas, cambia el universo, etc.
|
||||||
- Refactor AudioMasterWidget to AudioDMXReceptionWidget. Master functions will be in AudioWidget.
|
|
||||||
- New control mode without pitch control, it saves resources. MA_SOUND_FLAG_NO_PITCH
|
- New control mode without pitch control, it saves resources. MA_SOUND_FLAG_NO_PITCH
|
||||||
- Vumeter or indicator about audio output in layer and master.
|
- Vumeter or indicator about audio output in layer and master.
|
||||||
|
- SettingsDialog.
|
||||||
|
- Load/save conf file.
|
||||||
|
- ¿stop offset? is it needed?
|
||||||
|
|
|
@ -2,6 +2,7 @@ TEMPLATE = app
|
||||||
TARGET = libremediaserver-audio
|
TARGET = libremediaserver-audio
|
||||||
QT += webkitwidgets widgets
|
QT += webkitwidgets widgets
|
||||||
HEADERS += src/libremediaserver-audio.h \
|
HEADERS += src/libremediaserver-audio.h \
|
||||||
|
src/dmxwidget.h \
|
||||||
src/miniaudio.h \
|
src/miniaudio.h \
|
||||||
src/medialibrary.h \
|
src/medialibrary.h \
|
||||||
src/miniaudioengine.h \
|
src/miniaudioengine.h \
|
||||||
|
@ -9,12 +10,13 @@ HEADERS += src/libremediaserver-audio.h \
|
||||||
src/audiolayerwidget.h \
|
src/audiolayerwidget.h \
|
||||||
src/dmxPersonality.h \
|
src/dmxPersonality.h \
|
||||||
src/audiowidget.h \
|
src/audiowidget.h \
|
||||||
src/audiomasterwidget.h \
|
|
||||||
src/defines.h \
|
src/defines.h \
|
||||||
src/settings.h \
|
src/settings.h \
|
||||||
src/settingsdialog.h \
|
src/settingsdialog.h \
|
||||||
src/layersettingswidget.h
|
src/layersettingswidget.h \
|
||||||
|
src/slidergroup.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
|
src/dmxwidget.cpp \
|
||||||
src/miniaudio.c \
|
src/miniaudio.c \
|
||||||
src/libremediaserver-audio.cpp \
|
src/libremediaserver-audio.cpp \
|
||||||
src/medialibrary.cpp \
|
src/medialibrary.cpp \
|
||||||
|
@ -22,10 +24,10 @@ SOURCES += src/main.cpp \
|
||||||
src/olathread.cpp \
|
src/olathread.cpp \
|
||||||
src/audiolayerwidget.cpp \
|
src/audiolayerwidget.cpp \
|
||||||
src/audiowidget.cpp \
|
src/audiowidget.cpp \
|
||||||
src/audiomasterwidget.cpp \
|
|
||||||
src/settings.cpp \
|
src/settings.cpp \
|
||||||
src/settingsdialog.cpp \
|
src/settingsdialog.cpp \
|
||||||
src/layersettingswidget.cpp
|
src/layersettingswidget.cpp \
|
||||||
|
src/slidergroup.cpp
|
||||||
FORMS += src/libremediaserver-audio.ui \
|
FORMS += src/libremediaserver-audio.ui \
|
||||||
src/settingsdialog.ui \
|
src/settingsdialog.ui \
|
||||||
src/layersettingswidget.ui
|
src/layersettingswidget.ui
|
||||||
|
|
|
@ -5,102 +5,61 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name, int layer):
|
||||||
QGroupBox(parent)
|
QGroupBox(parent)
|
||||||
, m_layer(layer)
|
, m_layer(layer)
|
||||||
, m_suspendResumeButton(0)
|
, m_suspendResumeButton(0)
|
||||||
, m_volumeIndicator(new QSpinBox)
|
|
||||||
, m_panIndicator(new QSpinBox)
|
|
||||||
, m_pitchIndicator(new QSpinBox)
|
|
||||||
{
|
{
|
||||||
this->setTitle(name);
|
this->setTitle(name);
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
QGridLayout *status = new QGridLayout;
|
|
||||||
m_statusValue = new QLabel;
|
|
||||||
status->addWidget(m_statusValue, 1, 1);
|
|
||||||
m_folderValue = new QLabel;
|
|
||||||
m_folderValue->setMaximumWidth(100);
|
|
||||||
status->addWidget(m_folderValue, 0, 0);
|
|
||||||
m_fileValue = new QLabel;
|
|
||||||
m_fileValue->setMaximumWidth(100);
|
|
||||||
status->addWidget(m_fileValue, 0, 2);
|
|
||||||
layout->addLayout(status);
|
|
||||||
|
|
||||||
QGridLayout *volumeBox = new QGridLayout;
|
|
||||||
m_volumeLabel = new QLabel;
|
|
||||||
m_volumeLabel->setText(tr(VOLUME_LABEL));
|
|
||||||
m_volumeSlider = new QSlider(Qt::Horizontal);
|
|
||||||
m_volumeSlider->setMinimum(0);
|
|
||||||
m_volumeSlider->setMaximum(100);
|
|
||||||
m_volumeSlider->setSingleStep(1);
|
|
||||||
m_volumeIndicator->setRange(0, 100);
|
|
||||||
m_volumeIndicator->setValue(0);
|
|
||||||
m_volumeIndicator->setMaximumWidth(40);
|
|
||||||
m_volumeIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
|
||||||
volumeBox->addWidget(m_volumeLabel, 0, 0);
|
|
||||||
volumeBox->addWidget(m_volumeSlider, 0, 1);
|
|
||||||
volumeBox->addWidget(m_volumeIndicator, 0, 2);
|
|
||||||
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
|
||||||
connect(m_volumeSlider, &QSlider::valueChanged, this, [=] () {
|
|
||||||
m_volumeIndicator->setValue(m_volumeSlider->value());
|
|
||||||
});
|
|
||||||
m_panLabel = new QLabel;
|
|
||||||
m_panLabel->setText("Pan");
|
|
||||||
m_panSlider = new QSlider(Qt::Horizontal);
|
|
||||||
m_panSlider->setMinimum(0);
|
|
||||||
m_panSlider->setMaximum(255);
|
|
||||||
m_panSlider->setSingleStep(1);
|
|
||||||
m_panIndicator->setRange(0, 255);
|
|
||||||
m_panIndicator->setValue(128);
|
|
||||||
m_panIndicator->setMaximumWidth(40);
|
|
||||||
m_panIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
|
||||||
connect(m_panSlider, &QSlider::valueChanged, this, [=] () {
|
|
||||||
m_panIndicator->setValue(m_panSlider->value());
|
|
||||||
});
|
|
||||||
connect(m_panSlider, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
|
||||||
volumeBox->addWidget(m_panLabel, 1, 0);
|
|
||||||
volumeBox->addWidget(m_panSlider, 1, 1);
|
|
||||||
volumeBox->addWidget(m_panIndicator, 1, 2);
|
|
||||||
m_pitchLabel = new QLabel;
|
|
||||||
m_pitchLabel->setText("Pitch");
|
|
||||||
m_pitchSlider = new QSlider(Qt::Horizontal);
|
|
||||||
m_pitchSlider->setMinimum(0);
|
|
||||||
m_pitchSlider->setMaximum(255);
|
|
||||||
m_pitchSlider->setSingleStep(1);
|
|
||||||
m_pitchIndicator->setRange(0, 255);
|
|
||||||
m_pitchIndicator->setValue(128);
|
|
||||||
m_pitchIndicator->setMaximumWidth(40);
|
|
||||||
m_pitchIndicator->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
|
||||||
connect(m_pitchSlider, &QSlider::valueChanged, this, [=] () {
|
|
||||||
m_pitchIndicator->setValue(m_pitchSlider->value());
|
|
||||||
});
|
|
||||||
connect(m_pitchSlider, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
|
||||||
volumeBox->addWidget(m_pitchLabel, 2, 0);
|
|
||||||
volumeBox->addWidget(m_pitchSlider, 2, 1);
|
|
||||||
volumeBox->addWidget(m_pitchIndicator, 2, 2);
|
|
||||||
layout->addLayout(volumeBox);
|
|
||||||
|
|
||||||
QHBoxLayout *progressTime = new QHBoxLayout;
|
QHBoxLayout *progressTime = new QHBoxLayout;
|
||||||
m_progressTimeLabel = new QLabel;
|
//m_progressTimeLabel = new QLabel;
|
||||||
m_progressTimeLabel->setText(PROGRESS_TIME_LABEL);
|
//m_progressTimeLabel->setText(PROGRESS_TIME_LABEL);
|
||||||
|
//progressTime->addWidget(m_progressTimeLabel);
|
||||||
m_progressTime = new QTimeEdit;
|
m_progressTime = new QTimeEdit;
|
||||||
m_progressTime->text();
|
m_progressTime->text();
|
||||||
m_progressTime->setDisplayFormat("h:mm:ss:zzz");
|
m_progressTime->setDisplayFormat("h:mm:ss:zzz");
|
||||||
m_progressTime->setReadOnly(true);
|
m_progressTime->setReadOnly(true);
|
||||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
m_progressTime->setMaximumWidth(100);
|
m_progressTime->setMaximumWidth(90);
|
||||||
progressTime->addWidget(m_progressTimeLabel);
|
m_progressTime->setFocusPolicy(Qt::NoFocus);
|
||||||
progressTime->addWidget(m_progressTime);
|
progressTime->addWidget(m_progressTime);
|
||||||
m_totalTimeLabel = new QLabel;
|
//m_totalTimeLabel = new QLabel;
|
||||||
m_totalTimeLabel->setText(TOTAL_TIME_LABEL);
|
//m_totalTimeLabel->setText(TOTAL_TIME_LABEL);
|
||||||
|
//progressTime->addWidget(m_totalTimeLabel);
|
||||||
m_totalTimeValue = new QTimeEdit;
|
m_totalTimeValue = new QTimeEdit;
|
||||||
m_totalTimeValue->setDisplayFormat("h:mm:ss:zzz");
|
m_totalTimeValue->setDisplayFormat("h:mm:ss:zzz");
|
||||||
m_totalTimeValue->setReadOnly(true);
|
m_totalTimeValue->setReadOnly(true);
|
||||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
m_totalTimeValue->setMaximumWidth(100);
|
m_totalTimeValue->setMaximumWidth(90);
|
||||||
progressTime->addWidget(m_totalTimeLabel);
|
m_totalTimeValue->setFocusPolicy(Qt::NoFocus);
|
||||||
progressTime->addWidget(m_totalTimeValue);
|
progressTime->addWidget(m_totalTimeValue);
|
||||||
layout->addLayout(progressTime);
|
layout->addLayout(progressTime);
|
||||||
|
|
||||||
m_progressSlider = new QSlider(Qt::Horizontal);
|
m_progressSlider = new QSlider(Qt::Horizontal);
|
||||||
|
m_progressSlider->setFocusPolicy(Qt::NoFocus);
|
||||||
layout->addWidget(m_progressSlider);
|
layout->addWidget(m_progressSlider);
|
||||||
|
|
||||||
|
QGridLayout *status = new QGridLayout;
|
||||||
|
m_statusValue = new QLabel;
|
||||||
|
status->addWidget(m_statusValue, 0, 0);
|
||||||
|
m_folderValue = new QLabel;
|
||||||
|
m_folderValue->setMaximumWidth(200);
|
||||||
|
status->addWidget(m_folderValue, 1, 0);
|
||||||
|
m_fileValue = new QLabel;
|
||||||
|
m_fileValue->setMaximumWidth(200);
|
||||||
|
status->addWidget(m_fileValue, 2, 0);
|
||||||
|
layout->addLayout(status);
|
||||||
|
|
||||||
|
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||||
|
m_volume = new SliderGroup("Vol", 0 , 100, NULL);
|
||||||
|
volumeBox->addWidget(m_volume);
|
||||||
|
connect(m_volume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||||
|
m_pan = new SliderGroup("Pan", 0 , 255, NULL);
|
||||||
|
volumeBox->addWidget(m_pan);
|
||||||
|
connect(m_pan, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||||
|
m_pitch = new SliderGroup("Pitch", 0 , 255, NULL);
|
||||||
|
volumeBox->addWidget(m_pitch);
|
||||||
|
connect(m_pitch, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||||
|
layout->addLayout(volumeBox);
|
||||||
|
|
||||||
m_suspendResumeButton = new QPushButton(this);
|
m_suspendResumeButton = new QPushButton(this);
|
||||||
m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
|
m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
|
||||||
connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
|
connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
|
||||||
|
@ -149,26 +108,23 @@ void AudioLayerWidget::toggleSuspendResume()
|
||||||
// from DMX signals
|
// from DMX signals
|
||||||
void AudioLayerWidget::setVol(qreal vol)
|
void AudioLayerWidget::setVol(qreal vol)
|
||||||
{
|
{
|
||||||
m_volumeSlider->blockSignals(true);
|
m_volume->blockSignals(true);
|
||||||
m_volumeSlider->setValue(vol);
|
m_volume->setValue(vol);
|
||||||
m_volumeIndicator->setValue(vol);
|
m_volume->blockSignals(false);
|
||||||
m_volumeSlider->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLayerWidget::setPan(qreal pan)
|
void AudioLayerWidget::setPan(qreal pan)
|
||||||
{
|
{
|
||||||
m_panSlider->blockSignals(true);
|
m_pan->blockSignals(true);
|
||||||
m_panSlider->setValue(pan);
|
m_pan->setValue(pan);
|
||||||
m_panIndicator->setValue(pan);
|
m_pan->blockSignals(false);
|
||||||
m_panSlider->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLayerWidget::setPitch(qreal pitch)
|
void AudioLayerWidget::setPitch(qreal pitch)
|
||||||
{
|
{
|
||||||
m_pitchSlider->blockSignals(true);
|
m_pitch->blockSignals(true);
|
||||||
m_pitchSlider->setValue(pitch);
|
m_pitch->setValue(pitch);
|
||||||
m_pitchIndicator->setValue(pitch);
|
m_pitch->blockSignals(false);
|
||||||
m_pitchSlider->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioLayerWidget::fileLoaded(QString file)
|
void AudioLayerWidget::fileLoaded(QString file)
|
||||||
|
@ -181,36 +137,35 @@ void AudioLayerWidget::fileLoaded(QString file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AudioLayerWidget::getStatus()
|
|
||||||
{
|
|
||||||
QString tmp;
|
|
||||||
switch (m_status) {
|
|
||||||
case Status::Paused:
|
|
||||||
tmp.append("Paused");
|
|
||||||
break;
|
|
||||||
case Status::PlayingLoop:
|
|
||||||
tmp.append("Playing Loop");
|
|
||||||
break;
|
|
||||||
case Status::PlayingOnce:
|
|
||||||
tmp.append("Playing one");
|
|
||||||
break;
|
|
||||||
case Status::Stopped:
|
|
||||||
tmp.append("Stopped");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AudioLayerWidget::setPlaybackStatus(Status status)
|
void AudioLayerWidget::setPlaybackStatus(Status status)
|
||||||
{
|
{
|
||||||
m_status = status;
|
m_status = status;
|
||||||
if (status == Status::Stopped)
|
if (status == Status::Stopped)
|
||||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
||||||
QString tmp = this->getStatus();
|
|
||||||
m_statusValue->blockSignals(true);
|
m_statusValue->blockSignals(true);
|
||||||
m_suspendResumeButton->blockSignals(true);
|
m_suspendResumeButton->blockSignals(true);
|
||||||
m_statusValue->setText(tmp);
|
switch (m_status) {
|
||||||
m_suspendResumeButton->setText(tmp);
|
case Status::Paused:
|
||||||
|
m_statusValue->setText("Pause");
|
||||||
|
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||||
|
m_suspendResumeButton->setText("Pause");
|
||||||
|
break;
|
||||||
|
case Status::PlayingLoop:
|
||||||
|
m_statusValue->setText("Play Loop");
|
||||||
|
m_statusValue->setStyleSheet("QLabel { color : green; }");
|
||||||
|
m_suspendResumeButton->setText("Play Loop");
|
||||||
|
break;
|
||||||
|
case Status::PlayingOnce:
|
||||||
|
m_statusValue->setText("Play One");
|
||||||
|
m_statusValue->setStyleSheet("QLabel { color : green; }");
|
||||||
|
m_suspendResumeButton->setText("Play One");
|
||||||
|
break;
|
||||||
|
case Status::Stopped:
|
||||||
|
m_statusValue->setText("Stop");
|
||||||
|
m_statusValue->setStyleSheet("QLabel { color : red; }");
|
||||||
|
m_suspendResumeButton->setText("Stop");
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_statusValue->blockSignals(false);
|
m_statusValue->blockSignals(false);
|
||||||
m_suspendResumeButton->blockSignals(false);
|
m_suspendResumeButton->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "slidergroup.h"
|
||||||
|
|
||||||
class AudioLayerWidget : public QGroupBox
|
class AudioLayerWidget : public QGroupBox
|
||||||
{
|
{
|
||||||
|
@ -32,7 +33,6 @@ public:
|
||||||
void setLoop(bool on);
|
void setLoop(bool on);
|
||||||
void setPlaybackStatus(Status status);
|
void setPlaybackStatus(Status status);
|
||||||
inline Status getPlaybackStatus() { return m_status; }
|
inline Status getPlaybackStatus() { return m_status; }
|
||||||
QString getStatus();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Status m_status;
|
Status m_status;
|
||||||
|
@ -44,15 +44,9 @@ private:
|
||||||
QLabel *m_fileValue;
|
QLabel *m_fileValue;
|
||||||
QLabel * m_folderLabel;
|
QLabel * m_folderLabel;
|
||||||
QLabel * m_folderValue;
|
QLabel * m_folderValue;
|
||||||
QLabel *m_volumeLabel;
|
SliderGroup *m_volume;
|
||||||
QSlider *m_volumeSlider;
|
SliderGroup *m_pan;
|
||||||
QSpinBox *m_volumeIndicator;
|
SliderGroup *m_pitch;
|
||||||
QLabel *m_panLabel;
|
|
||||||
QSlider *m_panSlider;
|
|
||||||
QSpinBox *m_panIndicator;
|
|
||||||
QLabel *m_pitchLabel;
|
|
||||||
QSlider *m_pitchSlider;
|
|
||||||
QSpinBox *m_pitchIndicator;
|
|
||||||
QLabel * m_progressLabel;
|
QLabel * m_progressLabel;
|
||||||
QSlider *m_progressSlider;
|
QSlider *m_progressSlider;
|
||||||
QLabel *m_progressTimeLabel;
|
QLabel *m_progressTimeLabel;
|
||||||
|
|
|
@ -81,6 +81,14 @@ void AudioWidget::playbackChanged(int layer, Status status)
|
||||||
dynamic_cast<AudioLayerWidget *>(item->widget())->setPlaybackStatus(status);
|
dynamic_cast<AudioLayerWidget *>(item->widget())->setPlaybackStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioWidget::entryPointChanged(int layer, int cursor)
|
||||||
|
{
|
||||||
|
m_mae.setCursor(layer, cursor);
|
||||||
|
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||||
|
AudioLayerWidget *aw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||||
|
aw->refreshUi(m_mae.getCursor(layer));
|
||||||
|
}
|
||||||
|
|
||||||
void AudioWidget::refreshUi() {
|
void AudioWidget::refreshUi() {
|
||||||
for (int i= 0; i < Settings::getInstance()->getLayersNumber(); i++ ) {
|
for (int i= 0; i < Settings::getInstance()->getLayersNumber(); i++ ) {
|
||||||
QLayoutItem * const item = m_layout->itemAt(i);
|
QLayoutItem * const item = m_layout->itemAt(i);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "audiomasterwidget.h"
|
#include "dmxwidget.h"
|
||||||
#include "audiolayerwidget.h"
|
#include "audiolayerwidget.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "miniaudioengine.h"
|
#include "miniaudioengine.h"
|
||||||
|
@ -31,6 +31,7 @@ protected:
|
||||||
void panChanged(int layer, qreal pan);
|
void panChanged(int layer, qreal pan);
|
||||||
void pitchChanged(int layer, qreal pitch);
|
void pitchChanged(int layer, qreal pitch);
|
||||||
void playbackChanged(int layer, Status status);
|
void playbackChanged(int layer, Status status);
|
||||||
|
void entryPointChanged(int layer, int cursor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MiniAudioEngine m_mae;
|
MiniAudioEngine m_mae;
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
#include "audiomasterwidget.h"
|
#include "dmxwidget.h"
|
||||||
|
|
||||||
AudioMasterWidget::AudioMasterWidget(QWidget *parent) :
|
dmxWidget::dmxWidget(QWidget *parent) :
|
||||||
QGroupBox(parent)
|
QGroupBox(parent)
|
||||||
, m_receiveDMX(new QCheckBox)
|
, m_receiveDMX(new QCheckBox)
|
||||||
, m_watchDMX(new QTimer)
|
, m_watchDMX(new QTimer)
|
||||||
{
|
{
|
||||||
|
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()),
|
||||||
this, SLOT(watchDMXExpired()));
|
this, SLOT(watchDMXExpired()));
|
||||||
m_watchDMX->start(1000);
|
m_watchDMX->start(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioMasterWidget::~AudioMasterWidget()
|
dmxWidget::~dmxWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMasterWidget::watchDMXExpired() {
|
void dmxWidget::watchDMXExpired() {
|
||||||
m_receiveDMX->setChecked(false);
|
m_receiveDMX->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMasterWidget::updateWatchDMX()
|
void dmxWidget::updateWatchDMX(int uni)
|
||||||
{
|
{
|
||||||
m_receiveDMX->setChecked(true);
|
(void)uni;
|
||||||
|
if (m_receiveDMX->isChecked() == false)
|
||||||
|
m_receiveDMX->setChecked(true);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef AUDIOMASTERWIDGET_H
|
#ifndef DMXWIDGET_H
|
||||||
#define AUDIOMASTERWIDGET_H
|
#define DMXWIDGET_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -7,19 +7,18 @@
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class dmxWidget : public QGroupBox
|
||||||
class AudioMasterWidget : public QGroupBox
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AudioMasterWidget(QWidget *parent);
|
dmxWidget(QWidget *parent);
|
||||||
|
~dmxWidget();
|
||||||
~AudioMasterWidget();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateWatchDMX();
|
void updateWatchDMX(int uni);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox *m_receiveDMX;
|
QCheckBox *m_receiveDMX;
|
||||||
|
@ -30,4 +29,4 @@ private slots:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUDIOMASTERWIDGET_H
|
#endif // DMXWIDGET_H
|
|
@ -27,55 +27,30 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
Q_UNUSED(args);
|
Q_UNUSED(args);
|
||||||
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)));
|
connect(set, SIGNAL(audioDeviceChanged(int)), this, SLOT(audioDeviceChanged(int)));
|
||||||
/*
|
|
||||||
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);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* connect(MediaLibrary::getInstance(), SIGNAL(debug(QString)),
|
|
||||||
textEdit, SLOT(append(QString)), Qt::QueuedConnection);
|
|
||||||
|
|
||||||
connect(MediaLibrary::getInstance(), SIGNAL(warning(QString)),
|
|
||||||
textEdit, SLOT(append(QString)), Qt::QueuedConnection);
|
|
||||||
*/
|
|
||||||
|
|
||||||
this->setWindowTitle(VERSION);
|
this->setWindowTitle(VERSION);
|
||||||
qDebug() << VERSION;
|
qDebug() << VERSION;
|
||||||
qDebug() << COPYRIGHT;
|
qDebug() << COPYRIGHT;
|
||||||
qDebug() << LICENSE;
|
qDebug() << LICENSE;
|
||||||
|
|
||||||
// start audio engine
|
|
||||||
MediaLibrary::getInstance()->initMediaLibrary();
|
MediaLibrary::getInstance()->initMediaLibrary();
|
||||||
aw = new AudioWidget;
|
aw = new AudioWidget;
|
||||||
setCentralWidget(aw);
|
setCentralWidget(aw);
|
||||||
amw = new AudioMasterWidget(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(amw);
|
topWidget->setWidget(m_dmxWidget);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
addDockWidget(Qt::TopDockWidgetArea, topWidget);
|
||||||
// ola setup
|
|
||||||
ola = new olaThread(this, set->getLayersNumber());
|
ola = new olaThread(this, set->getLayersNumber());
|
||||||
Q_CHECK_PTR(ola);
|
Q_CHECK_PTR(ola);
|
||||||
ola->blockSignals(true);
|
ola->blockSignals(true);
|
||||||
connect(set, SIGNAL(registerUniverse(int)), ola, SLOT(registerUniverse(int)));
|
connect(set, SIGNAL(registerUniverse(int)), ola, SLOT(registerUniverse(int)));
|
||||||
connect(ola, SIGNAL (layerReceived()), amw, SLOT(updateWatchDMX()));
|
connect(ola, SIGNAL (universeReceived(int)), m_dmxWidget, SLOT(updateWatchDMX(int)));
|
||||||
connect(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)));
|
||||||
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
connect(ui.actionLaunch_OLA_Setup, SIGNAL(triggered()), this, SLOT(olasetup()));
|
||||||
ola->registerUniverse();
|
ola->registerUniverse();
|
||||||
ola->start(QThread::TimeCriticalPriority );
|
ola->start(QThread::TimeCriticalPriority );
|
||||||
// menus
|
|
||||||
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||||
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
|
||||||
connect(ui.action_Settings, SIGNAL(triggered()), this, SLOT(settings()));
|
connect(ui.action_Settings, SIGNAL(triggered()), this, SLOT(settings()));
|
||||||
|
@ -85,21 +60,12 @@ libreMediaServerAudio::libreMediaServerAudio(QStringList args, QWidget *parent)
|
||||||
ola->resendDmx();
|
ola->resendDmx();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
// Destructor
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
libreMediaServerAudio::~libreMediaServerAudio()
|
libreMediaServerAudio::~libreMediaServerAudio()
|
||||||
{
|
{
|
||||||
ola->stop();
|
ola->stop();
|
||||||
aw->stopEngine();
|
aw->stopEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
// Menu File
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Open a configuration File
|
|
||||||
void libreMediaServerAudio::openFile()
|
void libreMediaServerAudio::openFile()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
|
@ -110,7 +76,7 @@ void libreMediaServerAudio::openFile()
|
||||||
QFile file(fileNames.at(0));
|
QFile file(fileNames.at(0));
|
||||||
// open(&file);
|
// open(&file);
|
||||||
}
|
}
|
||||||
// Save configuration File
|
|
||||||
void libreMediaServerAudio::saveFile()
|
void libreMediaServerAudio::saveFile()
|
||||||
{
|
{
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this);
|
||||||
|
@ -128,11 +94,6 @@ void libreMediaServerAudio::settings()
|
||||||
sd->show();
|
sd->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
// OLA Stuff
|
|
||||||
///////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void libreMediaServerAudio::olasetup()
|
void libreMediaServerAudio::olasetup()
|
||||||
{
|
{
|
||||||
QWebView *view = new QWebView();
|
QWebView *view = new QWebView();
|
||||||
|
@ -142,21 +103,20 @@ void libreMediaServerAudio::olasetup()
|
||||||
|
|
||||||
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
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)
|
if (layer > LAYER_CHANNELS)
|
||||||
return;
|
return;
|
||||||
QString mediaFile = NULL;
|
QString mediaFile = NULL;
|
||||||
int aux;
|
int aux;
|
||||||
qreal f;
|
qreal f;
|
||||||
|
int r;
|
||||||
switch(channel){
|
switch(channel){
|
||||||
case DMX_FOLDER:// Folder
|
case DMX_FOLDER:
|
||||||
aux = ola->getValue(layer, DMX_FILE);
|
aux = ola->getValue(layer, DMX_FILE);
|
||||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(value, aux);
|
mediaFile = MediaLibrary::getInstance()->requestNewFile(value, aux);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
aw->mediaLoaded(layer, mediaFile);
|
aw->mediaLoaded(layer, mediaFile);
|
||||||
break;
|
break;
|
||||||
case DMX_FILE:// File
|
case DMX_FILE:
|
||||||
aux = ola->getValue(layer, DMX_FOLDER);
|
aux = ola->getValue(layer, DMX_FOLDER);
|
||||||
mediaFile = MediaLibrary::getInstance()->requestNewFile(aux, value);
|
mediaFile = MediaLibrary::getInstance()->requestNewFile(aux, value);
|
||||||
if (QFile::exists(mediaFile))
|
if (QFile::exists(mediaFile))
|
||||||
|
@ -176,6 +136,14 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
case PITCH:
|
case PITCH:
|
||||||
aw->pitchChanged(layer, value);
|
aw->pitchChanged(layer, value);
|
||||||
break;
|
break;
|
||||||
|
case ENTRY_POINT_COARSE:
|
||||||
|
r = ( value * 0x100 ) + ola->getValue(layer, ENTRY_POINT_FINE);
|
||||||
|
aw->entryPointChanged(layer, r);
|
||||||
|
break;
|
||||||
|
case ENTRY_POINT_FINE:
|
||||||
|
r = ( ola->getValue(layer, ENTRY_POINT_COARSE) * 0x100 ) + value;
|
||||||
|
aw->entryPointChanged(layer, r);
|
||||||
|
break;
|
||||||
case PLAYBACK:
|
case PLAYBACK:
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -193,6 +161,8 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||||
case 3 :
|
case 3 :
|
||||||
aw->playbackChanged(layer, PlayingLoop);
|
aw->playbackChanged(layer, PlayingLoop);
|
||||||
break;
|
break;
|
||||||
|
default :
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#ifndef LIBREMEDIASERVERAUDIO_H
|
#ifndef LIBREMEDIASERVERAUDIO_H
|
||||||
#define LIBREMEDIASERVERAUDIO_H
|
#define LIBREMEDIASERVERAUDIO_H
|
||||||
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -38,7 +37,7 @@
|
||||||
#include "medialibrary.h"
|
#include "medialibrary.h"
|
||||||
#include "olathread.h"
|
#include "olathread.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "audiomasterwidget.h"
|
#include "dmxwidget.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
|
@ -56,9 +55,8 @@ public:
|
||||||
Ui::LibreMediaServerAudio ui;
|
Ui::LibreMediaServerAudio ui;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// void MessageHandler(QtMsgType type, const QMessageLogContext &logcontext, const QString &msg);
|
|
||||||
AudioWidget *aw;
|
AudioWidget *aw;
|
||||||
AudioMasterWidget *amw;
|
dmxWidget *m_dmxWidget;
|
||||||
olaThread *ola;
|
olaThread *ola;
|
||||||
|
|
||||||
void open_start();
|
void open_start();
|
||||||
|
@ -75,6 +73,7 @@ private slots:
|
||||||
void openFile();
|
void openFile();
|
||||||
void saveFile();
|
void saveFile();
|
||||||
void settings();
|
void settings();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIBREMEDIASERVERAUDIO_H
|
#endif // LIBREMEDIASERVERAUDIO_H
|
||||||
|
|
|
@ -42,9 +42,6 @@ void MediaLibrary::initMediaLibrary() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fill the struct with all files in one library/folder
|
|
||||||
*/
|
|
||||||
QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||||
{
|
{
|
||||||
QList<MediaFile> mediaList;
|
QList<MediaFile> mediaList;
|
||||||
|
@ -54,7 +51,6 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||||
QFileInfo fileInfo;
|
QFileInfo fileInfo;
|
||||||
for (int i = 0; i < filelist.size(); ++i) {
|
for (int i = 0; i < filelist.size(); ++i) {
|
||||||
fileInfo = filelist.at(i);
|
fileInfo = filelist.at(i);
|
||||||
// Update the data base with the new file
|
|
||||||
mediainf.Number = i;
|
mediainf.Number = i;
|
||||||
mediainf.MediaName = fileInfo.absoluteFilePath();
|
mediainf.MediaName = fileInfo.absoluteFilePath();
|
||||||
mediainf.MediaLength = 1000;
|
mediainf.MediaLength = 1000;
|
||||||
|
@ -63,9 +59,6 @@ QList<MediaFile> MediaLibrary::getMediaInformation(QDir dir)
|
||||||
return mediaList;
|
return mediaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the path to a media file from the library.
|
|
||||||
*/
|
|
||||||
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 to media library");
|
qWarning("MediaLibrary is not init. Set a correct path to media library");
|
||||||
|
|
|
@ -236,3 +236,16 @@ void MiniAudioEngine::playbackChanged(int layer, Status status)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MiniAudioEngine::setCursor(int layer, int cursor)
|
||||||
|
{
|
||||||
|
ma_uint64 f;
|
||||||
|
|
||||||
|
if (m_mediaLoaded[layer] == false)
|
||||||
|
return;
|
||||||
|
ma_sound_get_length_in_pcm_frames(&m_currentSound[layer], &f);
|
||||||
|
f = (cursor * f) / 65025;
|
||||||
|
ma_sound_seek_to_pcm_frame(&m_currentSound[layer], f);
|
||||||
|
//ma_sound_set_start_time_in_pcm_frames(&m_currentSound[layer], f);
|
||||||
|
//ma_data_source_set_range_in_pcm_frames(&m_currentSound[layer], f, total);
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ protected:
|
||||||
void playbackChanged(int layer, Status status);
|
void playbackChanged(int layer, Status status);
|
||||||
float getDuration(int layer);
|
float getDuration(int layer);
|
||||||
float getCursor(int layer);
|
float getCursor(int layer);
|
||||||
|
void setCursor(int layer, int cursor);
|
||||||
ma_result printFormatInfo(int layer);
|
ma_result printFormatInfo(int layer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -75,6 +75,7 @@ void olaThread::NewDmx(const ola::client::DMXMetadata &data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit universeReceived(data.universe);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -97,6 +97,7 @@ public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dmxOutput(int layer, int channel, int value);
|
void dmxOutput(int layer, int channel, int value);
|
||||||
|
void universeReceived(int uni);
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace ola;
|
using namespace ola;
|
||||||
|
|
|
@ -89,9 +89,6 @@ void Settings::readFromFile(QString file) {
|
||||||
delete xmlFile;
|
delete xmlFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read the default file
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Settings::readFile() {
|
void Settings::readFile() {
|
||||||
readFromFile(DEFAULT_FILE);
|
readFromFile(DEFAULT_FILE);
|
||||||
}
|
}
|
||||||
|
|
146
src/settings.h
146
src/settings.h
|
@ -11,157 +11,49 @@
|
||||||
#include "audiowidget.h"
|
#include "audiowidget.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* This class stores the settings on lms.
|
|
||||||
* Is a singleton with set and get methods to manage the settings
|
|
||||||
* Also writes and reads the settings files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Settings : public QObject
|
class Settings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static Settings *getInstance();
|
||||||
static Settings *getInstance(); //Singleton
|
inline QSet<int> getUniverses() { return m_universe; }
|
||||||
|
inline QString getPathMedia() { return m_pathmedia; }
|
||||||
/**
|
void setPathMedia(QString path);
|
||||||
* @brief getUniverses
|
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
||||||
* @return
|
inline int getLayersNumber() { return m_layersNumber; }
|
||||||
*/
|
inline int getUniverseNumber() { return m_universe.size(); }
|
||||||
inline QSet<int> getUniverses() { return m_universe; }
|
void readFile();
|
||||||
|
void changeLayerSetup(int layer, int universe, int address);
|
||||||
/**
|
void removeLayer(int layer);
|
||||||
* @brief getPathMedia
|
void addLayer();
|
||||||
* @return
|
inline void setLayersNumber(int layersNumber)
|
||||||
*/
|
{
|
||||||
inline QString getPathMedia() { return m_pathmedia; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief setPathMedia
|
|
||||||
* @param path
|
|
||||||
*/
|
|
||||||
void setPathMedia(QString path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief getDmxSettings
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline QList<dmxSetting> getDmxSettings() { return m_settings; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the number of layer currently used
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline int getLayersNumber() { return m_layersNumber; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the number of universes registered
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
inline int getUniverseNumber() { return m_universe.size(); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read the default xml configuration file at startup
|
|
||||||
*/
|
|
||||||
void readFile();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief changeLayerSetup
|
|
||||||
* @param layer
|
|
||||||
* @param universe
|
|
||||||
* @param address
|
|
||||||
*/
|
|
||||||
void changeLayerSetup(int layer, int universe, int address);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief removeLayer
|
|
||||||
* @param layer
|
|
||||||
*/
|
|
||||||
void removeLayer(int layer);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief addLayer
|
|
||||||
*/
|
|
||||||
void addLayer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief olaThread::setLayersNumber
|
|
||||||
* @param layersNumber
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
inline void setLayersNumber(int layersNumber)
|
|
||||||
{
|
|
||||||
if (layersNumber <= MAX_LAYERS)
|
if (layersNumber <= MAX_LAYERS)
|
||||||
m_layersNumber = layersNumber;
|
m_layersNumber = layersNumber;
|
||||||
else
|
else
|
||||||
m_layersNumber = MAX_LAYERS;
|
m_layersNumber = MAX_LAYERS;
|
||||||
}
|
}
|
||||||
|
inline int getAudioDeviceId() { return m_audioDeviceId; }
|
||||||
inline int getAudioDeviceId() { return m_audioDeviceId; }
|
inline void setAudioDeviceId(int id) { m_audioDeviceId = id; }
|
||||||
inline void setAudioDeviceId(int id) { m_audioDeviceId = id; }
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static Settings *_instance;
|
static Settings *_instance;
|
||||||
|
|
||||||
// The list where we store the settings by layer
|
|
||||||
QList<dmxSetting> m_settings;
|
QList<dmxSetting> m_settings;
|
||||||
|
|
||||||
// The path to media library
|
|
||||||
QString m_pathmedia;
|
QString m_pathmedia;
|
||||||
|
|
||||||
// The SO audio device id used
|
|
||||||
uint m_audioDeviceId;
|
uint m_audioDeviceId;
|
||||||
|
QSet<int> m_universe;
|
||||||
|
int m_layersNumber;
|
||||||
|
|
||||||
/** Constructor
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
explicit Settings(QObject *parent = 0);
|
explicit Settings(QObject *parent = 0);
|
||||||
|
void readFromFile(QString file);
|
||||||
QSet<int> m_universe; // Registered universes.
|
|
||||||
|
|
||||||
int m_layersNumber; // Number of layers in wich divide the dmx frame. Each layer, one source.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief readFromFile
|
|
||||||
* @param file
|
|
||||||
*/
|
|
||||||
void readFromFile(QString file);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief writeFile
|
|
||||||
* @param filename
|
|
||||||
*/
|
|
||||||
// void writeFile(QString filename); // Not implemented yet
|
// void writeFile(QString filename); // Not implemented yet
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief writeFile
|
|
||||||
* overload
|
|
||||||
*/
|
|
||||||
// void writeFile(); // Not implemented yet
|
// void writeFile(); // Not implemented yet
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief pathChanged
|
|
||||||
* @param path
|
|
||||||
*/
|
|
||||||
void pathChanged(QString path);
|
void pathChanged(QString path);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief layersNumber
|
|
||||||
* @param number
|
|
||||||
*/
|
|
||||||
void layersNumber(int number);
|
void layersNumber(int number);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief DMXConf
|
|
||||||
* @param universe
|
|
||||||
*/
|
|
||||||
void registerUniverse(int universe);
|
void registerUniverse(int universe);
|
||||||
|
|
||||||
void audioDeviceChanged(int id);
|
void audioDeviceChanged(int id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
30
src/slidergroup.cpp
Normal file
30
src/slidergroup.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include "slidergroup.h"
|
||||||
|
|
||||||
|
SliderGroup::SliderGroup(const QString &title, \
|
||||||
|
int min,
|
||||||
|
int max,
|
||||||
|
QWidget *parent)
|
||||||
|
: QGroupBox(title, parent)
|
||||||
|
{
|
||||||
|
this->setFlat(true);
|
||||||
|
this->setTitle(title);
|
||||||
|
slider = new QSlider(Qt::Orientation::Vertical);
|
||||||
|
slider->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
slider->setTickPosition(QSlider::TicksBothSides);
|
||||||
|
slider->setTickInterval((max - min) / 11);
|
||||||
|
slider->setSingleStep(1);
|
||||||
|
slider->setRange(min, max);
|
||||||
|
//slider->setInvertedAppearance(false);
|
||||||
|
//slider->setInvertedControls(false);
|
||||||
|
valueBox = new QSpinBox();
|
||||||
|
valueBox->setFocusPolicy(Qt::NoFocus);
|
||||||
|
valueBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
|
valueBox->setMaximumWidth(40);
|
||||||
|
valueBox->setRange(min, max);
|
||||||
|
connect(slider, &QSlider::valueChanged, valueBox, &QSpinBox::setValue);
|
||||||
|
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
|
||||||
|
QVBoxLayout *slidersLayout = new QVBoxLayout();
|
||||||
|
slidersLayout->addWidget(valueBox);
|
||||||
|
slidersLayout->addWidget(slider);
|
||||||
|
setLayout(slidersLayout);
|
||||||
|
}
|
38
src/slidergroup.h
Normal file
38
src/slidergroup.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef SLIDERGROUP_H
|
||||||
|
#define SLIDERGROUP_H
|
||||||
|
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QBoxLayout>
|
||||||
|
#include <QSlider>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QDial;
|
||||||
|
class QScrollBar;
|
||||||
|
class QSlider;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class SliderGroup : public QGroupBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SliderGroup(const QString &title,
|
||||||
|
int min,
|
||||||
|
int max,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void valueChanged(int value);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
inline void setValue(int value) { slider->setValue(value); };
|
||||||
|
inline void sliderValueChanged(int value) { emit valueChanged(value); };
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSlider *slider;
|
||||||
|
QSpinBox *valueBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue