afSaveFilePosition(3dm) afSaveFilePosition(3dm)
afSaveFilePosition, afRestoreFilePosition - save and retrieve logical
audio sample read pointer
#include <dmedia/audiofile.h>
void afSaveFilePosition(AFfilehandle file)
void afRestoreFilePosition(AFfilehandle file)
file is an AFfilehandle structure, previously returned by
afOpenFile(3dm) or afOpenFD(3dm).
afSaveFilePosition() stores the logical audio sample read pointer to
allow an application to perform UNIX operations such as read(2) or
lseek(2). The pointer MUST then be restored via afRestoreFilePosition
before ANY additional calls to AF routines such as afReadFrames(3dm) or
afWriteFrames(3dm). See the CAVEATS in afOpenFD(3dm) and afIntro(3dm).
AFfilehandle file;
int fd, value;
file = afOpenFile("mysound", "r", NULL); /* open file */
afSaveFilePosition(file); /* save file pointer */
fd = afGetFD(handle); /* get file descriptor */
/* now do UNIX operations */
lseek(fd, 50, SEEK_SET);
read(fd, &value, sizeof(value));
afRestoreFilePosition(file); /* restore pointer */
afReadFrames(...); /* and go on */
afIntro(3dm), afGetFD(3dm), afReadFrames(3dm), afWriteFrames(3dm)
PPPPaaaaggggeeee 1111 [ Back ]
|