BASS_Loudness_Start

Starts loudness measurement on a channel.

HLOUDNESS BASS_Loudness_Start(
    DWORD handle,
    DWORD flags,
    int priority
);

Parameters

handleThe channel handle... a HSTREAM, HMUSIC, or HRECORD.
flagsA combination of these flags.
BASS_LOUDNESS_CURRENTEnable loudness measurement of the last 400ms or up to the duration (in milliseconds) specified in the HIWORD; use MAKELONG(flags,duration). This is always enabled with a duration of at least 400ms even if not specified.
BASS_LOUDNESS_INTEGRATEDEnable integrated loudness measurement.
BASS_LOUDNESS_RANGEEnable loudness range measurement.
BASS_LOUDNESS_PEAKEnable peak level measurement.
BASS_LOUDNESS_TRUEPEAKEnable true peak level measurement.
BASS_LOUDNESS_AUTOFREEAutomatically free the measurement when the channel is freed.
priorityThe DSP priority of the measurements. Any DSP/FX with a higher priority than this will be present in the measurements, while any with lower priority will not. Any with the same priority may or may not be present, depending on which was set first.

Return value

The loudness measurement handle is returned if it is successfully started, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_MEMThere is insufficient memory.

Remarks

The channel's sample data will be measured during DSP/FX processing, with its position in the DSP chain determined by the priority value. The measurement levels can be retrieved with BASS_Loudness_GetLevel or BASS_Loudness_GetLevelMulti.

Each measurement type may use a bit more CPU and/or memory, so only the ones that are needed should be included in the flags parameter. When no longer needed, a measurement can be stopped and its resources freed with BASS_Loudness_Stop. The BASS_LOUDNESS_AUTOFREE flag may also be used to have it freed automatically when the channel is. A measurement may also be moved to another channel via BASS_Loudness_SetChannel.

Example

Start measuring the integrated loudness and loudness range of a channel, with DSP priority -10.
handle = BASS_Loudness_Start(channel, BASS_LOUDNESS_INTEGRATED | BASS_LOUDNESS_RANGE, -10);

Start measuring the loudness of up to 3 seconds of a channel, with DSP priority -20.

handle = BASS_Loudness_Start(channel, MAKELONG(BASS_LOUDNESS_CURRENT, 3000), -20);

See also

BASS_Loudness_GetLevel, BASS_Loudness_GetLevelMulti, BASS_Loudness_Stop