afGetFrameSize(3dm) afGetFrameSize(3dm) NAME afGetFrameSize, afGetVirtualFrameSize - get the track / virtual frame size in bytes for a specified audio track from an AFfilehandle structure SYNOPSIS #include <dmedia/audiofile.h> int afGetFrameSize(AFfilehandle file, int track, int extend3to4) int afGetVirtualFrameSize(AFfilehandle file, int track, int extend3to4) PARAMETER file is an AFfilehandle structure, previously created by a call to afOpenFile(3dm). track is an integer which identifies an audio track in file. extend3to4 is a integer boolean value (i.e., 0 or 1) indicating whether the routine should extend the value of the frame size for 24-bit uncompressed data out to 32 bits. Since all currently supported file formats contain exactly one audio track per file, the constant AF_DEFAULT_TRACK should always be used here for now. RETURN VALUE afGetFrameSize() returns the size in bytes of a sample frame in the file referenced by track. afGetVirtualFrameSize() returns size in bytes of a sample frame in the audio buffer as specified by the current virtual format. See afIntro(3dm) for an explanation of virtual format. In case of error, -1 is returned. DESCRIPTION afGetFrameSize() returns the size of a sample frame in an audio track in the file represented by the AFfilehandle argument. afGetVirtualFrameSize() does the same for the virtual format for the given track, as set by any combination of calls to afSetVirtualSampleFormat(3dm) and afSetVirtualChannels(3dm). For monaural data, a sample frame consists of a single audio sample. For stereo data, a sample frame consists of a <left, right> stereo sample pair. The extend3to4 allows the application to choose, in the case where 24-bit uncompressed data is present in the file associated with track, whether to return the actual size in bytes of a frame of data in that track (3 * number_of_channels) or the size of the frames which will be presented to the user (since this will always be 4-byte sign-extended integer). The former is useful for informational purposes, but the latter is necessary for determining the size of the audio buffer to be handed to afReadFrames(3dm). Note that extend3to4 only applies to 24-bit sample width. It is ignored in all other cases. SEE ALSO afWriteFrames(3dm), afReadFrames(3dm), afGetChannels(3dm), afGetVirtualChannels(3dm), afSetVirtualSampleFormat(3dm) Page 2