ALopenport(3dm) ALopenport(3dm)
ALopenport - (obsolete) open an audio port
#include <dmedia/audio.h>
ALport ALopenport(char *name, char *direction, ALconfig config)
name A port name is an ASCII string which summarizes the usage of
this port. It is intended for human consumption, similar to
a window title. Port names have a maximum length of 20
characters.
direction Use this parameter to identify whether the port is an input
or an output port. Acceptable values are:
"r" configures the port for reading (input).
"w" configures the port for writing (output).
config Expects the ALconfig structure returned by ALnewconfig(3dm).
This structure contains information that ALopenport(3dm) uses
to configure the port.
Passing a null (0) structure for this parameter, yields a
port with the default configuration.
ALopenport is obsolete and is provided for backward compatibility. The
preferred function is alOpenPort(3dm).
ALopenport(3dm) allocates and initializes an ALport structure, creating a
programmatic connection to the audio system. You can open more than one
port at a time, up to a limit imposed by the particular hardware
configuration.
The default port has a 100,000 sample stereo buffer, utilizing a 16-bit
two's complement sample format.
Upon opening, an input port immediately begins to fill with samples. You
should remove samples from the port post haste, lest the sample queue
overflow. Upon opening, an output port will attempt to remove samples
from the sample queue. You should provide samples to the port with great
alacrity or the sample queue will underflow.
ALopenport can fail for the following reasons:
AL_BAD_CONFIG config is invalid.
Page 1
ALopenport(3dm) ALopenport(3dm)
AL_BAD_DIRECTION direction is not valid.
AL_BAD_OUT_OF_MEM insufficient memory is available to allocate the
ALport structure.
AL_BAD_DEVICE_ACCESS audio hardware is inaccessible.
AL_BAD_NO_PORTS no audio ports are currently available.
If successful, ALopenport(3dm) returns an ALport structure for the named
port. Otherwise, ALopenport(3dm) returns a null (0) valued structure and
sets an error number; this error can be retrieved with oserror(3C).
ALcloseport(3dm), ALnewconfig(3dm), ALsetconfig(3dm), ALqueryparams(3dm),
oserror(3C)
alOpenPort(3dm) alOpenPort(3dm)
alOpenPort - open an audio port
#include <dmedia/audio.h>
ALport alOpenPort(char *name, char *direction, ALconfig config)
name A port name is a character string describing the port. It is
intended for human consumption, similar to a window title.
Port names have a maximum length of 20 characters.
direction Specifies whether the port is for input or output.
"r" specifies an input port.
"w" specifies an output port.
config Expects an ALconfig, as returned by alNewConfig(3dm) or
alGetConfig(3dm). This structure describes the data format
and queue size for the port.
Passing a null (0) value for config yields a port with the
default configuration.
alOpenPort(3dm) allocates and initializes an audio port (ALport). An
audio port is the mechanism through which an application reads or writes
real-time audio data. There are two types of ports: input and output. An
input port receives a real-time stream of audio data from an audio input
device. An output port sends a single real-time stream of audio data to
an output device or devices.
A single application may have multiple ports open simultaneously, or
multiple applications may have ports open, either sharing audio devices
or using multiple audio devices. There is, however, a system-dependent
limit to the total number of audio ports active on a given system.
This limit can be found by retrieving the value of the AL_MAX_PORTS
parameter on the AL_SYSTEM resource; see alParams(3dm) and
alGetParams(3dm) for information on how to do this.
As soon as the call to alOpenPort completes successfully, the port is
considered "open." This means it will be filling or draining audio data
in real-time at the rate of the audio device to which the port is
connected. The application must read or write enough data frequently
enough that the port does not underflow or overflow. Refer to
alReadFrames(3dm), alWriteFrames(3dm), alDiscardFrames(3dm), and
alZeroFrames(3dm) for more information on how to read and write audio
data to and from a port.
Page 1
alOpenPort(3dm) alOpenPort(3dm)
Also note that an open audio port consumes CPU and memory resources even
if the application is not actively reading or writing audio data. If your
application is not using an audio port, it is best to close it.
The default port has a 50,000 sample frame stereo buffer, using a 16-bit
two's complement sample format.
If successful, alOpenPort(3dm) returns a non-zero ALport handle for the
port. Otherwise, alOpenPort(3dm) returns a null (0) ALport and sets an
error code, which can be retrieved via oserror(3C).
alOpenPort can fail with the following error codes:
AL_BAD_CONFIG config is invalid.
AL_BAD_DIRECTION direction is neither "r" nor "w."
AL_BAD_OUT_OF_MEM insufficient memory is available to allocate the
ALport, or the device has refused the connection
for some other reason including: 1) the microcode
is not yet loaded on the Indigo R4000 DSP 2)
another subcode port is currently writing the same
subcode format to the device.
AL_BAD_DEVICE_ACCESS audio hardware is not available, or is improperly
configured.
AL_BAD_DEVICE the device given in the config is bad, either
because it does not exist, or because it has the
wrong direction (input vs. output).
AL_BAD_NO_PORTS no audio ports are currently available.
AL_BAD_SAMPFMT the device given in the config does
not support the sample format given in the config.
This should only occur if a device does not
support a subcode sample format.
alClosePort(3dm), alNewConfig(3dm), alSetConfig(3dm), ALqueryparams(3dm),
oserror(3C)
PPPPaaaaggggeeee 2222 [ Back ]
|