Handle the nfc-ref-delay config option

This commit is contained in:
Chris Robinson 2017-03-12 13:24:16 -07:00
parent f276e83c8d
commit 097ed84a87
4 changed files with 131 additions and 1 deletions

View File

@ -247,6 +247,16 @@ distance-comp = true
# in the decoder configuration file. Requires hq-mode to be enabled.
nfc = true
## nfc-ref-delay
# Specifies the reference delay value for ambisonic output. When channels is
# set to one of the ambi* formats, this option enables NFC-HOA output with the
# specified Reference Delay parameter. The specified value can then be shared
# with an appropriate NFC-HOA decoder to reproduce correct near-field effects.
# Keep in mind that despite being designed for higher-order ambisonics, this
# applies to first-order output all the same. When left unset, normal output
# is created with no near-field simulation.
nfc-ref-delay =
## quad:
# Decoder configuration file for Quadrophonic channel output. See
# docs/ambdec.txt for a description of the file format.

View File

@ -293,6 +293,9 @@ MainWindow::MainWindow(QWidget *parent) :
mPeriodCountValidator = new QIntValidator(2, 16, this);
ui->periodCountEdit->setValidator(mPeriodCountValidator);
mRefDelayValidator = new QDoubleValidator(0.0, 1000.0, 3, this);
ui->decoderNFRefDelayEdit->setValidator(mRefDelayValidator);
mSourceCountValidator = new QIntValidator(0, 4096, this);
ui->srcCountLineEdit->setValidator(mSourceCountValidator);
mEffectSlotValidator = new QIntValidator(0, 64, this);
@ -332,6 +335,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->decoderHQModeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->decoderDistCompCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->decoderNFEffectsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->decoderNFRefDelaySlider, SIGNAL(valueChanged(int)), this, SLOT(updateRefDelayEdit(int)));
connect(ui->decoderNFRefDelayEdit, SIGNAL(editingFinished()), this, SLOT(updateRefDelaySlider()));
connect(ui->decoderQuadLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(ui->decoderQuadButton, SIGNAL(clicked()), this, SLOT(selectQuadDecoderFile()));
connect(ui->decoder51LineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@ -425,6 +430,7 @@ MainWindow::~MainWindow()
delete ui;
delete mPeriodSizeValidator;
delete mPeriodCountValidator;
delete mRefDelayValidator;
delete mSourceCountValidator;
delete mEffectSlotValidator;
delete mSourceSendValidator;
@ -668,6 +674,13 @@ void MainWindow::loadConfig(const QString &fname)
ui->decoderDistCompCheckBox->setChecked(distcomp);
bool nfeffects = settings.value("decoder/nfc", true).toBool();
ui->decoderNFEffectsCheckBox->setChecked(nfeffects);
double refdelay = settings.value("decoder/nfc-ref-delay", 0.0).toDouble();
ui->decoderNFRefDelayEdit->clear();
if(refdelay > 0.0)
{
ui->decoderNFRefDelayEdit->insert(QString::number(refdelay));
updateRefDelaySlider();
}
ui->decoderQuadLineEdit->setText(settings.value("decoder/quad").toString());
ui->decoder51LineEdit->setText(settings.value("decoder/surround51").toString());
@ -900,6 +913,7 @@ void MainWindow::saveConfig(const QString &fname) const
settings.setValue("decoder/nfc",
ui->decoderNFEffectsCheckBox->isChecked() ? QString(/*"true"*/) : QString("false")
);
settings.setValue("decoder/nfc-ref-delay", ui->decoderNFRefDelayEdit->text());
settings.setValue("decoder/quad", ui->decoderQuadLineEdit->text());
settings.setValue("decoder/surround51", ui->decoder51LineEdit->text());
@ -1115,6 +1129,26 @@ void MainWindow::updatePeriodCountSlider()
}
void MainWindow::updateRefDelayEdit(int delay)
{
ui->decoderNFRefDelayEdit->clear();
if(delay > 0)
{
QString str = QString::asprintf("%0.03f", delay/1000.0);
ui->decoderNFRefDelayEdit->insert(str);
}
enableApplyButton();
}
void MainWindow::updateRefDelaySlider()
{
double pos = ui->decoderNFRefDelayEdit->text().toDouble();
if(pos > 1.0) pos = 1.0;
ui->decoderNFRefDelaySlider->setSliderPosition((int)(pos*1000.0));
enableApplyButton();
}
void MainWindow::selectQuadDecoderFile()
{ selectDecoderFile(ui->decoderQuadLineEdit, "Select Quadrophonic Decoder");}
void MainWindow::select51DecoderFile()

View File

@ -35,6 +35,9 @@ private slots:
void updatePeriodCountEdit(int size);
void updatePeriodCountSlider();
void updateRefDelayEdit(int delay);
void updateRefDelaySlider();
void selectQuadDecoderFile();
void select51DecoderFile();
void select61DecoderFile();
@ -63,6 +66,7 @@ private:
QValidator *mPeriodSizeValidator;
QValidator *mPeriodCountValidator;
QValidator *mRefDelayValidator;
QValidator *mSourceCountValidator;
QValidator *mEffectSlotValidator;
QValidator *mSourceSendValidator;

View File

@ -621,7 +621,7 @@ configuration file.</string>
<property name="geometry">
<rect>
<x>-10</x>
<y>120</y>
<y>160</y>
<width>551</width>
<height>161</height>
</rect>
@ -818,6 +818,88 @@ Quality Mode to be enabled.</string>
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="widget_3" native="true">
<property name="geometry">
<rect>
<x>-10</x>
<y>110</y>
<width>551</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>The reference delay value for ambisonic output. When
Channels is set to one of the Ambisonic formats, this
option enables NFC-HOA output with the specified
Reference Delay parameter. The specified value can then
be shared with an appropriate NFC-HOA decoder to
reproduce correct near-field effects. Keep in mind that
despite being designed for higher-order ambisonics, this
applies to first-order output all the same. When left unset,
normal output is created with no near-field simulation.</string>
</property>
<widget class="QLabel" name="label_27">
<property name="geometry">
<rect>
<x>20</x>
<y>0</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Near-Field Reference Delay:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QSlider" name="decoderNFRefDelaySlider">
<property name="geometry">
<rect>
<x>190</x>
<y>0</y>
<width>251</width>
<height>20</height>
</rect>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLineEdit" name="decoderNFRefDelayEdit">
<property name="geometry">
<rect>
<x>450</x>
<y>0</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>off</string>
</property>
</widget>
<widget class="QLabel" name="label_31">
<property name="geometry">
<rect>
<x>510</x>
<y>0</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>sec.</string>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">