aResample.3p 1.54 KB
.TH aResample 3P local "Silicon Graphics, Inc."
.SH NAME
aResample \- Audio resampling and envelope modulation command
.SH C SPECIFICATION
#include "mbi.h"
.br
.sp
.nf
typedef	struct {
	short volume;
	short pitch;
} RESAMPLE_STATE;
.fi
.sp
aResample(Acmd *pkt, unsigned char flags, short pitch, RESAMPLE_STATE *state)
.SH PARAMETERS
.TP 10
.I pkt
Audio command list pointer.
.TP
.I flags
Set of flags to define behaviour of the resampling 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 resampling.
If not set the pointer to state is used to initialize the resampler.
.TP
.I pitch
Resampling pitch. 
.TP
.I state
Pointer to Resampler state in DRAM.
.SH DESCRIPTION
.IR aResample 
pitch shifts and envelope modulates a stream in DMEM. Input
and output are 16 bit 2's complement audio samples. 
Input and output
and number of samples to process are set by a call to
.IR SetBuffer().
The volume envelope is set by a call to 
.IR aSetVolume().

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.