ImageGear for C and C++ on Windows v19.1 - Updated
IG_mult_audio_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Multimedia Functions > IG_mult_audio_get

This function retrieves the next available audio data from a multimedia instance.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_mult_audio_get(
        HIGMULT hMult, 
        LPAT_VOID lpBuffer,
        LPAT_UINT lpBufferSize
);

Arguments:

Name Type Description
hMult HIGMULT Multimedia instance handle.
lpBuffer LPAT_VOID Buffer in which to store audio data.
lpBufferSize LPAT_UINT Pointer to the number of bytes of audio to retrieve (in), and the number of bytes actually retrieved (out).

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

Media Player

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGMULT hMult;          /* Multimedia instance handle */
AT_UINT nSampleRate;    /* Sample rate of audio */
AT_UINT nBitsPerSample; /* Bits per sample */
AT_UINT nChannels;      /* Number of channels */
LPAT_BYTE lpBuffer;     /* Audio buffer */
AT_UINT bufSize;        /* Size of audio buffer */
nErrcount = IG_mult_audio_format_get(hMult, &nSampleRate, &nBitsPerSample, &nChannels);
/* Calculate # of bytes for one second of audio */
bufSize = nSamplesPerSec * (nBitsPerSample / 8) * nChannels;
lpBuffer = (LPAT_BYTE) malloc(bufSize);
nErrcount = IG_mult_audio_get(hMult, lpBuffer, &bufSize);

Remarks:

You must specify the number of bytes of audio data to retrieve in the value pointed to by lpBufferSize, and this number must be a multiple of the sample size ((nBitsPerSample / 8) * nChannels). Audio data is provided in uncompressed PCM format.

You can call this function repeatedly for buffered access to the audio data (for example, one second of audio at a time) or you can retrieve all of the audio at once.

Note that the number of bytes retrieved by this function is returned in the lpBufferSize parameter. If you requested more data than is available (for example, you are near the end of the file) this number will be less than what you requested.