alSynSetFXParam.3p
5.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
.TH alSynSetFXParam 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
alSynSetFXParam \- set an effect parameter to the specified value.
.SH SYNOPSIS
.nf
\f3
.Op c
#include <libaudio.h>
.sp .8v
void alSynSetFXParam(ALSynth *drvr, ALFxRef fx, s16 paramID, void *param);
.Op
\f1
.fi
.SH PARAMETERS
.TP 10
.I drvr
pointer to the synthsizer driver.
.TP
.I fx
pointer to an effect.
.TP
.I paramID
id for the parameter to be modified.
.TP
.I param
pointer to the new parameter value.
.SH DESCRIPTION
Set the specified effect parameter to the value pointed to by *param. The
paramID is an index into the array of s32 values, params, passed in the
ALSynConfig struct when alInit is called. The first two values, which specify
the number of delay sections, and the size of the fx delay line respectively, can
not be changed. The remaining values are divided into sections, that consist of
eight parameters each. The parameters of each section are:
.PP
.B input
The location in the delay line that the feedforward multiplier uses as
its input. It is also where the feedback multiplier's result is stored.
.I param
is specified in samples, and must be 8 sample aligned. The
value pointed to by param should be an unsigned 32 bit integer. The
input parameter parameter has an offset of 0 from the start of the delay
section.
.PP
.B output
The location in the delay line that the feedback multiplier uses as
its input. It is also where the feedforward mutltiplier stores it's
result if there is no output resampler.
.I output
is specified in samples, and must be 8 sample aligned. The value
pointed to by param should be an unsigned 32 bit integer. The output
parameter has and offset of 1 from the start of the delay section.
.PP
.B fbcoef
The delay section's feed back coefficient. The value pointed to by param 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 parameter has an offset of 2 from the start of the delay section.
.PP
.B ffcoef
The delay section's feed foward coefficient. The value pointed to by param 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 parameter has an offset of 3 from the start of the delay section.
.PP
.B gain
The delay section's gain value, i.e., it's contribution to the final
effect output. The value pointed to by param 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 parameter has an offset of 4 from the
start of the delay section.
.PP
.B chorus rate
The delay section's chorus rate parameter specifies the modulation
frequency of the output tap position of the delay line, i.e., how
quickly the tap position will be modulated. The value of this
parameter 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 parameter has an offset
of 5 from the start of the delay section.
.PP
.B chorus depth
The delay section's chorus depth parameter specifies the modulation
depth, or pitch change, of the effect. The parameter 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 chorusing and
flanging, i.e., 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 parameter has an offset of 5 from the start of the
delay section.
.PP
.B lpfilt
The delay section's low pass filter coefficient. The value pointed to by param 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 parameter has an offset of 7 from the start of the delay section.
.PP
.SH EXAMPLE
The following code example shows how to set the ffcoef of the third delay section,
to a value of .5
.PP
.Ex
ALFxRef fxref;
s16 paramID;
s32 section = 2; /* thirdd section */
s32 offset = 3; /* ffcoef has an offset of 3 */
s32 value = 0x4000; /* .5 expressed as a */
/* 15 bit fraction */
fxref = alSynGetFXRef(synth, 0, 0);
paramID = (section * 8) + param_number + 2;
alSynSetFXParam(synth,fxref,paramID,&value);
.PP
.SH WARNING
alSynSetFXParam does very minimal checking on the values passed to it. You can easily
create a feedback loop that at best will be unpleasant. (At worst painful!) Also,
alSynSetFXParam does not check to verify that the paramID is valid. Sending a param with
an invalid paramID can cause unpredictable results.
.SH SEE ALSO
.IR alSynAllocFX (3P),
.IR alSynFreeFX (3P),
.IR alSynGetFXRef (3P)