Skip to content

Commit

Permalink
Several code updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Nov 16, 2024
1 parent 2b08f4a commit 31e88d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
27 changes: 15 additions & 12 deletions include/lsp-plug.in/dsp-units/meters/LoudnessMeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ namespace lsp
namespace dspu
{
/**
* Loudness meter. Allows to specify multiple channels and their roles to measure the
* loudness according to the BS.1770-4 standard specification.
* Momenatry/Short Term Loudness meter. Allows to specify multiple channels and
* their roles to measure the loudness according to the BS.1770-5 standard specification.
* The meter does not output LKFS (LUFS) values nor LU (Loudness Unit) values.
* Instead, it provides the regular RMS value which then can be converted into
* Instead, it provides the regular mean square value which then can be converted into
* DBFS, LKFS/LUFS or LU values by applying corresponding logarithmic function.
*
* This meter is useful for measuring Momentary LUFS and Short-Term LUFS,
* for Integrated LUFS consider using ILUFSMeter.
*
* By default, it uses the standardized K-weighted filter over 400 ms measurement
* window as described by the BS.1770-4 specification.
* window as described by the BS.1770-5 specification.
* If number of channels in the configuration is 1 or 2, then the meter automatically
* sets designation value for inputs to CENTER for mono configuration or LEFT/RIGHT
* for stereo configuration.
Expand Down Expand Up @@ -92,7 +95,7 @@ namespace lsp

size_t nSampleRate; // Sample rate
size_t nPeriod; // Measuring period
size_t nMSRefresh; // RMS refresh counter
size_t nMSRefresh; // RMS refresh counter
size_t nChannels; // Number of channels
size_t nFlags; // Update flags
size_t nDataHead; // Position in the data buffer
Expand Down Expand Up @@ -172,6 +175,13 @@ namespace lsp
* @return linking of the channel
*/
float link(size_t id) const;

/**
* Get channel designation
* @param id identifier of the channel
* @return channel designation
*/
bs::channel_t designation(size_t id) const;

/**
* Set channel active
Expand All @@ -188,13 +198,6 @@ namespace lsp
*/
bool active(size_t id) const;

/**
* Get channel designation
* @param id identifier of the channel
* @return channel designation
*/
bs::channel_t designation(size_t id) const;

/**
* Set weighting function
* @param weighting weighting function
Expand Down
6 changes: 2 additions & 4 deletions src/main/meters/LoudnessMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace lsp
}

// Initialize settings
fPeriod = lsp_min(max_period, dspu::bs::LUFS_MEASURE_PERIOD_MS); // BS.1770-4: RMS measurement period
fPeriod = lsp_min(max_period, dspu::bs::LUFS_MEASURE_PERIOD_MS); // BS.1770-5: RMS measurement period
fMaxPeriod = max_period;
fAvgCoeff = 1.0f;

Expand Down Expand Up @@ -304,9 +304,7 @@ namespace lsp
for (size_t i=0; i<nChannels; ++i)
{
channel_t *c = &vChannels[i];

c->vData = reinterpret_cast<float *>(buf);
buf += szof_period;
c->vData = advance_ptr_bytes<float>(buf, szof_period);
}

// Update settings
Expand Down

0 comments on commit 31e88d0

Please sign in to comment.