aEnvelope.3p 1.71 KB
.TH aEnvelope 3P local "Silicon Graphics, Inc."
.SH NAME
aEnvelope \- Audio envelope modulation
.SH C SPECIFICATION
#include "mbi.h"
.br
.sp
.nf
typedef	short ENV_STATE;
.fi
.sp
aEnvelope(Acmd *pkt, unsigned char flags, ENV_STATE *state)
.SH PARAMETERS
.TP 10
.I pkt
Audio command list pointer.
.TP
.I flags
Set of flags to define behaviour of the envelope command: 

\f2A_MIX\f1, result is mixed into the output buffer.
If not set the result is put into the output buffer.

\f2A_INIT\f1, state is ignored when initiating envelope modulation.
If not set the pointer to state is used to initialize the envelope
modulator.
.TP
.I state
Pointer to Envelope state in DRAM. This is used to read and write state
information and allows processing of streams to be accomplished in small
chunks.
.SH DESCRIPTION
.IR aEnvelope 
modulates a stream in DMEM using a linear (in dB) envelope. 
DMEM input and output buffers and the number of samples to process
are defined by a call to 
.IR aSetBuffer().
Input
and output are 16 bits 2's complement audio samples. The envelope
parameters (ie initial volume, volume rate and volume target)
are set by a call to
.IR aSetVolume().

The output stream is either mixed or put into the output buffer.
The command operates on vectors of 8 samples. 
If the number of samples, defined through the 
.IR aSetBuffer() 
.IR count
parameter, is not a multiple of 8 the command
will produce the smallest multiple of 8 which is greater than count, however,
the state saved to DRAM will reflect the value at the start of the
last block of 8, so that a future call with this state will allow the
last block to be reproduced.
This is used to implement processing of arbitrary length streams, without
the need to save leftover samples.