AXFX2_COMPRESSOR

Syntax

#include <cafe.h>
#include <cafe/axfx.h>

typedef struct
{
    // User params
    // -50.0  to     0.0 dB The level the signal must reach to start being compressed.
    f32 threshold;           
    //   1.0  to    30.0    The amount of compression that occurs once the signal exceeds
    //   the threshold. 1.0 == no compression.
    f32 ratio;           
    //   1.0 to 1000.0 msec The time it takes the gain to adjust when the signal level increases.
    f32 attack_time;     
    //   1.0 to 5000.0 msec The time it takes the gain to adjust when the signal level decreases.
    f32 release_time;    
    // 0, 1     Whether the overall gain is boosted to compensate for the reduced maximum output
    // level caused by compression.  0=off, 1=on.
    u32 makeup_gain;     
    // -30.0  to    10.0 dB    Gain applied after the compressor. 0dB = gain of 1.0
    f32 out_gain;        
} AXFX2_COMPRESSOR;

s32  AXFX2CompressorGetMemSize     (AXFX_COMPRESSOR_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2CompressorInit           (AXFX2_COMPRESSOR *compressor, AXFX_COMPRESSOR_MODE mode,
                                                                AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2CompressorSettingsUpdate (AXFX2_COMPRESSOR *compressor);
void AXFX2CompressorShutdown       (AXFX2_COMPRESSOR *compressor);
void AXFX2CompressorCallback       (AXFX_6CH_BUFFERUPDATE *bufferUpdate,
                                    AXFX2_COMPRESSOR *compressor, AXAUXCBSTRUCT *info);

Elements

threshold Specify a float value in dB as -50.0 <= value <= 0.0. The level the signal must reach to start being compressed.
ratio Specify a float value as 1.0 <= value < 30.0. The amount of compression that occurs once the signal exceeds the threshold. 1.0 == no compression.
attack_time Specify a float value in milliseconds as 1.0 <= value <= 1000.0. The time it takes the gain to adjust when the signal level increases.
release_time Specify a float value in milliseconds as 1.0 <= value <= 5000.0. The time it takes the gain to adjust when the signal level decreases.
makeup_gain Specify a value as 0 or 1. Whether the overall gain is boosted to compensate for the reduced maximum output level caused by compression.
  • 0 = off
  • 1 = on
out_gain Specify a float value in dB as -30.0 <= value <= 10.0. Gain applied after the compressor. 0dB = gain of 1.0.

Description

There are three compressor effects that operate on 2, 4, and 6 channels. Appropriate values must be assigned to the parameters of the AXFX2_COMPRESSOR structure function before the call to AXFX2CompressorInit.

Availability

Library Version Availability
Sound 2.0 Yes
Sound 1.0 No

Performance

The following table lists the CPU utilization given the specified mode and channel settings. The Sound 2 Library Interactive Effects demo displays real time CPU usage metrics from which this data is derived.

mode32k48k
2ch2.22%3.36%
4ch2.69%4.03%
6ch3.12%4.68%

When the compressor effect is not actively attenuating the signal, the CPU usage is as follows.

mode32k48k
2ch0.71%1.04%
4ch1.14%1.70%
6ch1.58%2.37%

See Also

AXFX2 Compressor Overview
AXFX2CompressorGetMemSize
AXFX2CompressorInit
AXFX2CompressorShutdown
AXFX2CompressorSettingsUpdate
AXFX2CompressorCallback
alleffects demo

Revision History

2014/03/11 CPU metrics
2013/08/26 Initial version.


CONFIDENTIAL