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

typedef struct
    // User params
    f32 delay_time;          // 1.0 to 50 ms. The average delay.
    f32 mod_depth;           // 0.1 to 1.0.  How much delay is modulated
    f32 mod_rate;            // 0.1 to 2.0 Hz.  How fast the delay is modulated.
    f32 mod_spread;          // 0.0 to 1.0. Spreads the phase of the modulation between channels.
    f32 feedback;            // 0.1 to 1.0. How much of the delay output is fed back to the input.
    f32 out_gain;            // 0.0 to 1.0. The gain of the effect output.
    f32 dry_gain;            // 0.0 to 1.0. The gain of the dry signal.  Set to nonzero when no dry signal is being added in the mixer.

s32  AXFX2ChorusGetMemSize            (AXFX_CHORUS_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2ChorusInit                  (AXFX2_CHORUS *chorus, AXFX_CHORUS_MODE mode, AXFX_SAMPLE_RATE sampleRate);
void AXFX2ChorusShutdown              (AXFX2_CHORUS *chorus);
BOOL AXFX2ChorusSettingsUpdate        (AXFX2_CHORUS *chorus);
BOOL AXFX2ChorusSettingsUpdateNoReset (AXFX2_CHORUS *chorus);
void AXFX2ChorusCallback              (AXFX_6CH_BUFFERUPDATE *bufferUpdate, AXFX2_CHORUS *chorus, AXAUXCBSTRUCT *info);


delay_time Specify a float value in milliseconds as 1.0 <= value <= 50.0. The delay time parameter sets the average amount of delay for each delay line. The actual delay length will vary about this value according to the modulation depth. The parameter is specified as float values in milliseconds, between 1.0 and 50.0 msec.
mod_depth Specify a float value as 0.1 <= value < 1.0. The modulation depth parameter controls how much the delay time varies. When the delay time and modulation depth are high the amount of pitch shift will be large, and when the delay time or modulation depth are small the pitch shift will be less noticeable. The parameter can take float values from 0.1 to 1.0.
mod_rate Specify a float value in Hertz as 0.1 <= value <= 2.0. The modulation rate controls how quickly the delay time changes. It does this by changing the frequency of the low-frequency oscillator. High modulation rates will lead to increased amount of pitch change, as well as more frequent changes between rising and falling pitch.
mod_spread Specify a float value as 0.0 <= value <= 1.0. The phase of the modulation for each channel of the effect can be the same, in which case the pitch of each channel will rise and fall at the same time. Or the modulation phase can be different between the channels, so that at any given time different channels are rising and falling in pitch. The modulation spread parameter controls how much spread there is between the modulation phase of the effect channels.
feedback Specify a float value as 0.1 <= value <= 1.0. The output of the delay line can be fed back and added to the delay line input. The feedback parameter controls the amount of feedback. Add low values feedback will increase the number of perceived sources, while at high values it will result in strange and extreme sounds.
out_gain Specify a value as 0.0 <= value <= 1.0. Out gain controls the output level of the delayed sound. When this is set to 0.0 no chorus effect will be heard, while at high values the effect will be prominent.
dry_gain Specify a value as 0.0 <= value <= 1.0. To create the classical chorus effect you need to hear the original sound as well as the delayed sound. The dry gain parameter controls the amount of original signal mixed into the output. If the original signal is also being added in the mixer, the dry gain may not be necessary.


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


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 Chorus Overview
alleffects demo

Revision History

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