ALnewconfig(3dm) ALnewconfig(3dm)
ALnewconfig - create and initialize an audio ALconfig structure
#include <dmedia/audio.h>
ALconfig ALnewconfig(void) [Toc] [Back]
ALnewconfig is obsolete and is provided for backward compatibility. The
preferred function is alNewConfig(3dm).
Use ALnewconfig(3dm) to create and initialize an ALconfig structure. This
structure is used to pass in configuration information when calling
ALopenport(3dm) or ALsetconfig(3dm).
To change the configuration information stored in an ALconfig structure,
see the commands mentioned below in SEE ALSO.
The default structure specifies a 100,000 sample 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).
ALnewconfig(3dm) can fail for the following reason:
AL_BAD_OUT_OF_MEM insufficient memory is available to allocate the
ALconfig structure.
Upon successful completion ALnewconfig(3dm) returns an opaque ALconfig
structure initialized to the default values. If the structure allocation
fails, ALnewconfig(3dm) returns 0 and sets an error number which can be
retrieved with oserror(3C).
ALfreeconfig(3dm), ALqueuesize(3dm), ALsetwidth(3dm), ALsetchannels(3dm),
ALopenport(3dm), ALsetconfig(3dm), ALgetconfig(3dm), oserror(3C)
Page 1
alNewConfig(3dm) alNewConfig(3dm)
alNewConfig - create and initialize an audio ALconfig structure
#include <dmedia/audio.h>
ALconfig alNewConfig(void) [Toc] [Back]
alNewConfig 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).
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)
*/
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.
alFreeConfig(3dm), ALqueuesize(3dm), alSetWidth(3dm), alSetChannels(3dm),
alOpenPort(3dm), alSetConfig(3dm), alGetConfig(3dm), oserror(3C)
PPPPaaaaggggeeee 2222 [ Back ]
|