DALIB(3)

NAME
da_read - read from the device associated with a DAT descriptor

SYNOPSIS
#include dataudiolib.h

int
da_read(int datfd ,unsigned char* data ,int size )

DESCRIPTION
The da_read() function reads a chunk of audio data on the device specified by datfd. The function will convert the audiodata from the DAT internal format from the device/file/stream associated with datfd and convert it into data . The data read from datfd is being buffered.
This function decodes the subcode information from any DAT frame it reads and stores it into the internal state structures, where it can be read using da_control . It also handles calling registred callbacks on subcode data change. See da_add_callback(3) for more information.

PARAMETERS

  Input Parameters

datfd
    A filedescriptor returned by da_open or da_init. (alternating left and right channel).

size
    The size of the audiodata buffer.

  Output Parameters

data
    Will contain the audiodata consisting of 16 bit linear encoded stereo samples

RETURN VALUE
This function returns the number of bytes stored into data.
When an error condition arises, this routine returns -1 and sets errno to indicate the reason for the error. Possible values of errno are:

EINVAL
    The filedescriptor is invalid.

other
    All errnos that can be returned by read(2) .

USAGE EXAMPLE

Read 4096 bytes of audiodata.

		unsigned char	data[4096];
		int		res;
		res=da_read(datfd,data,4096);
		if (res==-1) {
			perror("da_read");
		}

SEE ALSO
da_intro(3),da_write(3)

AUTHOR
Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>