Miles Sound System SDK 7.2a

AIL_process_digital_audio

The function AIL_process_digital_audio provides high-level access to the Miles sound mixer.

S32 AIL_process_digital_audio(
  void *dest,
  S32 destsize,
  U32 destrate,
  U32 destformat,
  S32 num_srcs,
  AILMIXINFO const * const *srcs
);

In Parameters

destsize
contains the size of the output buffer. If the mixer fills the output buffer, then it will return (allowing you to calling again and again until the source data is exhausted).
destrate
contains the output data rate that you want the destination buffer to be mixed to.
destformat
contains the format that you want the destination buffer to be mixed to. See the MILES_DIGITAL_FORMAT flags for the possible output formats.
num_srcs
contains the number of buffers that you want to mix. If you don't want to mix multiple samples, then just pass 1 for this parameter.
srcs
is a pointer to an array of "num_srcs" AILMIXINFO structures. The only part of the AILMIXINFO structure that you need to set is the Info structure inside the AILMIXINFO structure. The Info structure is of type AILSOUNDINFO, so you can use AIL_WAV_info to set the appropriate fields. See the example below for details.

Out Parameters

dest
points to the output buffer.

Returns

The number of bytes mixed if the call was successful, or 0 if the call failed.

Discussion

You can use this function to mix one or more samples together, perform sample rate conversions - basically anything that the Miles mixer can do!

This function modifies the srcs data structures, so that you can call it over and over mixing the next pieces of the input data each call (this is handy when mixing through a small destination buffer.

This function can directly accept IMA ADPCM compressed data, but not MPEG Layer 3 or other ASI-compressed data.

Multichannel (> 2 channels) data is not supported.

You can use the AIL_WAV_info function to automatically fill the input src->Info structures. However, the output data is raw data, so you should use AIL_WAV_file_write if you need to write the output data in wave format.

Example: The following example will mix two wave files together and write out the result:


void* in1, * in2, * out;
AILMIXINFO mix[2];
U32 outsize, mixsize;
In1=AIL_file_read("file1.wav",0);
In2=AIL_file_read("file2.wav",0);
AIL_WAV_info(in1,&mix[0].Info);
AIL_WAV_info(in2,&mix[1].Info);
outsize=AIL_size_processed_digital_audio(44100,DIG_F_MONO_16,2,mix);
out=AIL_mem_alloc_lock(outsize);
mixsize=AIL_process_digital_audio(out,outsize,44100,DIG_F_MONO_16,2,mix);
AIL_WAV_file_write("mixed.wav",out,mixsize,44100,DIG_F_MONO_16);


Group: Utility Services
Related Functions: AIL_WAV_file_write, AIL_WAV_info, AIL_scratchpad_policy, AIL_set_scratchpad_policy, AIL_size_processed_digital_audio
Related Basic Types: MILES_DIGITAL_FORMAT, MSS_RESOURCE_POLICY, S32, U32, void
Related Structures: AILMIXINFO, AILSOUNDINFO
Related FAQs: How can I assign 3D positions to stereo samples?

For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.