Antigona Release #1
11 changed files with 47 additions and 48 deletions
|
@ -51,7 +51,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
m_progressTime->setDisplayFormat("mm:ss:zz");
|
||||
m_progressTime->setReadOnly(true);
|
||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_progressTime->setMaximumWidth(75);
|
||||
m_progressTime->setMinimumWidth(80);
|
||||
m_progressTime->setFocusPolicy(Qt::NoFocus);
|
||||
m_progressTime->setAlignment(Qt::AlignHCenter);
|
||||
m_progressTime->setContentsMargins(0,0,0,0);
|
||||
|
@ -61,7 +61,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
m_totalTimeValue->setDisplayFormat("mm:ss:zz");
|
||||
m_totalTimeValue->setReadOnly(true);
|
||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_totalTimeValue->setMaximumWidth(75);
|
||||
m_totalTimeValue->setMinimumWidth(80);
|
||||
m_totalTimeValue->setFocusPolicy(Qt::NoFocus);
|
||||
m_totalTimeValue->setAlignment(Qt::AlignHCenter);
|
||||
m_totalTimeValue->setContentsMargins(0,0,0,0);
|
||||
|
@ -119,8 +119,8 @@ void AudioLayerWidget::toggleSuspendResume()
|
|||
break;
|
||||
case Status::Paused:
|
||||
case Status::Stopped:
|
||||
//this->setPlaybackStatus(Status::PlayingOnce);
|
||||
emit uiPlaybackChanged(m_layer, Status::PlayingOnce);
|
||||
this->setPlaybackStatus(Status::PlayingLoop);
|
||||
emit uiPlaybackChanged(m_layer, Status::PlayingLoop);
|
||||
case Status::Iddle:
|
||||
break;
|
||||
}
|
||||
|
@ -176,12 +176,12 @@ void AudioLayerWidget::fileLoaded(QString file)
|
|||
|
||||
void AudioLayerWidget::setPlaybackStatus(Status status)
|
||||
{
|
||||
if (StatusStr[status] == m_suspendResumeButton->text())
|
||||
if (!strcmp(StatusStr[status], m_suspendResumeButton->text().toLatin1().constData()))
|
||||
return;
|
||||
m_suspendResumeButton->blockSignals(true);
|
||||
m_status = status;
|
||||
if (status == Status::Stopped)
|
||||
m_progress->setValue(0);
|
||||
refreshCurrentTime(0);
|
||||
m_suspendResumeButton->setText(StatusStr[status]);
|
||||
m_suspendResumeButton->blockSignals(false);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ void AudioLayerWidget::durationChanged(float dur)
|
|||
m_totalTimeValue->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::refreshUi(float progress)
|
||||
void AudioLayerWidget::refreshCurrentTime(float progress)
|
||||
{
|
||||
progress *= 1000;
|
||||
m_progress->blockSignals(true);
|
||||
|
|
|
@ -46,7 +46,7 @@ public slots:
|
|||
void pitchChanged(int pitch);
|
||||
void fileLoaded(QString file);
|
||||
void durationChanged(float dur);
|
||||
void refreshUi(float progress);
|
||||
void refreshCurrentTime(float progress);
|
||||
|
||||
private slots:
|
||||
void openMediaDialog();
|
||||
|
|
|
@ -49,5 +49,5 @@ void AudioWidget::cursorChanged(int layer, float cursor)
|
|||
{
|
||||
QLayoutItem * const item = m_layout->itemAt(layer);
|
||||
AudioLayerWidget *alw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
alw->refreshUi(cursor);
|
||||
alw->refreshCurrentTime(cursor);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define LICENSE "GPL 3 Licensed. See LICENSE.txt."
|
||||
#define DEFAULT_FILE "lms-audio.xlm"
|
||||
#define MAX_LAYERS 4
|
||||
#define UI_REFRESH_TIME 200
|
||||
#define UI_REFRESH_TIME 93
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<ui version="4.0">
|
||||
<author>Santi Noreña lms@criptomart.net</author>
|
||||
<class>LibreMediaServerAudio</class>
|
||||
<widget class="QMainWindow" name="LibreMediaServer Audio">
|
||||
<widget class="QMainWindow" name="LibreMediaServerAudio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>800</height>
|
||||
<width>500</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
|
@ -32,7 +32,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>114</width>
|
||||
<width>500</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
|
@ -40,16 +40,9 @@ libreMediaServerAudio::libreMediaServerAudio(bool gui)
|
|||
connect(m_ola, SIGNAL(dmxOutput(int, int, int)), this, SLOT(dmxInput(int, int, int)));
|
||||
m_ola->registerUniverse();
|
||||
m_mae.startEngine(set->getAudioDeviceId());
|
||||
qDebug("Init Complete.");
|
||||
qDebug("Core init Complete. Start reading DMX.");
|
||||
m_ola->blockSignals(false);
|
||||
m_ola->start(QThread::TimeCriticalPriority );
|
||||
#ifndef NOGUI
|
||||
if (m_ui) {
|
||||
m_refreshUi = new QTimer(this);
|
||||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
m_refreshUi->start(UI_REFRESH_TIME);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
libreMediaServerAudio::~libreMediaServerAudio()
|
||||
|
@ -73,7 +66,7 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
if (QFile::exists(mediaFile)){
|
||||
m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
||||
m_currentMedia[layer] = mediaFile;
|
||||
#ifndef NOGIO
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->mediaLoaded(layer, mediaFile, m_mae.getDuration(layer));
|
||||
#endif
|
||||
|
@ -82,7 +75,7 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
} else if (channel == VOLUME_COARSE || channel == VOLUME_FINE) {
|
||||
float tmp = value / 65025.0f;
|
||||
m_mae.volChanged(layer, tmp);
|
||||
m_updateUi[layer][0] = tmp * 100;
|
||||
m_updateUi[layer][0] = tmp * 100.0f;
|
||||
} else if (channel == PAN) {
|
||||
m_mae.panChanged(layer, value);
|
||||
m_updateUi[layer][1] = value;
|
||||
|
@ -98,21 +91,19 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
} else if (channel == PLAYBACK && value > 0) {
|
||||
aux = value / 25;
|
||||
Status s = m_currentStatus[layer];
|
||||
if (s != aux) {
|
||||
if (aux == 0)
|
||||
s = Status::PlayingOnce;
|
||||
else if (aux == 1)
|
||||
s = Status::Stopped;
|
||||
else if (aux == 2)
|
||||
s = Status::Paused;
|
||||
else if (aux == 3)
|
||||
s = Status::PlayingLoop;
|
||||
m_mae.playbackChanged(layer, s);
|
||||
m_currentStatus[layer] = s;
|
||||
if (aux == 0)
|
||||
s = Status::PlayingOnce;
|
||||
else if (aux == 1)
|
||||
s = Status::Stopped;
|
||||
else if (aux == 2)
|
||||
s = Status::Paused;
|
||||
else if (aux == 3)
|
||||
s = Status::PlayingLoop;
|
||||
m_mae.playbackChanged(layer, s);
|
||||
m_currentStatus[layer] = s;
|
||||
#ifndef NOGUI
|
||||
if (m_ui) m_lmsUi->m_aw->playbackChanged(layer, s);
|
||||
if (m_ui) m_lmsUi->m_aw->playbackChanged(layer, s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,6 +127,7 @@ void libreMediaServerAudio::refreshUi() {
|
|||
m_lmsUi->m_aw->pitchChanged(i, m_updateUi[i][2]);
|
||||
m_updateUi[i][2] = -1;
|
||||
}
|
||||
//m_lmsUi->m_aw->playbackChanged(i, m_currentStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,6 +138,9 @@ void libreMediaServerAudio::setUi(libreMediaServerAudioUi *lmsUi)
|
|||
connect(m_lmsUi->m_aw, SIGNAL(uiSliderChanged(int, Slider, int)), this, SLOT(uiSliderChanged(int, Slider, int)));
|
||||
connect(m_lmsUi->m_aw, SIGNAL(uiPlaybackChanged(int, Status)), this, SLOT(uiPlaybackChanged(int, Status)));
|
||||
connect(m_lmsUi->m_aw, SIGNAL(uiLoadMedia(int, QString)), this, SLOT(uiLoadMedia(int, QString)));
|
||||
m_refreshUi = new QTimer(this);
|
||||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
m_refreshUi->start(UI_REFRESH_TIME);
|
||||
};
|
||||
|
||||
void libreMediaServerAudio::uiSliderChanged(int layer, Slider s, int value)
|
||||
|
@ -166,6 +161,7 @@ void libreMediaServerAudio::uiSliderChanged(int layer, Slider s, int value)
|
|||
void libreMediaServerAudio::uiPlaybackChanged(int layer, Status s)
|
||||
{
|
||||
m_mae.playbackChanged(layer, s);
|
||||
m_currentStatus[layer] = s;
|
||||
}
|
||||
|
||||
void libreMediaServerAudio::uiLoadMedia(int layer, QString s)
|
||||
|
|
|
@ -49,7 +49,7 @@ private:
|
|||
bool m_ui;
|
||||
QTimer *m_refreshUi;
|
||||
libreMediaServerAudioUi *m_lmsUi;
|
||||
int m_updateUi[MAX_LAYERS][3];
|
||||
float m_updateUi[MAX_LAYERS][3];
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -32,7 +32,6 @@ bool hasUi(int &argc, char *argv[])
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
libreMediaServerAudio lms(hasUi(argc, argv));
|
||||
#ifndef NOGUI
|
||||
if (hasUi(argc, argv))
|
||||
|
|
|
@ -195,8 +195,9 @@ void MiniAudioEngine::volChanged(int layer, float vol)
|
|||
{
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
return;
|
||||
if (vol > 1)
|
||||
vol = 1;
|
||||
ma_sound_group_set_volume(&m_currentSound[layer], vol);
|
||||
qDebug() << "vol: " << vol;
|
||||
}
|
||||
|
||||
void MiniAudioEngine::panChanged(int layer, float value)
|
||||
|
|
|
@ -27,6 +27,7 @@ protected:
|
|||
void setCursor(int layer, int cursor);
|
||||
ma_result printFormatInfo(int layer);
|
||||
Status getStatus(int layer);
|
||||
inline float getVol(int layer) { return ma_sound_get_volume(&m_currentSound[layer]); }
|
||||
|
||||
private:
|
||||
ma_resource_manager_config resourceManagerConfig;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "slidergroup.h"
|
||||
|
||||
#include <QCursor>
|
||||
SliderGroup::SliderGroup(QString name,
|
||||
int min,
|
||||
int max,
|
||||
|
@ -15,22 +15,22 @@ SliderGroup::SliderGroup(QString name,
|
|||
slider->setFocusPolicy(Qt::StrongFocus);
|
||||
slider->setTickPosition(QSlider::TicksBothSides);
|
||||
slider->setTickInterval((max - min) / 11);
|
||||
slider->setMinimumHeight(100);
|
||||
slider->setMinimumHeight(0);
|
||||
slider->setSingleStep(1);
|
||||
slider->setRange(min, max);
|
||||
//slider->setMaximumWidth(40);
|
||||
slider->setMinimumWidth(50);
|
||||
slider->setToolTip(name);
|
||||
slider->setStyleSheet("QSlider {"
|
||||
"border: 1px solid #999999;"
|
||||
"border: 2px solid #685060;"
|
||||
"margin: 0px;"
|
||||
"height: 200px;"
|
||||
"width: 40px;}"
|
||||
"width: 50px;}"
|
||||
);
|
||||
slider->setContentsMargins(0, 0, 0, 0);
|
||||
valueBox = new QDoubleSpinBox();
|
||||
valueBox->setFocusPolicy(Qt::NoFocus);
|
||||
valueBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
//valueBox->setMaximumWidth(40);
|
||||
valueBox->setMinimumWidth(50);
|
||||
valueBox->setRange(min, max);
|
||||
valueBox->setDecimals(decimals);
|
||||
valueBox->setObjectName(name);
|
||||
|
@ -40,8 +40,8 @@ SliderGroup::SliderGroup(QString name,
|
|||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
|
||||
layout->addWidget(slider);
|
||||
layout->addWidget(valueBox);
|
||||
this->setStyleSheet("border: 1px solid #999999;"
|
||||
"width: 40px;"
|
||||
this->setStyleSheet("border: 2px solid #685060;"
|
||||
"width: 50px;"
|
||||
"margin: 0px;"
|
||||
);
|
||||
layout->setSpacing(0);
|
||||
|
@ -51,7 +51,9 @@ SliderGroup::SliderGroup(QString name,
|
|||
|
||||
void SliderGroup::sliderValueChanged(int value)
|
||||
{
|
||||
valueBox->blockSignals(true);
|
||||
valueBox->setValue(value);
|
||||
valueBox->blockSignals(false);
|
||||
emit valueChanged(value);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue