ARecordSStream(3X)
NAME
ARecordSStream − initiate a record stream transaction
SYNOPSIS
#include <Alib.h> ATransID
ARecordSStream (
Audio ∗ audio,
AudioAttrMask attr_mask,
AudioAttributes ∗ audio_attributes,
SSRecordParams ∗ rp,
SStream ∗ sstream_return,
long ∗ status_return );
DESCRIPTION
ARecordSStream() initiates a sound stream record transaction and returns a transaction ID and an SStream structure that contains a TCP socket address.
The application connects the socket it has created to the TCP address. The record operation begins immediately or in pause mode, depending on the pause_first field in SSRecordParams. The record stream transaction may be controlled using APauseAudio(), AResumeAudio(), and AStopAudio().
audio specifies the Audio structure associated with this connection.
attr_mask specifies which elements of the audio_attributes structure to use; it is the bitwise inclusive OR of the mask values listed in the Structures section.
If attr_mask is zero, the values in the AudioAttributes structure returned by ABestAudioAttributes() are used.
audio_attributes contains values for type and sampled attributes. Type must be set (i.e., ATSampled), separate from the mask.
If audio_attributes is NULL, the values in the AudioAttributes structure returned by ABestAudioAttributes() are used; values in this structure will also be used for unspecified attributes.
rp specifies the record parameters associated with the record operation.
sstream_return receives the returned SStream structure.
status_return receives the returned status of the operation, unless this parameter is passed in as a NULL pointer. If status_return is set to NULL, Alib will do the error handling.
RETURN VALUE
Upon successful completion, ARecordSStream() returns a transaction ID.
STRUCTURES
The following are defined in /opt/audio/include/Alib.h:
typedef long ATransID; /* Type for transaction ID. */
typedef long AudioAttrMask;
#define ASDataFormatMask ( 1 << ASAFDataFormat )
#define ASBitsPerSampleMask ( 1 << ASAFBitsPerSample )
#define ASSamplingRateMask ( 1 << ASAFSamplingRate )
#define ASChannelsMask ( 1 << ASAFChannels )
#define ASInterleaveMask ( 1 << ASAFInterleave )
#define ASDurationMask ( 1 << ASAFDuration )
typedef struct _SBucket {
AudioAttributes audio_attr; /* Attributes of the audio data
in the sound bucket. */
long max_length; /* The maximum length, in bytes,
of the audio_data buffer. */
char * audio_data; /* A pointer to the buffer that
contains the audio data
for this sound bucket. */
} SBucket;
ERRORS
If status_return is not set to NULL, it can return one of the following values:
0 AENoError No error - the call completed successfully.
2 AEBadAudio The audio structure is invalid. A pointer to a valid audio structure may be missing (use AOpenAudio() to get a valid pointer).
7 AEBadDataFormat The data format specified in the audio_attributes structure is either not appropriate for the file format or is not one of the supported data formats.
10 AEBadGainMatrix The gain matrix specified as part of the record parameters is invalid.
13 AEBadAttribute The specified audio attributes structure contains an unsupported or inconsistent value.
19 AEBadSamplingRate The sampling_rate field of the sound bucket structure is not invalid.
EXAMPLES
The following example starts a record stream transaction, setting up sstream to receive the SStream structure and status to receive an error status return.
ATransID xid; ∗ transID ∗/
Audio ∗ audio; /∗ audio connection ∗/
AudioAttrMask a_mask; /∗ audio attribute mask ∗/
AudioAttributes attribs; /∗ audio attributes∗/
SSRecordParams ss_rp; /∗ sstream record parameters ∗/
SStream sstream; /∗ sstream structure ∗/
long status; /∗ error status ∗/
.
.
.
/∗ record sstream ∗/
xid = ARecordSStream(audio, a_mask, &attribs, &ss_rp,
&sstream, &status);
NOTE
Refer to AConnectRecordSStream(3X) for a comparison of AConnectRecordSStream() and ARecordSStream().
In order to ensure that the compiler finds the Audio Library (libAlib.sl) and the Alib.h header file, you must add the following switches:
-L /opt/audio/lib
-I/opt/audio/include
DEPENDENCIES
This function belongs to the Audio Library of functions that manage connections to an audio server. The audio server must run on a system that has audio hardware. To find out whether or not your system has audio hardware, refer to Using the Audio Developer’s Kit or the online help for the Audio control panel. For information about the audio capabilities of a particular system use the online example audioinfo.c.
AUTHOR
ARecordSStream() was developed by HP.
SEE ALSO
AConnectRecordSStream(), APlaySStream().
Hewlett-Packard Company — Audio Library: February, 1995