Compare commits
4 commits
52b44a4d7c
...
84702c5e44
Author | SHA1 | Date | |
---|---|---|---|
|
84702c5e44 | ||
|
3b98be8b14 | ||
|
bd9b07f000 | ||
|
333d7c7b49 |
19 changed files with 375 additions and 443 deletions
|
@ -2,8 +2,8 @@ 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/editcuetrackwidget.h \
|
||||||
src/cuetracklistwidget.h \
|
src/cuetracklistwidget.h \
|
||||||
src/cuetrackwidget.h \
|
|
||||||
src/showplayer.h \
|
src/showplayer.h \
|
||||||
src/clickabledoublespinbox.h \
|
src/clickabledoublespinbox.h \
|
||||||
src/clickablelabel.h \
|
src/clickablelabel.h \
|
||||||
|
@ -23,10 +23,9 @@ HEADERS += src/libremediaserver-audio.h \
|
||||||
src/audiowidget.h \
|
src/audiowidget.h \
|
||||||
src/defines.h \
|
src/defines.h \
|
||||||
src/settings.h \
|
src/settings.h \
|
||||||
src/slidergroup.h \
|
src/slidergroup.h
|
||||||
src/trackdialog.h
|
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/cuetrackwidget.cpp \
|
src/editcuetrackwidget.cpp \
|
||||||
src/showplayer.cpp \
|
src/showplayer.cpp \
|
||||||
src/clickabledoublespinbox.cpp \
|
src/clickabledoublespinbox.cpp \
|
||||||
src/clickablelabel.cpp \
|
src/clickablelabel.cpp \
|
||||||
|
@ -43,8 +42,7 @@ SOURCES += src/main.cpp \
|
||||||
src/audiolayerwidget.cpp \
|
src/audiolayerwidget.cpp \
|
||||||
src/audiowidget.cpp \
|
src/audiowidget.cpp \
|
||||||
src/settings.cpp \
|
src/settings.cpp \
|
||||||
src/slidergroup.cpp \
|
src/slidergroup.cpp
|
||||||
src/trackdialog.cpp
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/showplayer.ui \
|
src/showplayer.ui \
|
||||||
src/libremediaserver-audio-ui.ui
|
src/libremediaserver-audio-ui.ui
|
||||||
|
@ -59,3 +57,6 @@ OTHER_FILES += \
|
||||||
docs/changelog.txt \
|
docs/changelog.txt \
|
||||||
docs/lms-audio.xlm \
|
docs/lms-audio.xlm \
|
||||||
docs/roadmap.txt
|
docs/roadmap.txt
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
src/cuetracklistwidget.cpp
|
||||||
|
|
|
@ -275,10 +275,10 @@ void AudioLayerWidget::setMediaFile(QString file)
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
if (size >= 2) {
|
if (size >= 2) {
|
||||||
QString tmp = list.at(size - 2);
|
QString tmp = list.at(size - 2);
|
||||||
tmp.truncate(60);
|
tmp.truncate(64);
|
||||||
m_folderValue->setText(tmp);
|
m_folderValue->setText(tmp);
|
||||||
tmp = list.at(size - 1);
|
tmp = list.at(size - 1);
|
||||||
tmp.truncate(40);
|
tmp.truncate(64);
|
||||||
m_fileValue->setText(tmp);
|
m_fileValue->setText(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,5 @@
|
||||||
ClickableDoubleSpinBox::ClickableDoubleSpinBox(QWidget *parent)
|
ClickableDoubleSpinBox::ClickableDoubleSpinBox(QWidget *parent)
|
||||||
: QDoubleSpinBox(parent)
|
: QDoubleSpinBox(parent)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::NoFocus);
|
|
||||||
setButtonSymbols(QAbstractSpinBox::NoButtons);
|
|
||||||
setValue(-1);
|
|
||||||
setDecimals(1);
|
|
||||||
setAlignment(Qt::AlignHCenter);
|
|
||||||
setContentsMargins(0, 0, 0, 0);
|
|
||||||
setMaximumWidth(66);
|
|
||||||
setMinimumWidth(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,20 @@ class ClickableDoubleSpinBox : public QDoubleSpinBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
bool active = false;
|
||||||
|
|
||||||
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
|
explicit ClickableDoubleSpinBox(QWidget *parent = nullptr);
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent ( QMouseEvent * event ) {
|
void mousePressEvent ( QMouseEvent * event ) {
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
emit click();
|
emit click();
|
||||||
|
active = true;
|
||||||
|
//this->setBackgroundRole(QPalette::BrightText);
|
||||||
|
|
||||||
|
} else if (event->button() == Qt::RightButton) {
|
||||||
|
emit click();
|
||||||
|
active = false;
|
||||||
|
//this->setBackgroundRole(QPalette::Shadow);
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,94 +1,46 @@
|
||||||
#ifndef CUETRACKLISTWIDGET_H
|
#ifndef CUETRACKLISTWIDGET_H
|
||||||
#define CUETRACKLISTWIDGET_H
|
#define CUETRACKLISTWIDGET_H
|
||||||
|
#include <vector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include "cuetrackwidget.h"
|
#include <QTableWidget>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
#include "defines.h"
|
||||||
|
#include "editcuetrackwidget.h"
|
||||||
|
|
||||||
class CueTrackListWidget : public QWidget {
|
class CueTrackListWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
size_t m_size = 0;
|
explicit CueTrackListWidget(QWidget *parent = nullptr);
|
||||||
size_t size() const { return m_size; }
|
CueTrack* getSelectedTrack();
|
||||||
size_t selectedIndex = 0;
|
void createNewCueTrack();
|
||||||
|
void editCueTrack();
|
||||||
explicit CueTrackListWidget(QWidget *parent = nullptr) : QWidget(parent) {
|
void deleteCueTrack();
|
||||||
layout = new QVBoxLayout();
|
|
||||||
containerWidget = new QWidget();
|
|
||||||
containerWidget->setLayout(layout);
|
|
||||||
|
|
||||||
scrollArea = new QScrollArea(this);
|
|
||||||
scrollArea->setWidgetResizable(true);
|
|
||||||
scrollArea->setWidget(containerWidget);
|
|
||||||
|
|
||||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
|
||||||
mainLayout->addWidget(scrollArea);
|
|
||||||
layout->setAlignment(Qt::AlignTop);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
QShortcut *shortcut_up = new QShortcut(QKeySequence("Up"), parent);
|
|
||||||
QObject::connect(shortcut_up, SIGNAL(activated()), this, SLOT(key_up()));
|
|
||||||
QShortcut *shortcut_down = new QShortcut(QKeySequence("Down"), parent);
|
|
||||||
QObject::connect(shortcut_down, SIGNAL(activated()), this, SLOT(key_down()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void addCueTrackWidget(CueTrackWidget* widget) {
|
|
||||||
widget->setParent(containerWidget);
|
|
||||||
layout->addWidget(widget);
|
|
||||||
widget->show();
|
|
||||||
m_size++;
|
|
||||||
containerWidget->update();
|
|
||||||
containerWidget->adjustSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeCueTrackWidget(size_t index) {
|
|
||||||
if (index >= m_size) return;
|
|
||||||
|
|
||||||
QLayoutItem* item = layout->takeAt(index);
|
|
||||||
if (item) {
|
|
||||||
delete item->widget();
|
|
||||||
delete item;
|
|
||||||
m_size--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CueTrackWidget* getTrackAtIndex(size_t index) {
|
|
||||||
if (index < m_size) {
|
|
||||||
return qobject_cast<CueTrackWidget*>(layout->itemAt(index)->widget());
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CueTrackWidget* getSelectedTrack() {
|
|
||||||
CueTrackWidget* track = getTrackAtIndex(selectedIndex);
|
|
||||||
key_down();
|
|
||||||
return track;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScrollArea* scrollArea;
|
std::vector<CueTrack *> cueTracks;
|
||||||
QWidget* containerWidget;
|
|
||||||
QVBoxLayout* layout;
|
QVBoxLayout* layout;
|
||||||
|
QTableWidget* tableWidget;
|
||||||
|
int m_size = 0;
|
||||||
|
int size() { return m_size; }
|
||||||
|
int selectedIndex = 0;
|
||||||
|
size_t lastUserCueNumber = 0;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void key_up() {
|
void addCueTrack(CueTrack* cue);
|
||||||
if (m_size > 0 && selectedIndex > 0) {
|
void removeCueTrack(int index);
|
||||||
getTrackAtIndex(selectedIndex)->highlight(false);
|
CueTrack* getTrackAtIndex(int index);
|
||||||
selectedIndex--;
|
void key_up();
|
||||||
getTrackAtIndex(selectedIndex)->highlight(true);
|
void key_down();
|
||||||
}
|
void displayCueTrackInTable(CueTrack *cueTrack);
|
||||||
}
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
void updateSelectedCueTrack(bool highlightRow);
|
||||||
void key_down() {
|
void cueTrackLoadDefaults(CueTrack * t);
|
||||||
if (selectedIndex < m_size - 1 && m_size > 0) {
|
void copyCueTrack(CueTrack *src, CueTrack *dst);
|
||||||
getTrackAtIndex(selectedIndex)->highlight(false);
|
|
||||||
selectedIndex++;
|
|
||||||
getTrackAtIndex(selectedIndex)->highlight(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,178 +0,0 @@
|
||||||
#include "cuetrackwidget.h"
|
|
||||||
#include <QSplitter>
|
|
||||||
|
|
||||||
CueTrackWidget::CueTrackWidget(QWidget *parent) : QWidget(parent) {
|
|
||||||
setupUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CueTrackWidget::setupUi() {
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
||||||
|
|
||||||
QSplitter *row = new QSplitter(Qt::Horizontal);
|
|
||||||
active = new QCheckBox(this);
|
|
||||||
row->addWidget(active);
|
|
||||||
|
|
||||||
userNumberSpin = new QSpinBox(this);
|
|
||||||
userNumberSpin->setRange(0, 1000);
|
|
||||||
userNumberSpin->setToolTip("Cue user number");
|
|
||||||
row->addWidget(userNumberSpin);
|
|
||||||
|
|
||||||
nameEdit = new QLineEdit(this);
|
|
||||||
nameEdit->setToolTip("Cue Name");
|
|
||||||
row->addWidget(nameEdit);
|
|
||||||
|
|
||||||
descriptionEdit = new QLineEdit(this);
|
|
||||||
descriptionEdit->setToolTip("Cue Notes");
|
|
||||||
row->addWidget(descriptionEdit);
|
|
||||||
|
|
||||||
filePathEdit = new QLineEdit(this);
|
|
||||||
filePathEdit->setToolTip("File name");
|
|
||||||
row->addWidget(filePathEdit);
|
|
||||||
|
|
||||||
layout->addWidget(row);
|
|
||||||
|
|
||||||
row = new QSplitter(Qt::Horizontal);
|
|
||||||
volumeSpin = new QSpinBox(this);
|
|
||||||
volumeSpin->setRange(0, 65535);
|
|
||||||
volumeSpin->setToolTip("Volume");
|
|
||||||
volumeSpin->setValue(100);
|
|
||||||
row->addWidget(volumeSpin);
|
|
||||||
|
|
||||||
bus1Spin = new QSpinBox(this);
|
|
||||||
bus1Spin->setRange(0, 255);
|
|
||||||
bus1Spin->setToolTip("Bus 1");
|
|
||||||
bus1Spin->setValue(255);
|
|
||||||
row->addWidget(bus1Spin);
|
|
||||||
|
|
||||||
bus2Spin = new QSpinBox(this);
|
|
||||||
bus2Spin->setRange(0, 255);
|
|
||||||
bus2Spin->setToolTip("Bus 2");
|
|
||||||
bus2Spin->setValue(255);
|
|
||||||
row->addWidget(bus2Spin);
|
|
||||||
|
|
||||||
panSpin = new QSpinBox(this);
|
|
||||||
panSpin->setRange(0, 255);
|
|
||||||
panSpin->setToolTip("Pan");
|
|
||||||
panSpin->setValue(128);
|
|
||||||
row->addWidget(panSpin);
|
|
||||||
|
|
||||||
pitchSpin = new QSpinBox(this);
|
|
||||||
pitchSpin->setRange(0, 255);
|
|
||||||
pitchSpin->setToolTip("Pitch");
|
|
||||||
pitchSpin->setValue(128);
|
|
||||||
row->addWidget(pitchSpin);
|
|
||||||
|
|
||||||
entryPointSpin = new QSpinBox(this);
|
|
||||||
entryPointSpin->setRange(0, 255);
|
|
||||||
entryPointSpin->setToolTip("Entry Point");
|
|
||||||
row->addWidget(entryPointSpin);
|
|
||||||
|
|
||||||
exitPointSpin = new QSpinBox(this);
|
|
||||||
exitPointSpin->setRange(0, 255);
|
|
||||||
exitPointSpin->setToolTip("Exit Point");
|
|
||||||
exitPointSpin->setValue(255);
|
|
||||||
row->addWidget(exitPointSpin);
|
|
||||||
|
|
||||||
layout->addWidget(row);
|
|
||||||
|
|
||||||
row = new QSplitter(Qt::Horizontal);
|
|
||||||
setupStatusCombo();
|
|
||||||
statusCombo->setToolTip("Playback Status");
|
|
||||||
row->addWidget(statusCombo);
|
|
||||||
|
|
||||||
fadeInSpin = new QSpinBox(this);
|
|
||||||
fadeInSpin->setRange(0, 10000);
|
|
||||||
fadeInSpin->setToolTip("Fade In Time");
|
|
||||||
fadeInSpin->setValue(3);
|
|
||||||
row->addWidget(fadeInSpin);
|
|
||||||
|
|
||||||
fadeOutSpin = new QSpinBox(this);
|
|
||||||
fadeOutSpin->setRange(0, 10000);
|
|
||||||
fadeOutSpin->setToolTip("Fade Out Time");
|
|
||||||
fadeOutSpin->setValue(3);
|
|
||||||
row->addWidget(fadeOutSpin);
|
|
||||||
|
|
||||||
waitInSpin = new QSpinBox(this);
|
|
||||||
waitInSpin->setRange(0, 10000);
|
|
||||||
waitInSpin->setToolTip("Wait In Time");
|
|
||||||
row->addWidget(waitInSpin);
|
|
||||||
|
|
||||||
waitOutSpin = new QSpinBox(this);
|
|
||||||
waitOutSpin->setRange(0, 10000);
|
|
||||||
waitOutSpin->setToolTip("Wait Out Time");
|
|
||||||
row->addWidget(waitOutSpin);
|
|
||||||
|
|
||||||
stopAtEndCheck = new QCheckBox(this);
|
|
||||||
stopAtEndCheck->setToolTip("Halt");
|
|
||||||
stopAtEndCheck->setChecked("True");
|
|
||||||
row->addWidget(stopAtEndCheck);
|
|
||||||
|
|
||||||
layout->addWidget(row);
|
|
||||||
|
|
||||||
setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *CueTrackWidget::createHeader()
|
|
||||||
{
|
|
||||||
QWidget *ret = new QWidget();
|
|
||||||
|
|
||||||
auto layout = new QHBoxLayout(this);
|
|
||||||
QLabel *l = new QLabel("Cue Number");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("File Path");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Volume");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Bus 1");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Bus 2");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Pan");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Pitch");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Playback Status");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Fade In");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Fade Out");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Wait In");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Wait Out ");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Halt");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Name");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Notes");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Entry Point");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Exit Point");
|
|
||||||
layout->addWidget(l);
|
|
||||||
ret->setLayout(layout);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CueTrackWidget::setupStatusCombo() {
|
|
||||||
statusCombo = new QComboBox(this);
|
|
||||||
statusCombo->addItem("Stopped", Stopped);
|
|
||||||
statusCombo->addItem("Paused", Paused);
|
|
||||||
statusCombo->addItem("PlayingOnce", PlayingOnce);
|
|
||||||
statusCombo->addItem("PlayingLoop", PlayingLoop);
|
|
||||||
statusCombo->addItem("Iddle", Iddle);
|
|
||||||
statusCombo->addItem("PlayingFolder", PlayingFolder);
|
|
||||||
statusCombo->addItem("PlayingFolderLoop", PlayingFolderLoop);
|
|
||||||
statusCombo->addItem("PlayingFolderRandom", PlayingFolderRandom);
|
|
||||||
}
|
|
||||||
|
|
||||||
CueTrack CueTrackWidget::saveCueTrack() const {
|
|
||||||
CueTrack cueTrack;
|
|
||||||
cueTrack.filePath = filePathEdit->text().toStdString();
|
|
||||||
cueTrack.volume = volumeSpin->value();
|
|
||||||
// Guarda el resto de los campos aquí...
|
|
||||||
|
|
||||||
cueTrack.status = static_cast<Status>(statusCombo->currentData().toInt());
|
|
||||||
return cueTrack;
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
#ifndef CUETRACKWIDGET_H
|
|
||||||
#define CUETRACKWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QFormLayout>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include "defines.h"
|
|
||||||
|
|
||||||
class CueTrackWidget : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit CueTrackWidget(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
CueTrack saveCueTrack() const;
|
|
||||||
QWidget *createHeader();
|
|
||||||
int audioLayer = 0;
|
|
||||||
|
|
||||||
int getVolume() const { return volumeSpin->value(); }
|
|
||||||
int getPan() const { return panSpin->value(); }
|
|
||||||
int getPitch() const { return pitchSpin->value(); }
|
|
||||||
int getBus1() const { return bus1Spin->value(); }
|
|
||||||
int getBus2() const { return bus2Spin->value(); }
|
|
||||||
Status getStatus() const { return static_cast<Status>(statusCombo->currentIndex()); }
|
|
||||||
QString getFilePath() const { return filePathEdit->text(); }
|
|
||||||
void setFilePath(QString text) const { filePathEdit->setText(text);};
|
|
||||||
int getFadeIn() const { return fadeInSpin->value(); }
|
|
||||||
int getFadeOut() const { return fadeOutSpin->value(); }
|
|
||||||
int getWaitIn() const { return waitInSpin->value(); }
|
|
||||||
int getWaitOut() const { return waitOutSpin->value(); }
|
|
||||||
bool getStopAtEnd() const { return stopAtEndCheck->isChecked(); }
|
|
||||||
QString getName() const { return nameEdit->text(); }
|
|
||||||
QString getDescription() const { return descriptionEdit->text(); }
|
|
||||||
int getUserNumber() const { return userNumberSpin->value(); }
|
|
||||||
int getEntryPoint() const { return entryPointSpin->value(); }
|
|
||||||
int getExitPoint() const { return exitPointSpin->value(); }
|
|
||||||
void highlight(bool highlight) {
|
|
||||||
if (highlight)
|
|
||||||
this->setStyleSheet("background-color: yellow;");
|
|
||||||
else
|
|
||||||
this->setStyleSheet("background-color: white;");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QCheckBox* active;
|
|
||||||
QLineEdit* filePathEdit;
|
|
||||||
QSpinBox* volumeSpin;
|
|
||||||
QSpinBox* panSpin;
|
|
||||||
QSpinBox* pitchSpin;
|
|
||||||
QSpinBox* bus1Spin;
|
|
||||||
QSpinBox* bus2Spin;
|
|
||||||
QComboBox* statusCombo;
|
|
||||||
QSpinBox* fadeOutSpin;
|
|
||||||
QSpinBox* fadeInSpin;
|
|
||||||
QSpinBox* waitInSpin;
|
|
||||||
QSpinBox* waitOutSpin;
|
|
||||||
QCheckBox* stopAtEndCheck;
|
|
||||||
QLineEdit* nameEdit;
|
|
||||||
QLineEdit* descriptionEdit;
|
|
||||||
QSpinBox* userNumberSpin;
|
|
||||||
QSpinBox* entryPointSpin;
|
|
||||||
QSpinBox* exitPointSpin;
|
|
||||||
|
|
||||||
void setupUi();
|
|
||||||
void setupStatusCombo();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CUETRACKWIDGET_H
|
|
|
@ -112,6 +112,7 @@ struct CueTrack {
|
||||||
int entryPoint; // 0 - 255
|
int entryPoint; // 0 - 255
|
||||||
int exitPoint; // 0 - 255
|
int exitPoint; // 0 - 255
|
||||||
int audioLayer; // internal audio layer used when cue is loaded
|
int audioLayer; // internal audio layer used when cue is loaded
|
||||||
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
139
src/editcuetrackwidget.cpp
Normal file
139
src/editcuetrackwidget.cpp
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
#include "editcuetrackwidget.h"
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
EditCueTrackWidget::EditCueTrackWidget(CueTrack *cueTrack, QWidget *parent)
|
||||||
|
: QDialog(parent) {
|
||||||
|
setupUi();
|
||||||
|
connectSignals();
|
||||||
|
this->cueTrack = cueTrack;
|
||||||
|
loadCueTrack(*cueTrack);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::setupUi() {
|
||||||
|
userNumberSpin = new QSpinBox(this);
|
||||||
|
nameEdit = new QLineEdit(this);
|
||||||
|
audioLayerSpin = new QSpinBox(this);
|
||||||
|
audioLayerSpin->setRange(0, MAX_LAYERS - 1);
|
||||||
|
filePathEdit = new QLineEdit(this);
|
||||||
|
statusCombo = new QComboBox(this);
|
||||||
|
volumeSpin = new QDoubleSpinBox(this);
|
||||||
|
volumeSpin->setRange(0, 100.01f);
|
||||||
|
panSpin = new QDoubleSpinBox(this);
|
||||||
|
pitchSpin = new QDoubleSpinBox(this);
|
||||||
|
bus1Spin = new QDoubleSpinBox(this);
|
||||||
|
bus1Spin->setRange(0, 100.01f);
|
||||||
|
bus2Spin = new QDoubleSpinBox(this);
|
||||||
|
bus2Spin->setRange(0, 100.01f);
|
||||||
|
fadeInSpin = new QSpinBox(this);
|
||||||
|
fadeOutSpin = new QSpinBox(this);
|
||||||
|
waitInSpin = new QSpinBox(this);
|
||||||
|
waitOutSpin = new QSpinBox(this);
|
||||||
|
stopAtEndCheck = new QCheckBox(this);
|
||||||
|
descriptionEdit = new QLineEdit(this);
|
||||||
|
entryPointSpin = new QSpinBox(this);
|
||||||
|
exitPointSpin = new QSpinBox(this);
|
||||||
|
statusCombo->addItem("Stopped");
|
||||||
|
statusCombo->addItem("Paused");
|
||||||
|
statusCombo->addItem("PlayingOnce");
|
||||||
|
statusCombo->addItem("PlayingLoop");
|
||||||
|
statusCombo->addItem("Iddle");
|
||||||
|
statusCombo->addItem("PlayingFolder");
|
||||||
|
statusCombo->addItem("PlayingFolderLoop");
|
||||||
|
statusCombo->addItem("PlayingFolderRandom");
|
||||||
|
statusCombo->addItem("PlayingFolderRandomLoop");
|
||||||
|
|
||||||
|
browseButton = new QPushButton("Browse...", this);
|
||||||
|
saveButton = new QPushButton("Save", this);
|
||||||
|
cancelButton = new QPushButton("Cancel", this);
|
||||||
|
|
||||||
|
QFormLayout *layout = new QFormLayout(this);
|
||||||
|
layout->addRow("User Number", userNumberSpin);
|
||||||
|
layout->addRow("Name", nameEdit);
|
||||||
|
layout->addRow("Audio Layer", audioLayerSpin);
|
||||||
|
layout->addRow("File Path", filePathEdit);
|
||||||
|
layout->addRow(browseButton);
|
||||||
|
layout->addRow("Status", statusCombo);
|
||||||
|
layout->addRow("Fade In", fadeInSpin);
|
||||||
|
layout->addRow("Fade Out", fadeOutSpin);
|
||||||
|
layout->addRow("Wait In", waitInSpin);
|
||||||
|
layout->addRow("Wait Out", waitOutSpin);
|
||||||
|
layout->addRow("Stop At End", stopAtEndCheck);
|
||||||
|
layout->addRow("Volume", volumeSpin);
|
||||||
|
layout->addRow("Bus 1", bus1Spin);
|
||||||
|
layout->addRow("Bus 2", bus2Spin);
|
||||||
|
layout->addRow("Pan", panSpin);
|
||||||
|
layout->addRow("Pitch", pitchSpin);
|
||||||
|
layout->addRow("Entry Point", entryPointSpin);
|
||||||
|
layout->addRow("Exit Point", exitPointSpin);
|
||||||
|
layout->addRow("Description", descriptionEdit);
|
||||||
|
layout->addRow(saveButton);
|
||||||
|
layout->addRow(cancelButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::loadCueTrack(CueTrack cueTrack) {
|
||||||
|
filePathEdit->setText(cueTrack.filePath.data());
|
||||||
|
volumeSpin->setValue(cueTrack.volume);
|
||||||
|
panSpin->setValue(cueTrack.pan);
|
||||||
|
pitchSpin->setValue(cueTrack.pitch);
|
||||||
|
bus1Spin->setValue(cueTrack.bus1);
|
||||||
|
bus2Spin->setValue(cueTrack.bus2);
|
||||||
|
fadeInSpin->setValue(cueTrack.fadeIn);
|
||||||
|
fadeOutSpin->setValue(cueTrack.fadeOut);
|
||||||
|
waitInSpin->setValue(cueTrack.waitIn);
|
||||||
|
waitOutSpin->setValue(cueTrack.waitOut);
|
||||||
|
stopAtEndCheck->setChecked(cueTrack.stopAtEnd);
|
||||||
|
nameEdit->setText(cueTrack.name.data());
|
||||||
|
descriptionEdit->setText(cueTrack.description.data());
|
||||||
|
userNumberSpin->setValue(cueTrack.userNumber);
|
||||||
|
entryPointSpin->setValue(cueTrack.entryPoint);
|
||||||
|
exitPointSpin->setValue(cueTrack.exitPoint);
|
||||||
|
statusCombo->setCurrentIndex(statusCombo->findText(statusToString(cueTrack.status)));
|
||||||
|
audioLayerSpin->setValue(cueTrack.audioLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
CueTrack EditCueTrackWidget::saveCueTrack() {
|
||||||
|
CueTrack cueTrack;
|
||||||
|
cueTrack.userNumber = userNumberSpin->value();
|
||||||
|
cueTrack.name.append(nameEdit->text().toUtf8().constData());
|
||||||
|
cueTrack.audioLayer = audioLayerSpin->value();
|
||||||
|
cueTrack.filePath.append(filePathEdit->text().toUtf8().constData());
|
||||||
|
cueTrack.status = static_cast<Status>(statusCombo->currentIndex());
|
||||||
|
cueTrack.fadeIn = fadeInSpin->value();
|
||||||
|
cueTrack.fadeOut = fadeOutSpin->value();
|
||||||
|
cueTrack.waitIn = waitInSpin->value();
|
||||||
|
cueTrack.waitOut = waitOutSpin->value();
|
||||||
|
cueTrack.stopAtEnd = stopAtEndCheck->isChecked();
|
||||||
|
cueTrack.entryPoint = entryPointSpin->value();
|
||||||
|
cueTrack.exitPoint = exitPointSpin->value();
|
||||||
|
cueTrack.volume = volumeSpin->value();
|
||||||
|
cueTrack.bus1 = bus1Spin->value();
|
||||||
|
cueTrack.bus2 = bus2Spin->value();
|
||||||
|
cueTrack.pan = panSpin->value();
|
||||||
|
cueTrack.pitch = pitchSpin->value();
|
||||||
|
cueTrack.description.append(descriptionEdit->text().toUtf8().constData());
|
||||||
|
return cueTrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::accept() {
|
||||||
|
*cueTrack = saveCueTrack();
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::connectSignals() {
|
||||||
|
connect(saveButton, &QPushButton::clicked, this, &EditCueTrackWidget::accept);
|
||||||
|
connect(cancelButton, &QPushButton::clicked, this, &EditCueTrackWidget::reject);
|
||||||
|
connect(browseButton, &QPushButton::clicked, this, &EditCueTrackWidget::onBrowseButtonClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCueTrackWidget::onBrowseButtonClicked() {
|
||||||
|
QString filePath = QFileDialog::getOpenFileName(this, tr("Select File"), Settings::getInstance()->getPathMedia(), tr("Audio Files (*.mp3 *.wav *.flac)"));
|
||||||
|
if (!filePath.isEmpty()) {
|
||||||
|
filePathEdit->setText(filePath);
|
||||||
|
QDir dir;
|
||||||
|
Settings::getInstance()->setPathMedia(dir.absoluteFilePath(filePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
54
src/editcuetrackwidget.h
Normal file
54
src/editcuetrackwidget.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef EDITCUETRACKWIDGET_H
|
||||||
|
#define EDITCUETRACKWIDGET_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
|
class EditCueTrackWidget : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit EditCueTrackWidget(CueTrack *cueTrack, QWidget *parent = nullptr);
|
||||||
|
CueTrack *cueTrack;
|
||||||
|
void loadCueTrack(CueTrack cueTrack);
|
||||||
|
CueTrack saveCueTrack();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupUi();
|
||||||
|
void connectSignals();
|
||||||
|
void onBrowseButtonClicked();
|
||||||
|
void accept() override;
|
||||||
|
|
||||||
|
QLineEdit *filePathEdit;
|
||||||
|
QDoubleSpinBox *volumeSpin;
|
||||||
|
QDoubleSpinBox *panSpin;
|
||||||
|
QDoubleSpinBox *pitchSpin;
|
||||||
|
QDoubleSpinBox *bus1Spin;
|
||||||
|
QDoubleSpinBox *bus2Spin;
|
||||||
|
QSpinBox *fadeInSpin;
|
||||||
|
QSpinBox *fadeOutSpin;
|
||||||
|
QSpinBox *waitInSpin;
|
||||||
|
QSpinBox *waitOutSpin;
|
||||||
|
QCheckBox *stopAtEndCheck;
|
||||||
|
QLineEdit *nameEdit;
|
||||||
|
QLineEdit *descriptionEdit;
|
||||||
|
QSpinBox *userNumberSpin;
|
||||||
|
QSpinBox *entryPointSpin;
|
||||||
|
QSpinBox *exitPointSpin;
|
||||||
|
QComboBox *statusCombo;
|
||||||
|
QSpinBox *audioLayerSpin;
|
||||||
|
QPushButton *browseButton;
|
||||||
|
QPushButton *saveButton;
|
||||||
|
QPushButton *cancelButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EDITCUETRACKWIDGET_H
|
|
@ -47,6 +47,14 @@ FilterBankWidget::FilterBankWidget(QWidget *parent)
|
||||||
} else {
|
} else {
|
||||||
fb[j]->setRange(-50, 50);
|
fb[j]->setRange(-50, 50);
|
||||||
}
|
}
|
||||||
|
fb[j]->setFocusPolicy(Qt::NoFocus);
|
||||||
|
fb[j]->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||||
|
fb[j]->setValue(-1);
|
||||||
|
fb[j]->setDecimals(1);
|
||||||
|
fb[j]->setAlignment(Qt::AlignHCenter);
|
||||||
|
fb[j]->setContentsMargins(0, 0, 0, 0);
|
||||||
|
fb[j]->setMaximumWidth(66);
|
||||||
|
fb[j]->setMinimumWidth(25);
|
||||||
filterLayout->insertWidget(j, fb[j]);
|
filterLayout->insertWidget(j, fb[j]);
|
||||||
}
|
}
|
||||||
filterLayout->setSpacing(0);
|
filterLayout->setSpacing(0);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
libreMediaServerAudio::libreMediaServerAudio()
|
libreMediaServerAudio::libreMediaServerAudio()
|
||||||
{
|
{
|
||||||
m_settings = Settings::getInstance();
|
m_settings = Settings::getInstance(this);
|
||||||
m_settings->readFile();
|
m_settings->readFile();
|
||||||
m_ui = m_settings->getShowUi();
|
m_ui = m_settings->getShowUi();
|
||||||
m_layersQty = m_settings->getLayersNumber();
|
m_layersQty = m_settings->getLayersNumber();
|
||||||
|
@ -280,7 +280,9 @@ void libreMediaServerAudio::uiLoadMedia(int layer, QString mediaFile)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|
||||||
if (strcmp(mediaFile.toLatin1().constData(), m_currentMedia[layer].toLatin1().constData()) == 0)
|
if (mediaFile.isEmpty())
|
||||||
|
return ;
|
||||||
|
if (mediaFile.compare(m_currentMedia[layer]) == 0)
|
||||||
return;
|
return;
|
||||||
result = m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
result = m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
||||||
if (result == MA_SUCCESS) {
|
if (result == MA_SUCCESS) {
|
||||||
|
|
|
@ -31,8 +31,12 @@ bool hasUi(int &argc, char *argv[])
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
libreMediaServerAudio lms;
|
libreMediaServerAudio lms;
|
||||||
|
app.setApplicationName("LibreMediaServerAudio");
|
||||||
|
app.setOrganizationName("Criptomart");
|
||||||
|
app.setOrganizationDomain("Criptomart.net");
|
||||||
|
app.setApplicationVersion(VERSION);
|
||||||
#ifndef NOGUI
|
#ifndef NOGUI
|
||||||
if (hasUi(argc, argv) || lms.getShowUi())
|
if (hasUi(argc, argv) || lms.getShowUi())
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool MiniAudioEngine::startEngine(uint layers, uint* audioDevicesId, uint audioD
|
||||||
m_mae.currentStatus[i].pitch = 128;
|
m_mae.currentStatus[i].pitch = 128;
|
||||||
m_mae.currentStatus[i].vol = 0.0f;
|
m_mae.currentStatus[i].vol = 0.0f;
|
||||||
m_mae.currentStatus[i].cursor = 0;
|
m_mae.currentStatus[i].cursor = 0;
|
||||||
m_mae.currentStatus[i].updated = false;
|
m_mae.currentStatus[i].updated = MA_FALSE;
|
||||||
}
|
}
|
||||||
result = this->startContext();
|
result = this->startContext();
|
||||||
if (result != MA_SUCCESS) return false;
|
if (result != MA_SUCCESS) return false;
|
||||||
|
@ -351,6 +351,8 @@ ma_result MiniAudioEngine::loadMedia(int layer, char *file)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|
||||||
|
if (!file || !*file)
|
||||||
|
return MA_INVALID_ARGS;
|
||||||
if (m_mae.mediaLoaded[layer] == MA_TRUE)
|
if (m_mae.mediaLoaded[layer] == MA_TRUE)
|
||||||
{
|
{
|
||||||
m_mae.mediaLoaded[layer] = MA_FALSE;
|
m_mae.mediaLoaded[layer] = MA_FALSE;
|
||||||
|
@ -372,7 +374,7 @@ ma_result MiniAudioEngine::loadMedia(int layer, char *file)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
m_mae.currentStatus[layer].media = file;
|
m_mae.currentStatus[layer].media = file;
|
||||||
m_mae.currentStatus[layer].updated = true;
|
m_mae.currentStatus[layer].updated = MA_TRUE;
|
||||||
m_mae.mediaLoaded[layer] = MA_TRUE;
|
m_mae.mediaLoaded[layer] = MA_TRUE;
|
||||||
this->refreshValues(layer);
|
this->refreshValues(layer);
|
||||||
return result;
|
return result;
|
||||||
|
@ -434,6 +436,8 @@ ma_result MiniAudioEngine::printFormatInfo(int layer)
|
||||||
void MiniAudioEngine::volChanged(int layer, int vol)
|
void MiniAudioEngine::volChanged(int layer, int vol)
|
||||||
{
|
{
|
||||||
m_mae.currentStatus[layer].vol = vol;
|
m_mae.currentStatus[layer].vol = vol;
|
||||||
|
if (m_mae.mediaLoaded[layer] != MA_TRUE)
|
||||||
|
return;
|
||||||
if (m_mae.mediaLoaded[layer] == MA_FALSE && m_mae.currentStatus[layer].updated)
|
if (m_mae.mediaLoaded[layer] == MA_FALSE && m_mae.currentStatus[layer].updated)
|
||||||
return;
|
return;
|
||||||
float db = ((float)vol / 771.0f) - 85.0f;
|
float db = ((float)vol / 771.0f) - 85.0f;
|
||||||
|
@ -449,7 +453,7 @@ void MiniAudioEngine::panChanged(int layer, float value)
|
||||||
float result;
|
float result;
|
||||||
|
|
||||||
m_mae.currentStatus[layer].pan = value;
|
m_mae.currentStatus[layer].pan = value;
|
||||||
if (m_mae.mediaLoaded[layer] == false)
|
if (m_mae.mediaLoaded[layer] != MA_TRUE)
|
||||||
return;
|
return;
|
||||||
result = (value / 128.0) - 1.0;
|
result = (value / 128.0) - 1.0;
|
||||||
ma_sound_group_set_pan(&m_mae.sounds[layer], result);
|
ma_sound_group_set_pan(&m_mae.sounds[layer], result);
|
||||||
|
@ -460,7 +464,7 @@ void MiniAudioEngine::pitchChanged(int layer, float value)
|
||||||
float pitch;
|
float pitch;
|
||||||
|
|
||||||
m_mae.currentStatus[layer].pitch = value;
|
m_mae.currentStatus[layer].pitch = value;
|
||||||
if (m_mae.mediaLoaded[layer] == false)
|
if (m_mae.mediaLoaded[layer] != MA_TRUE)
|
||||||
return;
|
return;
|
||||||
pitch = value / 128.0;
|
pitch = value / 128.0;
|
||||||
ma_sound_group_set_pitch(&m_mae.sounds[layer], pitch);
|
ma_sound_group_set_pitch(&m_mae.sounds[layer], pitch);
|
||||||
|
@ -473,7 +477,7 @@ ma_result MiniAudioEngine::playbackChanged(int layer, Status status)
|
||||||
bool loop = false;
|
bool loop = false;
|
||||||
|
|
||||||
m_mae.currentStatus[layer].status = status;
|
m_mae.currentStatus[layer].status = status;
|
||||||
if (m_mae.mediaLoaded[layer] == MA_FALSE)
|
if (m_mae.mediaLoaded[layer] != MA_TRUE)
|
||||||
return MA_DOES_NOT_EXIST;
|
return MA_DOES_NOT_EXIST;
|
||||||
m_mae.currentStatus[layer].updated = false;
|
m_mae.currentStatus[layer].updated = false;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
|
|
@ -2,20 +2,82 @@
|
||||||
|
|
||||||
Settings *Settings::_instance = 0;
|
Settings *Settings::_instance = 0;
|
||||||
|
|
||||||
Settings *Settings::getInstance() {
|
Settings *Settings::getInstance(QObject *parent) {
|
||||||
|
|
||||||
if (_instance == 0) {
|
if (_instance == 0) {
|
||||||
_instance = new Settings();
|
_instance = new Settings(parent);
|
||||||
Q_CHECK_PTR(_instance);
|
Q_CHECK_PTR(_instance);
|
||||||
}
|
}
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::Settings(QObject *parent) :
|
Settings::Settings(QObject *parent) :
|
||||||
QObject(parent)
|
QSettings{parent}
|
||||||
{
|
{
|
||||||
m_layersNumber = 0;
|
m_layersNumber = 0;
|
||||||
m_ui = false;
|
m_ui = false;
|
||||||
|
m_audioDeviceQty = 0;
|
||||||
|
for (uint i = 0; i < MAX_AUDIODEVICES; i++)
|
||||||
|
m_audioDeviceId[i] = -1;
|
||||||
|
settingsLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings::~Settings() {
|
||||||
|
settingsSaver();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::settingsLoader()
|
||||||
|
{
|
||||||
|
beginGroup("lmsAudio");
|
||||||
|
m_ui = value("ui", 0).toBool();
|
||||||
|
m_layersNumber = value("layersNumber", 0).toInt();
|
||||||
|
m_pathmedia = value("path", "").toString();
|
||||||
|
endGroup();
|
||||||
|
beginGroup("audioDevice");
|
||||||
|
m_audioDeviceQty = value("devicesNumber", 0).toInt();
|
||||||
|
for (uint i = 0; i < m_audioDeviceQty; i++)
|
||||||
|
m_audioDeviceId[i] = value(QString("id%1").arg(i), -1).toInt();
|
||||||
|
endGroup();
|
||||||
|
beginGroup("layers");
|
||||||
|
for (int i = 0; i < m_layersNumber; i++) {
|
||||||
|
beginGroup(QString("layer%1").arg(i));
|
||||||
|
dmxSetting temp;
|
||||||
|
temp.address = value("dmx", 0).toInt();
|
||||||
|
temp.universe = value("universe", 0).toInt();
|
||||||
|
temp.layer = value("id", 0).toInt();
|
||||||
|
temp.audioDevice = value("audioDevice", 0).toInt();
|
||||||
|
m_settings.append(temp);
|
||||||
|
if (!m_universe.contains(temp.universe)) {
|
||||||
|
m_universe.insert(temp.universe);
|
||||||
|
}
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
endGroup();
|
||||||
|
printSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::settingsSaver()
|
||||||
|
{
|
||||||
|
beginGroup("lmsAudio");
|
||||||
|
setValue("ui", m_ui);
|
||||||
|
setValue("layersNumber", m_layersNumber);
|
||||||
|
setValue("path", m_pathmedia);
|
||||||
|
endGroup();
|
||||||
|
beginGroup("audioDevice");
|
||||||
|
setValue("devicesNumber", m_audioDeviceQty);
|
||||||
|
for (uint i = 0; i < m_audioDeviceQty; i++)
|
||||||
|
setValue(QString("id%1").arg(i), m_audioDeviceId[i]);
|
||||||
|
endGroup();
|
||||||
|
beginGroup("layers");
|
||||||
|
for (int i = 0; i < m_layersNumber; i++) {
|
||||||
|
beginGroup(QString("layer%1").arg(i));
|
||||||
|
setValue("dmx", m_settings[i].address);
|
||||||
|
setValue("universe", m_settings[i].universe);
|
||||||
|
setValue("id", m_settings[i].layer);
|
||||||
|
setValue("audioDevice", m_settings[i].audioDevice);
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the dmx settings for dmx.xml At the moment we need:
|
// Read the dmx settings for dmx.xml At the moment we need:
|
||||||
|
|
|
@ -6,20 +6,23 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "medialibrary.h"
|
#include "medialibrary.h"
|
||||||
#include "audiowidget.h"
|
#include "audiowidget.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
class Settings : public QObject
|
class Settings : public QSettings
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Settings(QObject *parent = 0);
|
Settings(QObject *parent = nullptr);
|
||||||
static Settings *getInstance();
|
~Settings();
|
||||||
|
static Settings *getInstance(QObject *parent = nullptr);
|
||||||
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; }
|
||||||
|
inline void setPathMedia(QString new_path) { m_pathmedia = new_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 uint *getAudioDeviceId() { return m_audioDeviceId; }
|
inline uint *getAudioDeviceId() { return m_audioDeviceId; }
|
||||||
|
@ -28,6 +31,8 @@ public:
|
||||||
void readFile();
|
void readFile();
|
||||||
void readFromFile(QString file);
|
void readFromFile(QString file);
|
||||||
void printSettings();
|
void printSettings();
|
||||||
|
void settingsLoader();
|
||||||
|
void settingsSaver();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Settings *_instance;
|
static Settings *_instance;
|
||||||
|
|
|
@ -1,47 +1,5 @@
|
||||||
#include "showplayer.h"
|
#include "showplayer.h"
|
||||||
|
|
||||||
QWidget *ShowPlayer::createHeader()
|
|
||||||
{
|
|
||||||
QWidget *ret = new QWidget();
|
|
||||||
|
|
||||||
auto layout = new QHBoxLayout(this);
|
|
||||||
QLabel *l = new QLabel("Cue Number");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("File Path");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Volume");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Bus 1");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Bus 2");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Pan");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Pitch");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Playback Status");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Fade In");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Fade Out");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Wait In");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Wait Out ");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Halt");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Name");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Notes");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Entry Point");
|
|
||||||
layout->addWidget(l);
|
|
||||||
l = new QLabel("Exit Point");
|
|
||||||
layout->addWidget(l);
|
|
||||||
ret->setLayout(layout);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowPlayer::ShowPlayer(QWidget *parent) :
|
ShowPlayer::ShowPlayer(QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
|
@ -50,37 +8,42 @@ ShowPlayer::ShowPlayer(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->addCueButton, SIGNAL(clicked()), this, SLOT(onAddTrack()));
|
connect(ui->addCueButton, SIGNAL(clicked()), this, SLOT(onAddTrack()));
|
||||||
connect(ui->goButton, SIGNAL(clicked()), this, SLOT(go()));
|
connect(ui->goButton, SIGNAL(clicked()), this, SLOT(go()));
|
||||||
QWidget *w = createHeader();
|
|
||||||
ui->headerLayout->addWidget(w);
|
|
||||||
currentTrackIndex = 0;
|
|
||||||
filesLoaded = 0;
|
filesLoaded = 0;
|
||||||
currentStatus = Status::Iddle;
|
currentStatus = Status::Iddle;
|
||||||
|
for(int i = 0; i < MAX_LAYERS; i++)
|
||||||
|
layersUsed[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPlayer::~ShowPlayer() {}
|
ShowPlayer::~ShowPlayer() {}
|
||||||
|
|
||||||
void ShowPlayer::onAddTrack() {
|
void ShowPlayer::onAddTrack() {
|
||||||
TrackDialog dialog;
|
ui->cueListWidget->createNewCueTrack();
|
||||||
dialog.show();
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
|
||||||
ui->cueListWidget->addCueTrackWidget(dialog.track);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowPlayer::go()
|
void ShowPlayer::go()
|
||||||
{
|
{
|
||||||
CueTrackWidget* current = ui->cueListWidget->getSelectedTrack();
|
CueTrack* current = ui->cueListWidget->getSelectedTrack();
|
||||||
if (!current)
|
if (!current)
|
||||||
return;
|
return;
|
||||||
|
if (current->audioLayer < 0)
|
||||||
|
return;
|
||||||
for (int i = 0; i < MAX_LAYERS; i++) {
|
for (int i = 0; i < MAX_LAYERS; i++) {
|
||||||
if (layersUsed[i] == -1) {
|
if (layersUsed[i] == -1) {
|
||||||
layersUsed[i] = currentTrackIndex;
|
layersUsed[i] = current->userNumber;
|
||||||
current->audioLayer = i;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!current->filePath.empty())
|
||||||
updateTrackStateInEngine(currentTrackIndex, current->audioLayer);
|
emit uiLoadMedia(current->audioLayer, current->filePath.data());
|
||||||
emit uiLoadMedia(current->audioLayer, current->getFilePath());
|
updateTrackStateInEngine(current);
|
||||||
emit uiPlaybackChanged(current->audioLayer, current->getStatus());
|
emit uiPlaybackChanged(current->audioLayer, current->status);
|
||||||
filesLoaded++;
|
filesLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowPlayer::updateTrackStateInEngine(CueTrack *track) {
|
||||||
|
emit uiSliderChanged(track->audioLayer, Slider::Volume, track->volume * 655.35);
|
||||||
|
emit uiSliderChanged(track->audioLayer, Slider::Pan, (track->pan + 1) * 128);
|
||||||
|
emit uiSliderChanged(track->audioLayer, Slider::Pitch, track->pitch * 128);
|
||||||
|
emit uiSliderChanged(track->audioLayer, Slider::Bus1, track->bus1 * 255 * 2.55);
|
||||||
|
emit uiSliderChanged(track->audioLayer, Slider::Bus2, track->bus2 * 255 * 2.55);
|
||||||
|
};
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "cuetrackwidget.h"
|
|
||||||
#include "cuetracklistwidget.h"
|
#include "cuetracklistwidget.h"
|
||||||
#include "trackdialog.h"
|
#include "settings.h"
|
||||||
#include "ui_showplayer.h"
|
#include "ui_showplayer.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -26,21 +26,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShowPlayer *ui;
|
Ui::ShowPlayer *ui;
|
||||||
size_t currentTrackIndex;
|
|
||||||
Status currentStatus = Status::Iddle;
|
Status currentStatus = Status::Iddle;
|
||||||
size_t filesLoaded = 0;
|
size_t filesLoaded = 0;
|
||||||
int layersUsed[MAX_LAYERS] = { -1 };
|
int layersUsed[MAX_LAYERS];
|
||||||
|
|
||||||
QWidget *createHeader();
|
void updateTrackStateInEngine(CueTrack *track);
|
||||||
|
|
||||||
void updateTrackStateInEngine(size_t index, int layer) {
|
|
||||||
CueTrackWidget *track = ui->cueListWidget->getTrackAtIndex(index);
|
|
||||||
emit uiSliderChanged(layer, Slider::Volume, track->getVolume());
|
|
||||||
emit uiSliderChanged(layer, Slider::Pan, track->getPan());
|
|
||||||
emit uiSliderChanged(layer, Slider::Pitch, track->getPitch());
|
|
||||||
emit uiSliderChanged(layer, Slider::Bus1, track->getBus1());
|
|
||||||
emit uiSliderChanged(layer, Slider::Bus2, track->getBus2());
|
|
||||||
};
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAddTrack();
|
void onAddTrack();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>276</width>
|
<width>538</width>
|
||||||
<height>112</height>
|
<height>554</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -22,6 +22,12 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -117,16 +123,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
|
||||||
<layout class="QHBoxLayout" name="headerLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetMaximumSize</enum>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="CueTrackListWidget" name="cueListWidget" native="true">
|
<widget class="CueTrackListWidget" name="cueListWidget" native="true">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Add table
Reference in a new issue