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

typedef struct
    // User params
    //u32 sample_rate;          // [6000, 48000], samples per sec
    s32 room;                 // [-10000, 0], mB
    s32 room_hf;              // [-10000, 0], mB
    f32 decay_time;           // [0.1, 20.0], seconds
    f32 decay_hf_ratio;       // [0.1, 2.0], unitless ratio
    s32 reflections;          // [-10000, 0], mB
    f32 reflections_delay;    // [0.0, 0.3], seconds
    s32 reverb;               // [-10000, 20000], mB
    f32 reverb_delay;         // [0.0, 0.1], seconds
    f32 diffusion;            // [0.0, 100.0], percent
    f32 density;              // [0.0, 100.0], percent
    f32 hf_reference;         // [20.0, 20000.0], Hz
    f32 out_gain;             // [0.0, 1.0]
    f32 dry_gain;             // [0.0, 1.0]

s32  AXFX2ReverbI3dl2GetMemSize                  (AXFX_REVERB_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2ReverbI3dl2Init                        (AXFX2_REVERB_I3DL2 *reverb_i3dl2, AXFX_REVERB_MODE mode, AXFX_SAMPLE_RATE sampleRate);
void AXFX2ReverbI3dl2Shutdown                    (AXFX2_REVERB_I3DL2 *reverb_i3dl2);
BOOL AXFX2ReverbI3dl2ParametersPreset            (AXFX2_REVERB_I3DL2 *reverb_i3dl2, REVERB_CONFIGURATION_TYPE preset);
void AXFX2ReverbI3dl2ParametersMigrateFromReverb (AXFX2_REVERB_I3DL2 *reverb_i3dl2, AXFX2_REVERB *reverb);
BOOL AXFX2ReverbI3dl2SettingsUpdate              (AXFX2_REVERB_I3DL2 *reverb_i3dl2);
BOOL AXFX2ReverbI3dl2SettingsUpdateNoReset       (AXFX2_REVERB_I3DL2 *reverb_i3dl2);
void AXFX2ReverbI3dl2Callback                    (AXFX_6CH_BUFFERUPDATE *bufferUpdate, AXFX2_REVERB_I3DL2 *reverb_i3dl2, AXAUXCBSTRUCT *info);


early_mode Specify an integer value as 0 <= value <= 4. There are five preset arrangements of early reflections. These are designed to emulate different size spaces.

0 = small room
1 = large room
2 = hall
3 = cavern
4 = no early reflection

early_gain Specify a float value as 0.0 <= value <= 1.0. The early gain adjusts the overall levels of all the early reflections.
predelay_time Specify a float value in milliseconds as 0.0 <= value <= 100.0. The predelay time determines the time lag between the sound entering the reverb and the first early reflection. In general, a larger value creates a sense of a larger space.
late_mode Specify an integer value as 0 <= value <= 4. There are five presets that affect the time distribution of reflections in the late reverb.

0 = room
1 = hall
2 = metal corridor
3 = cavern
4 = maximum reverb delay

late_gain Specify a float value as 0.0 <= value <= 1.0. The late gain adjusts the overall level of all the late reverb response.
decay_time Specify a float value in seconds as 0.1 <= value <= 20.0. The decay time is the time it takes the echoes of the late reverb to decrease by 60dB. Of all the parameters, the decay time has the strongest affect on the perceived size of the space. Larger decay times lead to a longer lasting sound, and the sense of a larger space.
hf_decay_ratio Specify a float value as 0.1 <= value <= 1.0. In most spaces high frequencies decay faster than low frequencies. This is due to the reflective properties of most surfaces as well as how sounds are attenuated as they propagate through air. The high frequency decay ratio (hf_decay_ratio) determines the decay time of high frequencies relative to the decay time of low frequencies. For example, when hf_decay_ratio is 0.5, high frequencies will die away twice as fast as low frequencies. When hf_decay_ratio is 1.0 both high and low frequencies will decay at the same rate.
coloration Specify a float value as 0.0 <= value <= 1.0. In a good sounding room the late reverb will not make any particular frequencies stand out, that is it will be colorless. It will also not result in audibly repeating patterns of echoes. However, occasionally it is desirable to design a reverb that does not sound good. For example, a long metal corridor will create patterns of echoes that result in certain frequencies ringing longer. The coloration parameter is useful for adding some of this character to the sound. At 0.0 the reverb should sound colorless, while at 1.0 it will be more colored.
reverb_gain Specify a float value as 0.0 <= value <= 1.0. The reverb gain adjusts the input level driving the reverb algorithm.
out_gain Specify a float value as 0.0 <= value <= 1.0. The out gain adjusts the level of the processed output audio. This gain does not alter the dry output.
dry_gain Specify a float value as 0.0 <= value <= 1.0. The dry gain adjusts the level of the unprocessed input audio which is added to the processed output audio. If the original signal is also being added in the mixer, the dry gain may not be necessary.


There are four reverb effects that operate on 2, 4, and 6 channels. Appropriate values must be assigned to the parameters of the AXFX2_REVERB_I3DL2 structure or one of five presets assigned using the AXFX2ReverbI3dl2ParametersPreset function before the call to AXFX2ReverbI3dl2Init.

Many of the parameters of the reverb interact to create a sense of space. This can make it challenging to choose parameter values. Also some of the parameters, such as the early reflections mode, are subtle, while others are, such as decay time, are quite dramatic. For guidance, experiment with different settings while listening to the resulting sounds.


Library Version Availability
Sound 2.0 Yes
Sound 1.0 No


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.


See Also

AXFX2 Reverb I3DL2 Overview
alleffects demo

Revision History

2014/03/11 CPU metrics
2014/02/12 mono-mixed removed
2014/01/16 Corrected late mode count.
2013/10/29 Removed 6ch reverb.
2013/08/26 Initial version.