                    Using a Replay Sound Compressor
                    ===============================

Sound compression code may be present in a format 2 sound directory. In addition
to the Info, Play and Playx2 files, there may also be:

CInfo    - additional info for compressing
Encode   - mono encoder
Encodex2 - stereo encoder
Decode   - mono decoder
Decodex2 - stereo decoder

The CInfo file is a text file containing values for a controlling program to
read. Each line is started by a value and terminated by a textual comment. For
example, the GSM encoder has:

GSM
160 input frame sample size
8000 preferred sample frequency
8000 recommended lowest sample frequency
8000 recommended highest sample frequency

More values may be added (and other values can be obtained from the Info file).
If a frame size of zero is specified, the format can cope with an arbitrary
number of samples in a frame (and will be called with the number of samples
which fit in a chunk). Otherwise, the encoder will be called with that number
of samples.

Encode and Encodex2 are dynamically loaded code with the following interface:

entry 0: initialise for encoding
         r0: contains sample frequency in Hz for information
         returns
         r0: workspace size required

entry 4: initialise workspace
         r0: contains sample frequency in Hz for information
         r1: pointer to workspace
         r2: size of workspace
         returns
         r0: either 0 or pointer to error block

entry 8: compress a frame
         r0: current bit offset in output buffer (updated on exit)
         r1: pointer to output buffer
         r2: number of samples per channel (usually the input frame sample size)
         r3: pointer to samples
         r4: pointer to workspace
         r5: true (non zero) if frame is start of chunk, false otherwise
         returns
         r0: new current bit offset in output buffer
         r1: either 0 or pointer to error block
         r2: number of samples actually encoded per channel

Samples for encoding are in signed 16 bit linear. Samples for stereo encoding
by Encodex2 are interleaved per sample.

The first initialisation entry point will be called exactly once. The second
initialisation entry point may be called one or more times.

Decode and Decodex2 are dynamically loaded code with the following interface:

entry 0: initialise for decoding
         r0: contains sample frequency in Hz for information
         returns
         r0: workspace size required

entry 4: initialise workspace
         r0: contains sample frequency in Hz for information
         r1: pointer to workspace
         r2: size of workspace
         returns
         r0: either 0 or pointer to error block

entry 8: decompress a frame
         r0: current bit offset in input buffer (updated on exit)
         r1: pointer to input buffer
         r2: number of samples (usually the input frame sample size)
         r3: pointer to output samples
         r4: pointer to workspace
         r5: true (non zero) if frame is start of chunk, false otherwise
         returns
         r0: new current bit offset in input buffer
         r2: actual number of samples produced per channel

Decoded data is again signed 16 bit linear. Stereo data is interleaved per
sample (by Decodex2).

The first initialisation entry point will be called exactly once. The second
initialisation entry point may be called one or more times.

