Specifications

Adjusting the Gain
4-12
4.6 Adjusting the Gain
Recall from section 4.2, page 4-4 that the processing function multiplies each
value in the input buffer by the gain and puts the resulting values into the
output buffer. It does this by performing the following statement within a while
loop:
*output++ = *input++ * gain;
This statement multiplies a value in inp_buffer by the gain and places it in the
corresponding location in the out_buffer. The gain is initially set to MINGAIN,
which is defined as 1 in volume.h. To modify the output, you need to change
gain. One way to do this is to use a watch variable.
1) Choose View
Watch Window.
2) Right-click on the Watch window area and choose Insert New Expression
from the pop-up list.
3) Type
gain
as the Expression and click OK.
The value of this variable appears in the Watch window area.
4) If you have halted the program, click the (Animate) toolbar button to
restart the program.
5) Double-click on gain in the Watch window area.
6) In the Edit Variable window, change the gain to 10 and click OK.
7) Notice that the amplitude of the signal in the Output Buffer graph changes
to reflect the increased gain.