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

typedef struct
    // User params
    f32 reverb_gain;         // 0.0 to 1.0
    u32 early_mode;          // presets 0 to 4 for early reflections
    u32 late_mode;           // presets 0 to 4 for late reverb
    f32 predelay_time;       // msec 0 to 100
    f32 decay_time;          // sec 0.1 to 20.0
    f32 hf_decay_ratio;      // 0.1 to 1.0
    f32 coloration;          // 0.0 to 1.0
    f32 early_gain;          // 0.0 to 1.0
    f32 late_gain;           // 0.0 to 1.0
    f32 out_gain;            // 0.0 to 1.0
    f32 dry_gain;            // 0.0 to 1.0

s32  AXFX2ReverbGetMemSize             (AXFX_REVERB_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2ReverbInit                   (AXFX2_REVERB *reverb, AXFX_REVERB_MODE mode,
                                                              AXFX_SAMPLE_RATE sampleRate);
void AXFX2ReverbShutdown               (AXFX2_REVERB *reverb);
BOOL AXFX2ReverbParametersPreset       (AXFX2_REVERB *reverb, REVERB_CONFIGURATION_TYPE preset);
BOOL AXFX2ReverbSettingsUpdate         (AXFX2_REVERB *reverb);
BOOL AXFX2ReverbSettingsUpdateNoReset  (AXFX2_REVERB *reverb);
void AXFX2ReverbCallback               (AXFX_6CH_BUFFERUPDATE *bufferUpdate, AXFX2_REVERB *reverb,
                                                                             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 structure or one of five presets assigned using the AXFX2ReverbParametersPreset function before the call to AXFX2ReverbInit.

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 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/25 Initial version.