*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> audio/ALgetframetime (3d)              
Title
Content
Arch
Section
 

Contents


ALgetframetime(3dm)					   ALgetframetime(3dm)


NAME    [Toc]    [Back]

     ALgetframetime - (obsolete) Get the time at which a sample	frame came in
     or	will go	out

SYNOPSIS    [Toc]    [Back]

     #include <dmedia/audio.h>

     int ALgetframetime(const ALport port, unsigned long long *fnum, unsigned long long	*time)

PARAMETERS    [Toc]    [Back]

     port expects the ALport structure for the audio port for which you	wish
	  to know the sample frame number.  This structure is the returned
	  value	of the ALopenport(3dm) call.

     fnum expects a pointer to an unsigned 64-bit value	which is to contain
	  the resultant	sample-frame number.

     time expects a pointer to an unsigned 64-bit value	which is to contain
	  the resultant	sample-frame time, in nanoseconds.

DESCRIPTION    [Toc]    [Back]

     ALgetframetime is obsolete	and is provided	for backward compatibility.
     The preferred function is alGetFrameTime(3dm).

     ALgetframetime returns an atomic pair of (fnum, time). For	an input port,
     the time returned is the time at which the	returned sample	frame arrived
     at	the electrical input on	the machine. For an output port, the time
     returned is the time at which the returned	sample frame will arrive at
     the electrical output on the machine. ALgetframetime therefore accounts
     for all the latency within	the machine, including the group delay of the
     A/D and D/A converters.

     The returned sample frame number is not guaranteed	to be in any
     application's port. For example, an input sample frame as returned	by
     ALgetframetime may	be "in the future": it has not yet arrived in any
     application's port. Similarly, an output sample frame may be "in the
     past": it has already gone	out of some application's port.	In order to
     relate the	sample frame numbers to	those of a particular application's
     audio port, the ALgetframenumber call must	be used.

     ALgetframetime uses the Unadjusted	System Time (UST) as its timeline.
     This allows it to relate to other media which also	use UST. See the man
     page for dmGetUST(3dm) for	more information on UST.

     ALgetframetime can	fail for the following reasons:

     AL_BAD_PORT    [Toc]    [Back]
	  port is invalid.

     AL_BAD_NOT_IMPLEMENTED    [Toc]    [Back]
	  the feature is not implemented on the	given machine. ALgetframetime
	  is not implemented on	Indigo (IP12), 4D/35 (IP12), and Indigo	R4K



									Page 1






ALgetframetime(3dm)					   ALgetframetime(3dm)



	  (IP20) systems.

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion, ALgetframetime(3dm) returns 0.	Otherwise
     ALgetframetime(3dm) returns -1 and	sets an	error number which can be
     retrieved with oserror(3C).

SEE ALSO    [Toc]    [Back]

      
      
     dmGetUST(3dm), ALgetframenumber(3A), oserror(3C)
alGetFrameTime(3dm)					   alGetFrameTime(3dm)


NAME    [Toc]    [Back]

     alGetFrameTime - Get the time at which a sample frame came	in or will go
     out

SYNOPSIS    [Toc]    [Back]

     #include <dmedia/audio.h>

     int alGetFrameTime(const ALport port, stamp_t *fnum, stamp_t *time)

PARAMETERS    [Toc]    [Back]

     port expects the ALport structure for the audio port for which you	wish
	  to know the sample frame number.  This structure is the returned
	  value	of the alOpenPort(3dm) call.

     fnum expects a pointer to an unsigned 64-bit value	which is to contain
	  the resultant	sample-frame number.

     time expects a pointer to an unsigned 64-bit value	which is to contain
	  the resultant	sample-frame time, in nanoseconds.

DESCRIPTION    [Toc]    [Back]

     alGetFrameTime returns an atomic pair of (fnum, time) for the device to
     which port	is connected. For an input device, the time returned is	the
     time at which the returned	sample frame arrived at	the electrical input
     on	the machine. For an output device, the time returned is	the time at
     which the returned	sample frame will arrive at the	electrical output on
     the machine.

     The application cannot request a specific pair of values; alGetFrameTime
     merely returns the	most recent pair available. It is up to	the
     application to use	this pair to calculate the time	associated with	a
     particular	sample-frame, or the sample-frame number associated with a
     particular	time, if desired.

     In	general, the returned sample frame will	not currently be in any
     application's port. For example, an input sample frame as returned	by
     alGetFrameTime may	be "in the future": it has not yet arrived in any
     application's port. Similarly, an output sample frame may be "in the
     past": it has already gone	out of some application's port.	In order to
     relate the	sample frame numbers to	those of a particular application's
     audio port, the alGetFrameNumber call must	be used.

     alGetFrameTime uses the Unadjusted	System Time (UST) as its timeline.
     This allows it to relate to other media which also	use UST. See the man
     page for dmGetUST(3dm) for	more information on UST.

EXAMPLE    [Toc]    [Back]








									Page 1






alGetFrameTime(3dm)					   alGetFrameTime(3dm)



	  stamp_t fn, t;
	  stamp_t fnd,td;
	  double nanosec_per_frame = 1000000000.0 / rate_in_Hz;

	  /*
	   * Get the device sample frame number	associated with	the next
	   * audio sample frame	I'm going to read or write from	this port
	   */
	  alGetFrameNumber(port, &fn);

	  /*
	   * Get some recent pair of (frame number, time) from the audio
	   * device to which my	port is	connected. time	is on a	timeline
	   * called UST	which is given in nanoseconds and shared with the
	   * other audio devices and with other	media.
	   */
	  alGetFrameTime(port, &fnd, &td);

	  /*
	   * Calculate the UST associated with fn, the next sample frame
	   * we're going to read or write. Because this	is signed
	   * arithmetic, this code works for both input	and output ports.
	   */
	  t = td + (stamp_t) ((double)(fn - fnd) * nanosec_per_frame);

	  /*
	   * If	my port	is not in an underflow or overflow state, I can	do an
	   * alReadFrames or alWriteFrames here	and know that t	is the time
	   * associated	with the first sample frame of the buffer I read or
	   * write.
	   */

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion, alGetFrameTime	returns	0. Otherwise
     alGetFrameTime returns -1 and sets	an error number	which can be retrieved
     with oserror(3C).

     alGetFrameTime can	fail for the following reasons:

     AL_BAD_PORT    [Toc]    [Back]
	  port is invalid.

     AL_BAD_NOT_IMPLEMENTED    [Toc]    [Back]
	  the feature is not implemented on the	given machine. alGetFrameTime
	  is not implemented on	Indigo R4K (IP20) systems.

SEE ALSO    [Toc]    [Back]

      
      
     dmGetUST(3dm), alGetFrameNumber(3A), oserror(3C)


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
ALgetframenumber IRIX (obsolete) Get the absolute sample frame number associated with a port
alGetFrameTime IRIX Get the time at which a sample frame came in or will go out
ALgetfloatmax IRIX (obsolete) get/set the maximum value of floating point sample data.
ALgetsampfmt IRIX (obsolete) get/set the sample format setting in an audio ALconfig structure
ALgetwidth IRIX (obsolete) get/set the sample width setting in an audio ALconfig structure
ALgetfillable IRIX (obsolete) report the number of unfilled sample locations in an audio port
ALgetfilled IRIX (obsolete) return the number of filled sample locations in an audio port
alGetFrameNumber IRIX Get the absolute sample frame number associated with a port
AFseekframe IRIX move logical file read pointer for a specified audio track to a desired sample frame location / retrieve curre
AFgetframecnt IRIX get the total sample frame count / data bytes / data offset for a specified audio track from an AFfilehandle s
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service