Antigona Release #1
7 changed files with 76 additions and 10 deletions
|
@ -91,9 +91,39 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, int layer):
|
|||
volumeBox->setSpacing(0);
|
||||
volumeBox->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(volumeBox);
|
||||
m_level = new QLabel();
|
||||
m_level->setText("0");
|
||||
layout->addWidget(m_level);
|
||||
QHBoxLayout *labelsBox = new QHBoxLayout;
|
||||
m_level = new QLabel("-inf");
|
||||
m_level->setStyleSheet("border: 1px solid #5a4855;"
|
||||
"margin: 0px;"
|
||||
"background-color: #180014;"
|
||||
"color: white;"
|
||||
"width:70px;"
|
||||
"text-align: center;"
|
||||
);
|
||||
m_level->setMinimumWidth(70);
|
||||
m_level->setAlignment(Qt::AlignHCenter);
|
||||
labelsBox->addWidget(m_level);
|
||||
m_bus1Label = new QLabel("dummy");
|
||||
m_bus1Label->setMinimumWidth(80);
|
||||
m_bus1Label->setStyleSheet("border: 1px solid #5a4855;"
|
||||
"margin: 0px;"
|
||||
"background-color: #383034;"
|
||||
"width:70px;"
|
||||
);
|
||||
m_bus1Label->setAlignment(Qt::AlignHCenter);
|
||||
labelsBox->addWidget(m_bus1Label);
|
||||
m_bus2Label = new QLabel("dummy");
|
||||
m_bus2Label->setMinimumWidth(80);
|
||||
m_bus2Label->setStyleSheet("border: 1px solid #5a4855;"
|
||||
"margin: 0px;"
|
||||
"background-color: #383034;"
|
||||
"width: 70px;"
|
||||
);
|
||||
m_bus2Label->setAlignment(Qt::AlignHCenter);
|
||||
labelsBox->addWidget(m_bus2Label);
|
||||
labelsBox->setSpacing(0);
|
||||
labelsBox->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(labelsBox);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
|
@ -255,9 +285,22 @@ void AudioLayerWidget::setFilterParam(int channel, int value)
|
|||
void AudioLayerWidget::setLevel(float db)
|
||||
{
|
||||
m_level->blockSignals(true);
|
||||
if (db > -200)
|
||||
if (db > -150)
|
||||
m_level->setText(QString::number(db));
|
||||
else
|
||||
m_level->setText("-inf");
|
||||
m_level->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setBusName(uint bus, char *name)
|
||||
{
|
||||
if (bus == 0) {
|
||||
m_bus1Label->blockSignals(true);
|
||||
m_bus1Label->setText(name);
|
||||
m_bus1Label->blockSignals(false);
|
||||
} else if (bus == 1) {
|
||||
m_bus2Label->blockSignals(true);
|
||||
m_bus2Label->setText(name);
|
||||
m_bus2Label->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
void setPitch(int pitch);
|
||||
void setFilterParam(int channel, int value);
|
||||
void setLevel(float db);
|
||||
void setBusName(uint bus, char *name);
|
||||
|
||||
private:
|
||||
Status m_status;
|
||||
|
@ -37,7 +38,6 @@ private:
|
|||
QPushButton *m_suspendResumeButton;
|
||||
ClickableLabel *m_fileValue;
|
||||
ClickableLabel * m_folderValue;
|
||||
QLabel *m_level;
|
||||
SliderGroup *m_volume;
|
||||
SliderGroup *m_pan;
|
||||
SliderGroup *m_pitch;
|
||||
|
@ -47,8 +47,9 @@ private:
|
|||
QTimeEdit *m_totalTimeValue;
|
||||
QProgressBar *m_progress;
|
||||
FilterBankWidget *m_filterBank;
|
||||
|
||||
//public slots:
|
||||
QLabel *m_level;
|
||||
QLabel *m_bus1Label;
|
||||
QLabel *m_bus2Label;
|
||||
|
||||
// From Ui
|
||||
private slots:
|
||||
|
|
|
@ -123,3 +123,12 @@ void AudioWidget::levelChanged(int layer, float db)
|
|||
m_layerUpdate[layer].level = db;
|
||||
m_layerUpdate[layer].updated = true;
|
||||
}
|
||||
|
||||
void AudioWidget::busNameChanged(uint bus, char* name)
|
||||
{
|
||||
for (uint i = 0; i < m_layers; i++) {
|
||||
QLayoutItem *item = m_layout->itemAt(i);
|
||||
AudioLayerWidget *alw = dynamic_cast<AudioLayerWidget *>(item->widget());
|
||||
alw->setBusName(bus, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
AudioWidget(QWidget *parent = nullptr);
|
||||
void filterParamChanged(int layer, int channel, int value);
|
||||
void levelChanged(int layer, float db);
|
||||
void busNameChanged(uint bus, char *name);
|
||||
|
||||
private:
|
||||
QHBoxLayout *m_layout;
|
||||
|
|
|
@ -229,6 +229,10 @@ void libreMediaServerAudio::setUi(libreMediaServerAudioUi *lmsUi)
|
|||
connect(m_refreshUi, SIGNAL(timeout()), this, SLOT(refreshUi()));
|
||||
m_refreshUi->start(UI_REFRESH_TIME);
|
||||
m_ola->start(QThread::TimeCriticalPriority );
|
||||
for (uint i = 0; i < m_settings->getAudioDeviceQty(); i++) {
|
||||
char *name = m_mae.getDeviceName(i);
|
||||
m_lmsUi->m_aw->busNameChanged(i, name);
|
||||
}
|
||||
};
|
||||
|
||||
// From Ui widgets
|
||||
|
|
|
@ -340,6 +340,12 @@ ma_result MiniAudioEngine::getAllAudioDevices()
|
|||
return result;
|
||||
}
|
||||
|
||||
char* MiniAudioEngine::getDeviceName(uint id)
|
||||
{
|
||||
return m_mae.pPlaybackDeviceInfos[m_mae.audioDevicesId[id]].name;
|
||||
|
||||
}
|
||||
|
||||
ma_result MiniAudioEngine::loadMedia(int layer, char *file, uint audioDevice)
|
||||
{
|
||||
ma_result result;
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct
|
|||
ma_resource_manager resourceManager;
|
||||
ma_context context;
|
||||
ma_device_info* pPlaybackDeviceInfos;
|
||||
ma_device_info pSelectedPlaybackDeviceInfos[MAX_AUDIODEVICES];
|
||||
ma_uint32 playbackDeviceCount;
|
||||
ma_uint32 devicesSelected;
|
||||
ma_bool8 mediaLoaded[MAX_LAYERS];
|
||||
|
@ -58,12 +59,12 @@ class MiniAudioEngine
|
|||
friend class libreMediaServerAudio;
|
||||
|
||||
public:
|
||||
MiniAudioEngine();
|
||||
void stopEngine();
|
||||
bool startEngine(uint layersQty, uint* audioDevicesID, uint audioDevicesQty);
|
||||
static void audioDataCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
|
||||
|
||||
protected:
|
||||
MiniAudioEngine();
|
||||
void stopEngine();
|
||||
bool startEngine(uint layersQty, uint* audioDevicesID, uint audioDevicesQty);
|
||||
ma_result loadMedia(int layer, char *media, uint audioDevice);
|
||||
void volChanged(int layer, int vol);
|
||||
void panChanged(int layer, float pan);
|
||||
|
@ -84,6 +85,7 @@ protected:
|
|||
float level = ma_vumeter_node_get_level(&m_mae.filters[layer].vumeter);
|
||||
return ma_volume_linear_to_db(level);
|
||||
};
|
||||
char* getDeviceName(uint id);
|
||||
|
||||
private:
|
||||
MAE m_mae;
|
||||
|
|
Loading…
Add table
Reference in a new issue