#include <dvmamap.h>
An AudioMap performs lookup table mapping from one Audio buffer to another. There are four types of AudioMap for all possible combination of Audio buffers.
- 8-to-8: map unsigned char (0 to 255) to unsigned char (0 to 255)
- 8-to-16: map unsigned char (0 to 255) to short (-32768 to 32767)
- 16-to-8: map short (-32768 to 32767) to unsigned char (0 to 255)
- 16-to-16: map short (-32768 to 32767) to short (-32768 to 32767)
typedef struct AudioMap { unsigned char *table; int srcRes; int destRes; } AudioMap;
- table
- table of lookup values
- srcRes
- bits-per-sample in source buffer (8 or 16)
- destRes
- bits-per-sample in destination buffer (8 or 16)
AudioMap *AudioMap8To8New ()
AudioMap *AudioMap8To16New ()
AudioMap *AudioMap16To8New ()
AudioMap *AudioMap16To16New ()
These functions create a new audio map of the specified type and returns a handle to it.
void AudioMapFree (AudioMap *map)
Free the memory allocated for AudioMap map.
void AudioMapGetDestRes (AudioMap *map)
void AudioMapGetSrcRes (AudioMap *map)
If map is an X-To-Y AudioMap, these functions return X or Y. For instance, if map is an 8to16 AudioMap, AudioMapGetDestRes(map) returns 16, and AudioMapGetSrcRes(map) returns 8.
void AudioMap8To8GetValue(AudioMap *map, int i)
void AudioMap8To16GetValue(AudioMap *map, int i)
void AudioMap16To8GetValue(AudioMap *map, int i)
void AudioMap16To16GetValue(AudioMap *map, int i)
Returns the value of entry i in map.
void AudioMap8To8Copy (AudioMap *src, AudioMap *dest)
void AudioMap8To16Copy (AudioMap *src, AudioMap *dest)
void AudioMap16To8Copy (AudioMap *src, AudioMap *dest)
void AudioMap16To16Copy (AudioMap *src, AudioMap *dest)
Copies the entries from src into dest.
void AudioMap8To8SetValue(AudioMap *map, int i, int value)
void AudioMap8To16SetValue(AudioMap *map, int i, int value)
void AudioMap16To8SetValue(AudioMap *map, int i, int value)
void AudioMap16To16SetValue(AudioMap *map, int i, int value)
Sets the value of entry i in map to value.
void AudioMap8To8InitCustom (unsigned char *values, AudioMap *map)
void AudioMap8To16InitCustom (short *values, AudioMap *map)
void AudioMap16To8InitCustom (unsigned char *values, AudioMap *map)
void AudioMap16To16InitCustom (short *values, AudioMap *map)
Initializes the entries of map using values. For an 8to8 or 8to16 AudioMap, values must be an array with 256 entries. For a 16to8 or 16to16 AudioMap, values must contain 65536 entries.
void AudioMap8To8InitIdentity (AudioMap *map)
void AudioMap16To16InitIdentity (AudioMap *map)
Initializes map to the identity function (i.e., entry i has value i).
void AudioMap8To8InitComplement(AudioMap *map);
void AudioMap16To16InitComplement(AudioMap *map);
Initializes map to the complement function,(i.e., entry i is the one's complement of i).
void AudioMap8to16InitULawToLinear(AudioMap *map);
Initialize an 8-to-16 AudioMap which maps μ-law to linear PCM.
void AudioMap8to16InitALawToLinear(AudioMap *map);
Initialize an 8-to-16 AudioMap which maps A-law to linear PCM.
void AudioMap16To8InitLinearToULaw(AudioMap *map);
Initialize a 16-to-8 AudioMap which maps linear PCM to μ-law.
void AudioMap16To8InitLinearToALaw(AudioMap *map);
Initialize a 16-to-8 AudioMap which maps linear PCM to A-law.
void AudioMap16To16InitBigLittleSwap(AudioMap *map);
Initializes a 16-to-16 AudioMap which maps big-endian 16-bit audio data to little endian (and vice versa).
void AudioMap16To16InitVolume(AudioMap *map, int maxVal);
Initializes a 16-to-16 AudioMap that maps values in the range (-maxVal..maxVal) to -32768..32767. Values less than -maxVal (or greater than maxVal) are clipped to -32768 (32767).
This function is useful in combination with Audio16MaxAbs()
void AudioMap8To88To8Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap8To88To16Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap16To88To8Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap16To88To16Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap8To1616To8Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap8To1616To16Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap16To1616To8Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
void AudioMap16To1616To16Compose (AudioMap *map1, AudioMap *map2, AudioMap *outMap)
AudioMapXToYYToZCompose takes in an X-To-Y AudioMap map1 and a Y-To-Z AudioMap map2, and produces a X-To-Z AudioMap which is a composition of map1 and map2.
void AudioMap8To8Apply (AudioMap *map, Audio *src, Audio *dest)
void AudioMap8To16Apply (AudioMap *map, Audio *src, Audio *dest)
void AudioMap16To8Apply (AudioMap *map, Audio *src, Audio *dest)
void AudioMap16To16Apply (AudioMap *map, Audio *src, Audio *dest)
Applies map to src and stores the result in dest. The resolution of map must match the resolution of src and dest (e.g., if map is an 8-to-16 AudioMap, then src must be an 8-bit AudioBuffer and dest must be a 16-bit AudioBuffer), and the number of channels in src and dest should match (i.e., if src is a stereo buffer, dest should be a stereo buffer).
void AudioMap8To8ApplySome (AudioMap *map, Audio *src, int srcOffset, int srcStride, int destOffset, int destStride, Audio *dest);
void AudioMap8To16ApplySome (AudioMap *map, Audio *src, int srcOffset, int srcStride, int destOffset, int destStride, Audio *dest);
void AudioMap16To8ApplySome (AudioMap *map, Audio *src, int srcOffset, int srcStride, int destOffset, int destStride, Audio *dest);
void AudioMap16To16ApplySome (AudioMap *map, Audio *src, int srcOffset, int srcStride, int destOffset, int destStride, Audio *dest);
Applies map to src and stores the result in dest. Use this function if you only want to use one channel in src or modify one channel in dest. These channels are selected using various combinations of offset and stride:
See the description in the AudioBuffer documentation for more information on the use of offset and stride.
- To read/write the left channel in a stereo buffer use offset=0 and stride=2.
- To read/write the right channel in a stereo buffer use offset=1 and stride=2.
- To read/write a mono buffer use offset=0 and stride=1.
Last updated : Saturday, November 14, 1998, 07:50 PM