Antigona Release #1
11 changed files with 108 additions and 47 deletions
|
@ -46,6 +46,10 @@ v 0.2.1
|
|||
- Hardening: check return errors, try/catch exceptions, i'm too happy....
|
||||
- Tests: errors on wrong conf file.
|
||||
- Ui/Ux: seek cursor playback
|
||||
- ampliar writer para recibir un número n de entradas y escribirlas cada una en un buffer
|
||||
|
||||
v0.2.0:
|
||||
- Vumeter or indicator about audio output in layer and master, add to sliderGroup.
|
||||
--> en master se puede hacer con jack, solo en capas.
|
||||
--> en las capas, hace falta otro nodo atacado en los buses de input que analice la entrada.
|
||||
- mostrad información de envíos y dispositivos en ui
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "audiolayerwidget.h"
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QFileDialog>
|
||||
|
@ -11,7 +12,6 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
QVBoxLayout *playback = new QVBoxLayout;
|
||||
m_folderValue = new ClickableLabel;
|
||||
m_folderValue->setMaximumWidth(300);
|
||||
m_folderValue->setAlignment(Qt::AlignLeft);
|
||||
|
@ -19,7 +19,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
"color: white;"
|
||||
"background-color: black;"
|
||||
);
|
||||
playback->addWidget(m_folderValue);
|
||||
layout->addWidget(m_folderValue);
|
||||
m_fileValue = new ClickableLabel;
|
||||
connect(m_fileValue, SIGNAL(clicked()), this, SLOT(openMediaDialog()));
|
||||
connect(m_folderValue, SIGNAL(clicked()), this, SLOT(openMediaDialog()));
|
||||
|
@ -29,10 +29,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
"color: white;"
|
||||
"background-color: black;"
|
||||
);
|
||||
playback->addWidget(m_fileValue);
|
||||
playback->setSpacing(0);
|
||||
playback->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(playback);
|
||||
layout->addWidget(m_fileValue);
|
||||
|
||||
m_suspendResumeButton = new QPushButton(this);
|
||||
m_suspendResumeButton->setText(statusToString(Status::Iddle));
|
||||
|
@ -74,17 +71,23 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
m_filterBank = new FilterBankWidget(this);
|
||||
connect(m_filterBank, SIGNAL(setBypass(bool)), this, SLOT(setBypass(bool)));
|
||||
layout->addWidget(m_filterBank);
|
||||
|
||||
QVBoxLayout *volumeBox = new QVBoxLayout;
|
||||
m_pitch = new SliderGroup("Pitch", 0 , 255, 0, NULL);
|
||||
volumeBox->addWidget(m_pitch);
|
||||
layout->addWidget(m_pitch);
|
||||
connect(m_pitch, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||
m_pan = new SliderGroup("Pan", 0 , 255, 0, NULL);
|
||||
volumeBox->addWidget(m_pan);
|
||||
layout->addWidget(m_pan);
|
||||
connect(m_pan, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||
m_volume = new SliderGroup("Vol", 0, 100, 2, NULL);
|
||||
|
||||
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||
m_volume = new SliderGroup("Vol", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_volume);
|
||||
connect(m_volume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
m_bus1 = new SliderGroup("Bus 1", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_bus1);
|
||||
connect(m_bus1, SIGNAL(valueChanged(int)), this, SLOT(bus1VolumeChanged(int)));
|
||||
m_bus2 = new SliderGroup("Bus 2", 0, 65535, 2, NULL);
|
||||
volumeBox->addWidget(m_bus2);
|
||||
connect(m_bus2, SIGNAL(valueChanged(int)), this, SLOT(bus2VolumeChanged(int)));
|
||||
volumeBox->setSpacing(0);
|
||||
volumeBox->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(volumeBox);
|
||||
|
@ -102,6 +105,16 @@ void AudioLayerWidget::volumeChanged(int value)
|
|||
emit(uiSliderChanged(m_layer, Slider::Volume, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::bus1VolumeChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Bus1, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::bus2VolumeChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Bus2, value));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::panChanged(int value)
|
||||
{
|
||||
emit(uiSliderChanged(m_layer, Slider::Pan, value));
|
||||
|
@ -157,9 +170,9 @@ void AudioLayerWidget::openMediaDialog()
|
|||
// from DMX signals
|
||||
void AudioLayerWidget::setVol(float vol)
|
||||
{
|
||||
m_volume->blockSignals(true);
|
||||
m_volume->setValue(vol);
|
||||
m_volume->blockSignals(false);
|
||||
m_volume->blockSignals(true);
|
||||
m_volume->setValue(vol);
|
||||
m_volume->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPan(int pan)
|
||||
|
@ -221,8 +234,17 @@ void AudioLayerWidget::setCurrentTime(float progress)
|
|||
|
||||
void AudioLayerWidget::setFilterParam(int channel, int value)
|
||||
{
|
||||
m_filterBank->blockSignals(true);
|
||||
m_filterBank->setValue(channel, value);
|
||||
m_filterBank->blockSignals(false);
|
||||
|
||||
if (channel <= FILTER_BANK_GAIN - FILTER_CHANNELS){
|
||||
m_filterBank->blockSignals(true);
|
||||
m_filterBank->setValue(channel, value);
|
||||
m_filterBank->blockSignals(false);
|
||||
} else if (channel == SEND1 - HP_FREQ) {
|
||||
m_bus1->blockSignals(false);
|
||||
m_bus1->setValue((value * 256) + 255);
|
||||
m_bus1->blockSignals(true);
|
||||
} else if (channel == SEND2 - HP_FREQ) {
|
||||
m_bus2->blockSignals(false);
|
||||
m_bus2->setValue(value * 256 + 255);
|
||||
m_bus2->blockSignals(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ private:
|
|||
SliderGroup *m_volume;
|
||||
SliderGroup *m_pan;
|
||||
SliderGroup *m_pitch;
|
||||
SliderGroup *m_bus1;
|
||||
SliderGroup *m_bus2;
|
||||
QTimeEdit *m_progressTime;
|
||||
QTimeEdit *m_totalTimeValue;
|
||||
QProgressBar *m_progress;
|
||||
|
@ -51,6 +53,8 @@ private slots:
|
|||
void openMediaDialog();
|
||||
void toggleSuspendResume();
|
||||
void volumeChanged(int vol);
|
||||
void bus1VolumeChanged(int vol);
|
||||
void bus2VolumeChanged(int vol);
|
||||
void panChanged(int pan);
|
||||
void pitchChanged(int pitch);
|
||||
void setBypass(bool value);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "audiowidget.h"
|
||||
|
||||
//#include <cmath>
|
||||
#include "dmxPersonality.h"
|
||||
|
||||
AudioWidget::AudioWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
|
@ -23,8 +22,8 @@ AudioWidget::AudioWidget(QWidget *parent) :
|
|||
for (int j = 0; j < FILTER_CHANNELS; j++)
|
||||
m_filtersUpdate[i][j] = -1;
|
||||
}
|
||||
m_layout->setSpacing(0);
|
||||
m_layout->setContentsMargins(1, 1, 1, 1);
|
||||
m_layout->setSpacing(2);
|
||||
m_layout->setContentsMargins(2, 2, 2, 2);
|
||||
setLayout(m_layout);
|
||||
m_refreshUi = new QTimer(this);
|
||||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
|
@ -110,6 +109,6 @@ void AudioWidget::refreshUi()
|
|||
|
||||
void AudioWidget::filterParamChanged(int layer, int channel, int value)
|
||||
{
|
||||
m_filtersUpdate[layer][channel - 9] = value;
|
||||
m_filtersUpdate[layer][channel - HP_FREQ] = value;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#define FORMAT ma_format_f32 /* Must always be f32. */
|
||||
#define CHANNELS 2
|
||||
#define SAMPLE_RATE 48000
|
||||
#define UI_REFRESH_TIME 100
|
||||
#define UI_REFRESH_TIME 97
|
||||
#define FADE_TIME 25 // DMX Frame time, 40 fps, avoid clicks
|
||||
#define FILTER_CHANNELS 13 // number of dmx channels dedicated to filters by layer
|
||||
#define FILTER_CHANNELS 16 // number of dmx channels dedicated to filters by layer
|
||||
|
||||
struct dmxSetting {
|
||||
int address;
|
||||
|
@ -38,7 +38,9 @@ enum Slider
|
|||
Volume,
|
||||
Pan,
|
||||
Pitch,
|
||||
Bypass
|
||||
Bypass,
|
||||
Bus1,
|
||||
Bus2
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -71,6 +73,8 @@ struct layerData {
|
|||
int address;
|
||||
unsigned int universe;
|
||||
int device;
|
||||
int bus1Vol;
|
||||
int bus2Vol;
|
||||
};
|
||||
#endif // __cplusplus
|
||||
#endif // DEFINES_H
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define HIGH_FREQ 19
|
||||
#define HIGH_Q 20
|
||||
#define HIGH_GAIN 21
|
||||
#define FILTER_BANK_GAIN 22 // not implemented yet
|
||||
#define FILTER_BANK_GAIN 22
|
||||
#define SEND1 23
|
||||
#define SEND2 24
|
||||
#define LAYER_CHANNELS 25
|
||||
|
|
|
@ -86,7 +86,8 @@ void FilterBankWidget::setValue(int filter, int value)
|
|||
result = (double)( value / 32.0f) + 0.1f;
|
||||
} else if (channel == HIGH_GAIN) {
|
||||
result = (double)(value / 21.25) - 6.023528412f;
|
||||
}
|
||||
} else
|
||||
result = (double)value;
|
||||
fb[filter]->setValue(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,9 +96,8 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value)
|
|||
QString mediaFile = NULL;
|
||||
int aux;
|
||||
if (channel == VOLUME_COARSE || channel == VOLUME_FINE) {
|
||||
float tmp = value / 65025.0f;
|
||||
m_mae.volChanged(layer, tmp);
|
||||
m_updateUi[layer][0] = tmp * 100.0f;
|
||||
m_mae.volChanged(layer, value);
|
||||
m_updateUi[layer][0] = value;
|
||||
} else if (channel == PAN) {
|
||||
m_mae.panChanged(layer, value);
|
||||
m_updateUi[layer][1] = value;
|
||||
|
@ -236,7 +235,7 @@ void libreMediaServerAudio::uiSliderChanged(int layer, Slider s, int value)
|
|||
{
|
||||
switch (s){
|
||||
case Slider::Volume:
|
||||
m_mae.volChanged(layer, float((value / 100.0f)));
|
||||
m_mae.volChanged(layer, value);
|
||||
break;
|
||||
case Slider::Pan:
|
||||
m_mae.panChanged(layer, value);
|
||||
|
@ -246,6 +245,13 @@ void libreMediaServerAudio::uiSliderChanged(int layer, Slider s, int value)
|
|||
break;
|
||||
case Slider::Bypass:
|
||||
m_mae.setBypass(m_dmxSettings.at(layer).audioDevice, layer, value);
|
||||
break;
|
||||
case Slider::Bus1:
|
||||
m_mae.filterParamChanged(layer, m_dmxSettings.at(layer).audioDevice, SEND1, value / 255);
|
||||
break;
|
||||
case Slider::Bus2:
|
||||
m_mae.filterParamChanged(layer, m_dmxSettings.at(layer).audioDevice, SEND2, value / 255);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -413,14 +413,17 @@ ma_result MiniAudioEngine::printFormatInfo(int layer)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Expects between 0 and 1 vol value
|
||||
void MiniAudioEngine::volChanged(int layer, float vol)
|
||||
// Expects between 0 and 65535 vol value
|
||||
void MiniAudioEngine::volChanged(int layer, int vol)
|
||||
{
|
||||
if (m_mae.mediaLoaded[layer] == false)
|
||||
return;
|
||||
if (vol >= 1)
|
||||
vol = 0.99f;
|
||||
ma_sound_group_set_fade_in_milliseconds(&m_mae.sounds[layer], -1, pow(vol, 2), FADE_TIME);
|
||||
float db = ((float)vol / 771.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_sound_group_set_fade_in_milliseconds(&m_mae.sounds[layer], -1, db, FADE_TIME);
|
||||
m_mae.currentStatus[layer].vol = vol;
|
||||
}
|
||||
|
||||
|
@ -618,13 +621,23 @@ ma_result MiniAudioEngine::filterParamChanged(int layer, int audioDevice, int ch
|
|||
return result;
|
||||
}
|
||||
} else if (channel == SEND1) {
|
||||
ma_node_set_output_bus_volume(&fb->output, 0, pow((value / 255.0f), 2));
|
||||
float db = ((float)value / 3.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_node_set_output_bus_volume(&fb->output, 0, db);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Send 1 Volume." << endl;
|
||||
return result;
|
||||
}
|
||||
} else if (channel == SEND2) {
|
||||
ma_node_set_output_bus_volume(&fb->output, 1, pow((value / 255.0f), 2));
|
||||
float db = ((float)value / 3.0f) - 85.0f;
|
||||
if (db <= -85.0f) {
|
||||
db = 0;
|
||||
} else
|
||||
db = ma_volume_db_to_linear(db);
|
||||
ma_node_set_output_bus_volume(&fb->output, 1, db);
|
||||
if (result != MA_SUCCESS) {
|
||||
cout << "ERROR " << result << ": Failed set Send 2 Volume." << endl;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
protected:
|
||||
ma_result loadMedia(int layer, char *media, uint audioDevice);
|
||||
void volChanged(int layer, float vol);
|
||||
void volChanged(int layer, int vol);
|
||||
void panChanged(int layer, float pan);
|
||||
void pitchChanged(int layer, float pitch);
|
||||
ma_result playbackChanged(int layer, Status status);
|
||||
|
|
|
@ -39,9 +39,10 @@ SliderGroup::SliderGroup(QString name,
|
|||
valueBox.setFocusPolicy(Qt::NoFocus);
|
||||
valueBox.setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
valueBox.setMinimumWidth(50);
|
||||
if (decimals)
|
||||
valueBox.setRange(-100, 100);
|
||||
else
|
||||
if (decimals) {
|
||||
valueBox.setRange(-84.0f, 0.0f);
|
||||
valueBox.setSpecialValueText("-inf");
|
||||
} else
|
||||
valueBox.setRange(min, max);
|
||||
valueBox.setValue(0);
|
||||
valueBox.setDecimals(decimals);
|
||||
|
@ -66,20 +67,27 @@ SliderGroup::SliderGroup(QString name,
|
|||
void SliderGroup::sliderValueChanged(int value)
|
||||
{
|
||||
valueBox.blockSignals(true);
|
||||
valueBox.setValue(value);
|
||||
float db = ((float)value / 771.0f) - 85.0f;
|
||||
if (db <= -84.5f) {
|
||||
valueBox.setSpecialValueText("-inf");
|
||||
} else
|
||||
valueBox.setValue(db);
|
||||
valueBox.blockSignals(false);
|
||||
emit valueChanged(value);
|
||||
};
|
||||
|
||||
void SliderGroup::setValue(float value)
|
||||
{
|
||||
float db;
|
||||
|
||||
slider.blockSignals(true);
|
||||
valueBox.blockSignals(true);
|
||||
if (int(value) != slider.value())
|
||||
slider.setValue(value);
|
||||
if (valueBox.decimals())
|
||||
valueBox.setValue(value - 100.0f);
|
||||
else
|
||||
if (valueBox.decimals()) {
|
||||
db = (float)(value / 771.0f) - 85.0f;
|
||||
valueBox.setValue(db);
|
||||
} else
|
||||
valueBox.setValue(value);
|
||||
slider.blockSignals(false);
|
||||
valueBox.blockSignals(false);
|
||||
|
|
Loading…
Add table
Reference in a new issue