N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## n_alSynSetFXParam

Syntax

    #include <n_libaudio.h>
    void n_alSynSetFXParam(ALFxRef fx, s16 paramID, void *param);

Arguments

- fx is the pointer to an effect
- paramID is the identifier for the parameter to be modified
- param is the pointer to the new parameter value

Explanation
This function is available in the n_audio library. It sets the specified effect parameter to the value pointed to by param. The paramID is an index into the array of s32 values (arguments) passed in the ALSynConfig structure when n_alInit is called. The first two values, which specify the number of delay sections, and the size of the fx delay line respectively, cannot be changed. The remaining values are divided into sections that consist of the following eight arguments for each section:

- input is the location in the delay line that the feed-forward multiplier uses as its input. It is also where the feedback multiplier's result is stored. This argument is specified in samples, and must be eight-sample aligned. The value pointed to by this argument should be an unsigned 32-bit integer. The input argument has an offset of 0 from the start of the delay section.
- output is the location in the delay line that the feedback multiplier uses as its input. It is also where the feed-forward multiplier stores its result if there is no output resampler. The output argument is specified in samples, and it must be eight-sample aligned. The value pointed to by the output argument should be an unsigned 32-bit integer. The output argument has and offset of 1 from the start of the delay section.
- fbcoef is the delay section's feedback coefficient. The value pointed to by this argument should be a signed 32-bit value. Only the lower 15 bits are significant, and the upper bits are sign extended. The lower 15 bits can be thought of as a fraction representing values from 1 to -1. The fbcoef argument has an offset of 2 from the start of the delay section.
- ffcoef is the delay section's feed-forward coefficient. The value pointed to by this argument should be a signed 32-bit value. Only the lower 15 bits are significant, and the upper bits are sign extended. The lower 15 bits can be thought of as a fraction representing values from 1 to -1. The ffcoef argument has an offset of 3 from the start of the delay section.
- gain is the delay section's gain value (that is, its contribution to the final effect output). The value pointed to by this argument should be a signed 32-bit value. Only the lower 15 bits are significant, and the upper bits are sign extended. The lower 15 bits can be thought of as a fraction representing values from 1 to -1. The gain argument has an offset of 4 from the start of the delay section.
- chorusrate is the delay section's chorus rate. It specifies the rate-modulation frequency of the output tap position of the delay line. That is, it specifies how quickly the tap position will be modulated. The value of this argument is (frequency/sample rate)*2^25. For example, a modulation frequency of .5Hz at a synthesizer sample rate of 44.1kHz would be (.5/44100)*33,554,432 = 380. The chorus rate argument has an offset of 5 from the start of the delay section.
- chorusdepth is the delay section's chorus depth. It specifies the depth-modulation depth, or pitch change, of the effect. The value is specified approximately in hundredths of a cent. So a modulation depth of +/-25 cents, or a quarter of a semitone, would be 2500. The approximation to cents is good over the range useful for musical chorus and flange (that is, less than a few semitones). The error at 1 semitone (100 cents) is about 3 cents and at 3 semitones is about 30 cents. The chorus depth argument has an offset of 5 from the start of the delay section.
- lpfilt is the delay section's low-pass filter coefficient. The value pointed to by this argument should be a signed 32-bit value. Only the lower 15 bits are significant, and the upper bits are sign extended. The lower 15 bits can be thought of as a fraction representing values from 1 to -1. The lpfilt argument has an offset of 7 from the start of the delay section.

Example
The following code shows how to set the ffcoef of the third delay section, to a value of .5:

    ALFxRef fxref;
    s16 paramID;
    s32 section = 2;
    /* third section */

    s32 offset = 3;
    /* ffcoef has an offset of 3 */

    s32 value = 0x4000;
    /* .5 expressed as a */
    /* 15 bit fraction */

    fxref = n_alSynGetFXRef(synth, 0, 0);
    paramID = (section * 8)
       + param_number + 2;
    n_alSynSetFXParam(synth,
       fxref, paramID, value);

Warning
This function (n_alSynSetFXParam) does very minimal checking on the values passed to it. You can easily create an unpleasant feedback loop. Also, it does not check to verify that the paramID value is valid. Sending a param with an invalid paramID can cause unpredictable results.
See Also
n_alSynAllocFX
n_alSynFreeFX
n_alSynGetFXRef

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999