Antigona Release #1
8 changed files with 53 additions and 34 deletions
|
@ -49,5 +49,5 @@ v 0.2.1
|
|||
- SettingsDialog.
|
||||
- Load/save conf file.
|
||||
- ¿Exit Point? is it needed?
|
||||
- Hardening: check return errors, i'm too happy....
|
||||
- Hardening: check return errors, catch execptions, i'm too happy....
|
||||
- Tests: errors on wrong conf file.
|
||||
|
|
|
@ -30,9 +30,9 @@ SOURCES += src/main.cpp \
|
|||
src/settings.cpp \
|
||||
src/slidergroup.cpp
|
||||
FORMS += src/libremediaserver-audio-gui.ui
|
||||
CCFLAG += -msse2 -mavx2 #-fsanitize=address -g -O0
|
||||
CCFLAG += -msse2 -mavx2 #-fsanitize=address -g3 -O0
|
||||
QMAKE_CXXFLAGS += $$(CXXFLAG)
|
||||
#QMAKE_CXXFLAGS += -fsanitize=address -g -O0
|
||||
#QMAKE_CXXFLAGS += -fsanitize=address -g3 -O0
|
||||
QMAKE_CFLAGS += $$(CCFLAG)
|
||||
QMAKE_LFLAGS += $$(LDFLAG)
|
||||
LIBS += -lola -lolacommon -ldl -lpthread -lm
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
ClickableLabel::ClickableLabel(QWidget *parent, Qt::WindowFlags f)
|
||||
: QLabel{parent}
|
||||
{
|
||||
|
||||
Q_UNUSED(f);
|
||||
}
|
||||
|
||||
ClickableLabel::~ClickableLabel() {}
|
||||
|
||||
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
|
||||
Q_UNUSED(event);
|
||||
emit clicked();
|
||||
}
|
||||
|
|
|
@ -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 1000
|
||||
#define UI_REFRESH_TIME 200
|
||||
|
||||
// struct where save the DMX settings for each layer
|
||||
struct dmxSetting {
|
||||
|
|
|
@ -28,6 +28,12 @@ libreMediaServerAudio::libreMediaServerAudio(bool gui)
|
|||
set->readFile();
|
||||
m_mediaLibrary = new MediaLibrary;
|
||||
m_mediaLibrary->initMediaLibrary();
|
||||
for (int i = 0; i < MAX_LAYERS; i++) {
|
||||
m_currentMedia[i] = Status::Iddle;
|
||||
m_updateUi[i][0] = -1;
|
||||
m_updateUi[i][1] = -1;
|
||||
m_updateUi[i][2] = -1;
|
||||
}
|
||||
m_ola = new olaThread(this, set->getLayersNumber());
|
||||
Q_CHECK_PTR(m_ola);
|
||||
m_ola->blockSignals(true);
|
||||
|
@ -54,7 +60,7 @@ libreMediaServerAudio::~libreMediaServerAudio()
|
|||
|
||||
void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
||||
{
|
||||
if (layer > LAYER_CHANNELS)
|
||||
if (layer >= MAX_LAYERS || channel >= LAYER_CHANNELS)
|
||||
return;
|
||||
QString mediaFile = NULL;
|
||||
int aux;
|
||||
|
@ -66,40 +72,32 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
return;
|
||||
if (QFile::exists(mediaFile)){
|
||||
m_mae.loadMedia(layer, mediaFile.toLatin1().data());
|
||||
#ifndef NOGUI
|
||||
m_currentMedia[layer] = mediaFile;
|
||||
#ifndef NOGIO
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->mediaLoaded(layer, mediaFile, m_mae.getDuration(layer));
|
||||
#endif
|
||||
m_currentMedia[layer] = mediaFile;
|
||||
}
|
||||
return;
|
||||
} else if (channel == VOLUME_COARSE || channel == VOLUME_FINE) {
|
||||
m_mae.volChanged(layer, (value / 65025.0f));
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->volChanged(layer, (value / 650.25f));
|
||||
#endif
|
||||
float tmp = value / 65025.0f;
|
||||
m_mae.volChanged(layer, tmp);
|
||||
m_updateUi[layer][0] = tmp * 100;
|
||||
} else if (channel == PAN) {
|
||||
m_mae.panChanged(layer, value);
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->panChanged(layer, value);
|
||||
#endif
|
||||
m_updateUi[layer][1] = value;
|
||||
} else if (channel == PITCH) {
|
||||
m_mae.pitchChanged(layer, value);
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->pitchChanged(layer, value);
|
||||
#endif
|
||||
m_updateUi[layer][2] = value;
|
||||
} else if (channel == ENTRY_POINT_COARSE || channel == ENTRY_POINT_FINE) {
|
||||
m_mae.setCursor(layer, value);
|
||||
#ifndef NOGUI
|
||||
if (m_ui)
|
||||
m_lmsUi->m_aw->cursorChanged(layer, m_mae.getCursor(layer));
|
||||
m_lmsUi->m_aw->cursorChanged(layer, m_mae.getCursor(layer));
|
||||
#endif
|
||||
|
||||
return;
|
||||
} else if (channel == PLAYBACK && value > 0) {
|
||||
Status s = m_mae.getStatus(layer);
|
||||
aux = value / 25;
|
||||
Status s = m_currentStatus[layer];
|
||||
if (s != aux) {
|
||||
if (aux == 0)
|
||||
s = Status::PlayingOnce;
|
||||
|
@ -110,9 +108,9 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
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
|
||||
}
|
||||
}
|
||||
|
@ -120,13 +118,23 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
|
||||
#ifndef NOGUI
|
||||
void libreMediaServerAudio::refreshUi() {
|
||||
if (!m_ui)
|
||||
return;
|
||||
if (!m_ui) return;
|
||||
for (int i= 0; i < Settings::getInstance()->getLayersNumber(); i++ ) {
|
||||
Status s = m_mae.getStatus(i);
|
||||
Status s = m_currentStatus[i];
|
||||
if (s == Status::PlayingOnce || s == Status::PlayingLoop) {
|
||||
m_lmsUi->m_aw->cursorChanged(i, m_mae.getCursor(i));
|
||||
//m_lmsUi->m_aw->playbackChanged(i, s);
|
||||
}
|
||||
if (m_updateUi[i][0] >= 0) {
|
||||
m_lmsUi->m_aw->volChanged(i, m_updateUi[i][0]);
|
||||
m_updateUi[i][0] = -1;
|
||||
}
|
||||
if (m_updateUi[i][1] >= 0) {
|
||||
m_lmsUi->m_aw->panChanged(i, m_updateUi[i][1]);
|
||||
m_updateUi[i][1] = -1;
|
||||
}
|
||||
if (m_updateUi[i][2] >= 0) {
|
||||
m_lmsUi->m_aw->pitchChanged(i, m_updateUi[i][2]);
|
||||
m_updateUi[i][2] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,12 @@ private:
|
|||
MediaLibrary *m_mediaLibrary;
|
||||
MiniAudioEngine m_mae;
|
||||
QString m_currentMedia[MAX_LAYERS];
|
||||
Status m_currentStatus[MAX_LAYERS];
|
||||
#ifndef NOGUI
|
||||
bool m_ui;
|
||||
QTimer *m_refreshUi;
|
||||
libreMediaServerAudioUi *m_lmsUi;
|
||||
int m_updateUi[MAX_LAYERS][3];
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
MiniAudioEngine::MiniAudioEngine()
|
||||
{
|
||||
|
||||
for (int i =0; i < MAX_LAYERS; i++) {
|
||||
m_mediaLoaded[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void MiniAudioEngine::audioDataCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
|
||||
|
@ -194,6 +196,7 @@ void MiniAudioEngine::volChanged(int layer, float vol)
|
|||
if (m_mediaLoaded[layer] == false)
|
||||
return;
|
||||
ma_sound_group_set_volume(&m_currentSound[layer], vol);
|
||||
qDebug() << "vol: " << vol;
|
||||
}
|
||||
|
||||
void MiniAudioEngine::panChanged(int layer, float value)
|
||||
|
@ -255,7 +258,7 @@ void MiniAudioEngine::setCursor(int layer, int cursor)
|
|||
|
||||
Status MiniAudioEngine::getStatus(int layer)
|
||||
{
|
||||
if (m_mediaLoaded[layer] == ma_bool8(false))
|
||||
if (m_mediaLoaded[layer] == false)
|
||||
return Status::Iddle;
|
||||
if (ma_sound_is_playing(&m_currentSound[layer])) {
|
||||
if (ma_sound_is_looping(&m_currentSound[layer]))
|
||||
|
|
|
@ -57,6 +57,11 @@ void SliderGroup::sliderValueChanged(int value)
|
|||
|
||||
void SliderGroup::setValue(float value)
|
||||
{
|
||||
slider->setValue(value);
|
||||
slider->blockSignals(true);
|
||||
valueBox->blockSignals(true);
|
||||
if (int(value) != slider->value())
|
||||
slider->setValue(value);
|
||||
valueBox->setValue(value);
|
||||
slider->blockSignals(false);
|
||||
valueBox->blockSignals(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue