alNewConfig(3dm)alNewConfig(3dm)NAMEalNewConfig - create and initialize an audio ALconfig structure
SYNOPSIS
#include <dmedia/audio.h>
ALconfig alNewConfig(void)DESCRIPTIONalNewConfig creates and initializes an ALconfig structure. An ALconfig
structure specifies the audio data format and queue size to be used by an
audio port. The functions alOpenPort(3dm) or alSetConfig(3dm) apply the
properties specified in the ALconfig to a new or existing audio port,
respectively.
To change the properties given in an ALconfig structure, see the commands
mentioned below in SEE ALSO.
The default ALconfig specifies a 50,000 sample-frame stereo buffer,
utilizing a 16-bit two's complement sample format.
When an ALconfig structure is no longer needed it should be discarded
with alFreeConfig(3dm).
EXAMPLE
The following code fragment shows how to use an ALconfig to create an
audio port which provides floating-point data.
ALconfig c;
ALport p;
/* Create a config. This defaults to stereo, 16-bit integer data */
c = alNewConfig();
if (!c) {
printf("Couldn't create ALconfig:%s\n", alGetErrorString(oserror()));
exit(-1);
}
/* Specify single-precision floating-point data instead */
alSetSampFmt(c, AL_SAMPFMT_FLOAT);
/* Now attempt to open an audio input port using this config */
p = alOpenPort("ALconfig example", "r", c);
if (!p) {
printf("Couldn't open an audio port:%s\n", alGetErrorString(oserror()));
exit(-1);
}
/*
* We've now got an input port giving us floating-point data. If we
* no longer need the ALconfig, we should free it with alFreeConfig(c);
Page 1
alNewConfig(3dm)alNewConfig(3dm)
*/
DIAGNOSTICS
Upon successful completion, alNewConfig returns an opaque ALconfig
structure initialized to the default values. If the structure allocation
fails, alNewConfig returns 0 and sets an error number which can be
retrieved with oserror(3C).
alNewConfig can fail for the following reason:
AL_BAD_OUT_OF_MEM insufficient memory is available to allocate the
ALconfig structure.
SEE ALSOalFreeConfig(3dm), ALqueuesize(3dm), alSetWidth(3dm), alSetChannels(3dm),
alOpenPort(3dm), alSetConfig(3dm), alGetConfig(3dm), oserror(3C)
Page 2