Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ APlaySStrea(3X) — HP-UX ANSI C A.10.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

APlaySStream(3X)

NAME

APlaySStream − initiate a play stream transaction

SYNOPSIS

#include <Alib.h> ATransID
APlaySStream (

Audio ∗  audio,

AudioAttrMask attr_mask,

AudioAttributes ∗  audio_attributes,

SSPlayParams ∗  pp,

SStream ∗  sstream_return,

long ∗  status_return );

DESCRIPTION

APlaySStream() initiates a play sound stream 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 play operation begins as soon as there is data on the sound stream.  The play 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 one or more 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. 

pp is the pointer to the play parameters associated with the play operation. 

sstream_return receives the TCP socket address of the newly created stream.  The application should do a connect() to the address in the TCP socket address field (for example, sstream_return.tcp_sockaddr). 

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, APlaySStream() 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 )

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 field of the audio attributes structure is not valid. 

10  AEBadGainMatrix The gain matrix specified as part of the play parameters is invalid. 

13  AEBadAttribute The specified audio attributes structure contains an unsupported or inconsistent value.  A possible cause is if the attribute type is not set to ATSampled. 

19  AEBadSamplingRate The sampling_rate field of the audio attributes structure is not valid. 

EXAMPLES

The following example starts a play stream transaction and sets 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∗/

SSPlayParams ss_pp;  /∗ sstream play parameters ∗/

SStream sstream;  /∗ sstream structure ∗/

long status;  /∗ error status ∗/
.
.
.

/∗ play sstream ∗/

xid = APlaySStream(audio, a_mask, attribs, ss_pp, &sstream, &status);

NOTE

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

APlaySStream() was developed by HP. 

SEE ALSO

AConnectRecordSStream(), ARecordSStream().

Hewlett-Packard Company  —  Audio Library: February, 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026