Meter control functions


Detailed Description

These functions support reading peak meter information.


Functions

ASX32_API ASX_ERROR ASX_Meter_GetChannels (ASX_HANDLE hMeter, int *pnChannels)
 Returns the number of channels this peak meter has.
ASX32_API ASX_ERROR ASX_Meter_GetPeak (ASX_HANDLE hMeter, float *fdB, const int nChannels)
 Returns the peak meter reading for the given meter control.
ASX32_API ASX_ERROR ASX_Meter_GetRMS (ASX_HANDLE hMeter, float *fdB, const int nChannels)
 Returns the RMS meter reading for the given meter control.
ASX32_API ASX_ERROR ASX_Meter_SetBallistics (ASX_HANDLE hMeter, const enum asxMETER_TYPE nMeterType, const float fAttackTimeMs, const float fDecayTimeMs)
 Set the meter ballistics.


Function Documentation

ASX32_API ASX_ERROR ASX_Meter_GetChannels ASX_HANDLE  hMeter,
int *  pnChannels
 

Returns the number of channels this peak meter has.

Parameters:
hMeter A handle to an ASX meter object.
pnChannels The returned number of channels.
Returns:
Returns 0 if there is no error, otherwise one of asxERROR is returned.

ASX32_API ASX_ERROR ASX_Meter_GetPeak ASX_HANDLE  hMeter,
float *  fdB,
const int  nChannels
 

Returns the peak meter reading for the given meter control.

Some adapters (ASI6000,ASI5000) implement meter controls with ballistics. This means that instead of following the signal instantaneously, meters values have finite attack and decay time constants Ta and Td. For instance when the input is removed, the meter value will decay towards zero (whether or not the meter control is read). It will decay to 37% of its original value in Td seconds. (14% @ 2xTd, 5% @ 3xTd etc)

If meter ballistics are not implemented, when the ASX_Meter_GetPeak function is called the meter statistic for that control will be reset to zero. This means that the period over which the statistic is computed depends on the time between calls to ASX_Meter_GetPeak(). If the call is made 100 times a second, then the value returned would reperesent the peak during a 10ms interval of audio.

The lower limit of meter return value, depends on the adapter series. For all ASI4000 adapters, the minimum value returned is -100dB. For ASI6000,ASI5000 adapters, the minimum value returned is -192dB.

Parameters:
hMeter A handle to an ASX meter object.
fdB A pointer to receive the peak meter reading in dB. The range of this reading it 0.0 to -120.0 dB.
nChannels The number of channels. This should match the number of elements in the fGetDb array.
Returns:
Returns 0 if there is no error, otherwise one of asxERROR is returned.

ASX32_API ASX_ERROR ASX_Meter_GetRMS ASX_HANDLE  hMeter,
float *  fdB,
const int  nChannels
 

Returns the RMS meter reading for the given meter control.

The peak is stereo and the units are in decibels relative to full-scale digital (dbFs). The RMS measurement depends on the waveform shape. For example, playing a fullscale sinewave (with an amplitude of +/-32767 for a 16bit PCM format) will return a RMS reading of -3dB (compared with a Peak meter reading of 0dBFs), while playing a square wave will return a RMS reading of 0dB and playing an impulsive signal like solo drums will return an RMS value much lower than the peak value.

If this meter has ballistics, then Ta=Td=150ms, which simulates the ballistics of a VU meter.

Parameters:
hMeter A handle to an ASX meter object.
fdB A pointer to receive the RMS meter reading in dB. The range of this reading it 0.0 to -120.0 dB.
nChannels The number of channels. This should match the number of elements in the fGetDb array.
Returns:
Returns 0 if there is no error, otherwise one of asxERROR is returned.

ASX32_API ASX_ERROR ASX_Meter_SetBallistics ASX_HANDLE  hMeter,
const enum asxMETER_TYPE  nMeterType,
const float  fAttackTimeMs,
const float  fDecayTimeMs
 

Set the meter ballistics.

The attack and decay values represent the time constants of the equivalent single pole low pass filter used to create the ballistics. With a time constant of T, if the meter is stable at full scale and the input is suddenly removed, the meter will decay. Similarly, if the meter is at zero and a full scale input is applied will move to the new reading at a rate specified by the attack time constant.

The following table shows the percentage of the final meter value over time, when a constant input is suddenly removed (decay) or applied (attack):

Time

Meter decay

Meter attack

0100%0%
T37%63%
2T14%86%
3T5%95%
4T2%98%
5T0.7%99%

Table 2.1: Attack and decay compared to time.

The table was calculated using the following formulas:

decay = intial * e -t/T

and:

attack = initial * ( 1 - e -t/T )

Parameters:
hMeter A handle to an ASX meter object.
nMeterType The meter type to set the balistics of. See asxMETER_TYPE.
fAttackTimeMs The attack time in milliseconds.
fDecayTimeMs The decay time in milliseconds.
Returns:
Returns 0 if there is no error, otherwise one of asxERROR is returned.


Generated on Tue Nov 18 13:03:41 2008 for ASX by  doxygen 1.4.6-NO