Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dBV is actually mislabeled dBFS #3095

Merged
merged 3 commits into from
Nov 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3422,7 +3422,7 @@ You can remove and move FX channels in the context menu, which is accessed by ri
<translation type="unfinished"></translation>
</message>
<message>
<source>Please enter a new value between -96.0 dBV and 6.0 dBV:</source>
<source>Please enter a new value between -96.0 dBFS and 6.0 dBFS:</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down Expand Up @@ -4019,7 +4019,7 @@ Please visit http://lmms.sf.net/wiki for documentation on LMMS.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Volume as dBV</source>
<source>Volume as dBFS</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down Expand Up @@ -6010,7 +6010,7 @@ Reason: &quot;%2&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display volume as dBV </source>
<source>Display volume as dBFS </source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
1 change: 1 addition & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class EXPORT ConfigManager
~ConfigManager();

void upgrade_1_1_90();
void upgrade_1_1_91();
void upgrade();

QString m_lmmsRcFile;
Expand Down
4 changes: 2 additions & 2 deletions include/SetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private slots:

void toggleToolTips( bool _enabled );
void toggleWarnAfterSetup( bool _enabled );
void toggleDisplaydBV( bool _enabled );
void toggleDisplaydBFS( bool _enabled );
void toggleMMPZ( bool _enabled );
void toggleDisableBackup( bool _enabled );
void toggleOpenLastProject( bool _enabled );
Expand Down Expand Up @@ -136,7 +136,7 @@ private slots:

bool m_toolTips;
bool m_warnAfterSetup;
bool m_displaydBV;
bool m_displaydBFS;
bool m_MMPZ;
bool m_disableBackup;
bool m_openLastProject;
Expand Down
34 changes: 17 additions & 17 deletions include/lmms_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,43 +243,43 @@ static inline float linearToLogScale( float min, float max, float value )



//! @brief Converts linear amplitude (0-1.0) to dBV scale. Handles zeroes as -inf.
//! @param amp Linear amplitude, where 1.0 = 0dBV.
//! @return Amplitude in dBV. -inf for 0 amplitude.
static inline float safeAmpToDbv( float amp )
//! @brief Converts linear amplitude (0-1.0) to dBFS scale. Handles zeroes as -inf.
//! @param amp Linear amplitude, where 1.0 = 0dBFS.
//! @return Amplitude in dBFS. -inf for 0 amplitude.
static inline float safeAmpToDbfs( float amp )
{
return amp == 0.0f
? -INFINITY
: log10f( amp ) * 20.0f;
}


//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0. Handles infinity as zero.
//! @param dbv The dBV value to convert: all infinites are treated as -inf and result in 0
//! @brief Converts dBFS-scale to linear amplitude with 0dBFS = 1.0. Handles infinity as zero.
//! @param dbfs The dBFS value to convert: all infinites are treated as -inf and result in 0
//! @return Linear amplitude
static inline float safeDbvToAmp( float dbv )
static inline float safeDbfsToAmp( float dbfs )
{
return isinff( dbv )
return isinff( dbfs )
? 0.0f
: exp10f( dbv * 0.05f );
: exp10f( dbfs * 0.05f );
}


//! @brief Converts linear amplitude (>0-1.0) to dBV scale.
//! @param amp Linear amplitude, where 1.0 = 0dBV. ** Must be larger than zero! **
//! @return Amplitude in dBV.
static inline float ampToDbv( float amp )
//! @brief Converts linear amplitude (>0-1.0) to dBFS scale.
//! @param amp Linear amplitude, where 1.0 = 0dBFS. ** Must be larger than zero! **
//! @return Amplitude in dBFS.
static inline float ampToDbfs( float amp )
{
return log10f( amp ) * 20.0f;
}


//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0
//! @param dbv The dBV value to convert. ** Must be a real number - not inf/nan! **
//! @brief Converts dBFS-scale to linear amplitude with 0dBFS = 1.0
//! @param dbfs The dBFS value to convert. ** Must be a real number - not inf/nan! **
//! @return Linear amplitude
static inline float dbvToAmp( float dbv )
static inline float dbfsToAmp( float dbfs )
{
return exp10f( dbv * 0.05f );
return exp10f( dbfs * 0.05f );
}


Expand Down
6 changes: 3 additions & 3 deletions plugins/Bitcrush/Bitcrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ bool BitcrushEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )
}
if( m_needsUpdate || m_controls.m_inGain.isValueChanged() )
{
m_inGain = dbvToAmp( m_controls.m_inGain.value() );
m_inGain = dbfsToAmp( m_controls.m_inGain.value() );
}
if( m_needsUpdate || m_controls.m_outGain.isValueChanged() )
{
m_outGain = dbvToAmp( m_controls.m_outGain.value() );
m_outGain = dbfsToAmp( m_controls.m_outGain.value() );
}
if( m_needsUpdate || m_controls.m_outClip.isValueChanged() )
{
m_outClip = dbvToAmp( m_controls.m_outClip.value() );
m_outClip = dbfsToAmp( m_controls.m_outClip.value() );
}
m_needsUpdate = false;

Expand Down
4 changes: 2 additions & 2 deletions plugins/Bitcrush/BitcrushControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
inGain->move( 12, 25 );
inGain->setModel( & controls->m_inGain );
inGain->setLabel( tr( "GAIN" ) );
inGain->setHintText( tr( "Input Gain:" ) + " ", " dBV" );
inGain->setHintText( tr( "Input Gain:" ) + " ", " dBFS" );

Knob * inNoise = new Knob( knobBright_26, this );
inNoise->move( 12, 70 );
Expand All @@ -69,7 +69,7 @@ BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
outGain->move( 176, 25 );
outGain->setModel( & controls->m_outGain );
outGain->setLabel( tr( "GAIN" ) );
outGain->setHintText( tr( "Output Gain:" ) + " ", " dBV" );
outGain->setHintText( tr( "Output Gain:" ) + " ", " dBFS" );

Knob * outClip = new Knob( knobBright_26, this );
outClip->move( 176, 70 );
Expand Down
8 changes: 4 additions & 4 deletions plugins/CrossoverEQ/CrossoverEQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ bool CrossoverEQEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames
// gain values update
if( m_needsUpdate || m_controls.m_gain1.isValueChanged() )
{
m_gain1 = dbvToAmp( m_controls.m_gain1.value() );
m_gain1 = dbfsToAmp( m_controls.m_gain1.value() );
}
if( m_needsUpdate || m_controls.m_gain2.isValueChanged() )
{
m_gain2 = dbvToAmp( m_controls.m_gain2.value() );
m_gain2 = dbfsToAmp( m_controls.m_gain2.value() );
}
if( m_needsUpdate || m_controls.m_gain3.isValueChanged() )
{
m_gain3 = dbvToAmp( m_controls.m_gain3.value() );
m_gain3 = dbfsToAmp( m_controls.m_gain3.value() );
}
if( m_needsUpdate || m_controls.m_gain4.isValueChanged() )
{
m_gain4 = dbvToAmp( m_controls.m_gain4.value() );
m_gain4 = dbfsToAmp( m_controls.m_gain4.value() );
}

// mute values update
Expand Down
8 changes: 4 additions & 4 deletions plugins/CrossoverEQ/CrossoverEQControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * contro
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain1->move( 7, 56 );
gain1->setDisplayConversion( false );
gain1->setHintText( tr( "Band 1 Gain:" ), " dBV" );
gain1->setHintText( tr( "Band 1 Gain:" ), " dBFS" );

Fader * gain2 = new Fader( &controls->m_gain2, "Band 2 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain2->move( 47, 56 );
gain2->setDisplayConversion( false );
gain2->setHintText( tr( "Band 2 Gain:" ), " dBV" );
gain2->setHintText( tr( "Band 2 Gain:" ), " dBFS" );

Fader * gain3 = new Fader( &controls->m_gain3, "Band 3 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain3->move( 87, 56 );
gain3->setDisplayConversion( false );
gain3->setHintText( tr( "Band 3 Gain:" ), " dBV" );
gain3->setHintText( tr( "Band 3 Gain:" ), " dBFS" );

Fader * gain4 = new Fader( &controls->m_gain4, "Band 4 Gain", this,
&m_fader_bg, &m_fader_empty, &m_fader_knob );
gain4->move( 127, 56 );
gain4->setDisplayConversion( false );
gain4->setHintText( tr( "Band 4 Gain:" ), " dBV" );
gain4->setHintText( tr( "Band 4 Gain:" ), " dBFS" );

// leds
LedCheckBox * mute1 = new LedCheckBox( "", this, tr( "Band 1 Mute" ), LedCheckBox::Green );
Expand Down
2 changes: 1 addition & 1 deletion plugins/Delay/DelayControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ DelayControlsDialog::DelayControlsDialog( DelayControls *controls ) :
outFader->setMaximumHeight( 196 );
outFader->move( 263, 42 );
outFader->setDisplayConversion( false );
outFader->setHintText( tr( "Gain" ), "dBv" );
outFader->setHintText( tr( "Gain" ), "dBFS" );

XyPad * pad = new XyPad( this, &controls->m_feedbackModel, &controls->m_delayTimeModel );
pad->resize( 196, 196 );
Expand Down
2 changes: 1 addition & 1 deletion plugins/Delay/DelayEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool DelayEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames )

if( m_delayControls.m_outGainModel.isValueChanged() )
{
m_outGain = dbvToAmp( m_delayControls.m_outGainModel.value() );
m_outGain = dbfsToAmp( m_delayControls.m_outGainModel.value() );
}
int sampleLength;
for( fpp_t f = 0; f < frames; ++f )
Expand Down
4 changes: 2 additions & 2 deletions plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
EqFader *inGainFader = new EqFader( &controls->m_inGainModel, tr( "In Gain" ), this, &controls->m_inPeakL, &controls->m_inPeakR );
mainLayout->addWidget( inGainFader, 0, 0 );
inGainFader->setDisplayConversion( false );
inGainFader->setHintText( tr( "Gain" ), "dBv");
inGainFader->setHintText( tr( "Gain" ), "dBFS");

EqFader *outGainFader = new EqFader( &controls->m_outGainModel, tr( "Out Gain" ), this, &controls->m_outPeakL, &controls->m_outPeakR );
mainLayout->addWidget( outGainFader, 0, 9 );
outGainFader->setDisplayConversion( false );
outGainFader->setHintText( tr( "Gain" ), "dBv" );
outGainFader->setHintText( tr( "Gain" ), "dBFS" );

// Gain Fader for each Filter exepts the pass filter
for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ )
Expand Down
4 changes: 2 additions & 2 deletions plugins/Eq/EqEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )

if( m_eqControls.m_outGainModel.isValueChanged() )
{
m_outGain = dbvToAmp(m_eqControls.m_outGainModel.value());
m_outGain = dbfsToAmp(m_eqControls.m_outGainModel.value());
}

if( m_eqControls.m_inGainModel.isValueChanged() )
{
m_inGain = dbvToAmp(m_eqControls.m_inGainModel.value());
m_inGain = dbfsToAmp(m_eqControls.m_inGainModel.value());
}

m_eqControls.m_inProgress = true;
Expand Down
2 changes: 1 addition & 1 deletion plugins/MultitapEcho/MultitapEcho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ bool MultitapEchoEffect::processAudioBuffer( sampleFrame * buf, const fpp_t fram
// get processing vars
const int steps = m_controls.m_steps.value();
const float stepLength = m_controls.m_stepLength.value();
const float dryGain = dbvToAmp( m_controls.m_dryGain.value() );
const float dryGain = dbfsToAmp( m_controls.m_dryGain.value() );
const bool swapInputs = m_controls.m_swapInputs.value();

// check if number of stages has changed
Expand Down
2 changes: 1 addition & 1 deletion plugins/MultitapEcho/MultitapEchoControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ MultitapEchoControlDialog::MultitapEchoControlDialog( MultitapEchoControls * con
dryGain->move( 150, 245 );
dryGain->setModel( & controls->m_dryGain );
dryGain->setLabel( tr( "Dry" ) );
dryGain->setHintText( tr( "Dry Gain:" ) , " dBV" );
dryGain->setHintText( tr( "Dry Gain:" ) , " dBFS" );

Knob * stages = new Knob( knobBright_26, this );
stages->move( 200, 245 );
Expand Down
2 changes: 1 addition & 1 deletion plugins/MultitapEcho/MultitapEchoControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void MultitapEchoControls::ampSamplesChanged( int begin, int end )
const float * samples = m_ampGraph.samples();
for( int i = begin; i <= end; ++i )
{
m_effect->m_amp[i] = dbvToAmp( samples[i] );
m_effect->m_amp[i] = dbfsToAmp( samples[i] );
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamics_processor/dynamics_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Plugin::Descriptor PLUGIN_EXPORT dynamicsprocessor_plugin_descriptor =

}

const float DYN_NOISE_FLOOR = 0.00001f; // -100dBV noise floor
const float DYN_NOISE_FLOOR = 0.00001f; // -100dBFS noise floor
const double DNF_LOG = 5.0;

dynProcEffect::dynProcEffect( Model * _parent,
Expand Down
17 changes: 15 additions & 2 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ void ConfigManager::upgrade_1_1_90()
}
}


void ConfigManager::upgrade_1_1_91()
{
// rename displaydbv to displaydbfs
if ( !value( "app", "displaydbv" ).isNull() ) {
setValue( "app", "displaydbfs", value( "app", "displaydbv" ) );
deleteValue( "app", "displaydbv" );
}
}


void ConfigManager::upgrade()
{
Expand All @@ -152,6 +162,11 @@ void ConfigManager::upgrade()
upgrade_1_1_90();
}

if ( createdWith.setCompareType(ProjectVersion::Build) < "1.1.91" )
{
upgrade_1_1_91();
}

// Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc)
if ( createdWith.setCompareType(ProjectVersion::Minor) != LMMS_VERSION )
{
Expand Down Expand Up @@ -546,5 +561,3 @@ void ConfigManager::saveConfigFile()
outfile.write( xml.toUtf8() );
outfile.close();
}


5 changes: 2 additions & 3 deletions src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,8 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,
m_fader = new Fader( &fxChannel->m_volumeModel,
tr( "FX Fader %1" ).arg( channelIndex ), m_fxLine );
m_fader->setLevelsDisplayedInDBFS();
// TODO dbvToAmp is really dBFSToAmp. Rename in later commit.
m_fader->setMinPeak(dbvToAmp(-42));
m_fader->setMaxPeak(dbvToAmp(9));
m_fader->setMinPeak(dbfsToAmp(-42));
m_fader->setMaxPeak(dbfsToAmp(9));

m_fader->move( 16-m_fader->width()/2,
m_fxLine->height()-
Expand Down
10 changes: 5 additions & 5 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,10 +1200,10 @@ void MainWindow::updateViewMenu()
// that is safe to change on the fly. There is probably some
// more elegant way to do this.
QAction *qa;
qa = new QAction(tr( "Volume as dBV" ), this);
qa->setData("displaydbv");
qa = new QAction(tr( "Volume as dBFS" ), this);
qa->setData("displaydbfs");
qa->setCheckable( true );
qa->setChecked( ConfigManager::inst()->value( "app", "displaydbv" ).toInt() );
qa->setChecked( ConfigManager::inst()->value( "app", "displaydbfs" ).toInt() );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to need an upgrade()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even do upgrades for .lmmsrc.xml? If so, yes I can write an upgrade.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Albeit rather recently, yes we do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll look into it.

Copy link
Member Author

@Umcaruje Umcaruje Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tresf done per 5a7acd3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

m_viewMenu->addAction(qa);

// Maybe this is impossible?
Expand Down Expand Up @@ -1244,9 +1244,9 @@ void MainWindow::updateConfig( QAction * _who )
QString tag = _who->data().toString();
bool checked = _who->isChecked();

if( tag == "displaydbv" )
if( tag == "displaydbfs" )
{
ConfigManager::inst()->setValue( "app", "displaydbv",
ConfigManager::inst()->setValue( "app", "displaydbfs",
QString::number(checked) );
}
else if ( tag == "tooltips" )
Expand Down
Loading