Previous | Contents | Index |
This section contains an alphabetical listing of the functions an application uses to manage audio recording and playback. These functions are prefixed with wave.
#include <mme/mme_api.h> MMRESULT waveInAddBuffer (HWAVEIN hWaveIn, LPWAVEHDR lpWaveInHdr, UINT wSize); |
LPWAVEHDR lpWaveInHdr
Specifies a pointer to a WAVEHDR data structure that
identifies the input buffer (
lpWaveInHdr->lpData
).
The WAVEHDR data structure must be allocated with the mmeAllocMem function and the input buffer must be allocated with the mmeAllocBuffer function before being passed to the waveInAddBuffer function. See Chapter 2 for more information about the memory allocation functions.
UINT wSize
Specifies the size, in bytes, of the WAVEHDR data
structure.
The waveInAddBuffer function sends an input buffer to the specified waveform audio input device. When the buffer is filled, the function returns it to the calling program. This buffer is returned to the application via the callback defined in the waveInOpen function.Extensions None.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_HANDLEBUSY | The handle hWaveIn is in use on another thread. |
MMSYSERR_INVALHANDLE | The specified device handle is invalid. |
WAVERR_UNPREPARED | The lpWaveInHdr argument is not prepared. |
#include <mme/mme_api.h> MMRESULT waveInClose (HWAVEIN hWaveIn) |
The waveInClose function closes the specified waveform audio input device. If input buffers sent to the device with the waveInAddBuffer function have not been returned to the application, the close operation fails.Extensions None.To ensure a successful close operation, call the waveInReset function to mark all pending buffers as done. Then, call the waveInClose function to close the device.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_INVALHANDLE | The specified device handle is invalid. |
WAVERR_STILLPLAYING | There are buffers still in the queue. |
#include <mme/mme_api.h> MMRESULT waveInFormatDetails (UINT uClassDeviceID, LPACMFORMATDETAILS pafd, DWORD fdwDetails); |
LPACMFORMATDETAILS pafd
Specifies a pointer to a ACMFORMATDETAILS data
structure. Certain fields in the data structure may be used to pass
selection information to the function; most fields are then entered by
the function and returned to the caller. See Section 3.6.7 for more
information about the ACMFORMATDETAILS data structure.
The ACMFORMATDETAILS and WAVEFORMATEX data structures must be allocated with the mmeAllocMem function before being passed to the waveInFormatDetails function. See Chapter 2 for more information about the memory allocation functions.
DWORD fdwDetails
Flags for querying the audio input device for detailed format
information. The following flags are defined:
ACM_FORMATDETAILSF_FORMAT
Specifies that a format is selected by index.
ACM_FORMATDETAILSF_WAVEINDEX
Specifies that a format is selected by the information in the WAVEFORMATEX data structure.
The waveInFormatDetails function queries the specified waveform audio input device to determine specific information relating to a format specified by the caller.Extensions The waveInFormatDetails function is a Compaq extension to the Microsoft multimedia API specification.The application must set the cbStruct, pwfx, and cbwfx fields in the ACMFORMATDETAILS structure before calling this function. The fdwDetails argument is used to specify how the format is specified. If querying by index, the dwFormatIndex field must be set to the desired format, and the dwFormatTag field must be set to zero. If querying by wave format, the WAVEFORMATEX data structure pointed to by the pwfx field must be initialized with information about the desired format.
On successful return from the function, pafd is returned as follows:
Flag Description dwFormatIndex Index from 0 to one less than the number of formats supported by this device. dwFormatTag Format tag value for the format as defined in the mmsystem.h file. *pwfx A WAVEFORMATEX data structure containing the format. szFormat An ASCII null-terminated description of the format. fdwSupport See Section 3.6.7 for supported flags.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_BADDEVICEID | The specified device is invalid. |
MMSYSERR_INVALPARAM |
The parameter
pafd is NULL.
The value of the pafd-> cbStruct, pafd-> pwfx-> cbSize, or pafd-> cbwfx field is invalid. The value of fdwDetails is invalid. The parameter pafd or pafd-> pwfx is not allocated from shared memory. |
MMSYSERR_NODRIVER | A waveIn driver is not installed. |
#include <mme/mme_api.h> MMRESULT waveInGetDevCaps (UINT uClassDeviceID, LPWAVEINCAPS lpCaps, UINT wSize); |
LPWAVEINCAPS lpCaps
Specifies a pointer to a WAVEINCAPS data structure.
This data structure is filled with information about the capabilities
of the device.
The WAVEINCAPS data structure must be allocated with the mmeAllocMem function before being passed to the waveInGetDevCaps function. See Chapter 2 for more information about the memory allocation functions.
UINT wSize
Specifies the size, in bytes, of the WAVEINCAPS data
structure.
The waveInGetDevCaps function queries the specified waveform audio input device to determine its capabilities. The device ID specified by the uClassDeviceID argument varies from zero to one less than the number of devices present. The WAVE_MAPPER constant can also be used as a device ID. (Use the waveInGetNumDevs function to determine the number of waveform audio input devices present in the system.)Extensions The WAVEINCAPS data structure has been extended to support 8-bit mono MULAW at 8 kHz waveform audio format. TheOnly wSize bytes (or less) of information are copied to the location pointed to by the lpCaps argument. If the value of the wSize argument is zero, nothing is copied and the function returns MMSYSERR_NOERROR.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_BADDEVICEID | The specified device ID is out of range. |
MMSYSERR_NODRIVER | No waveIn driver is installed. |
MMSYSERR_INVALPARAM | The size of the WAVEINCAPS data structure is invalid. |
#include <mme/mme_api.h> MMRESULT waveInGetDevCapsEx (UINT uClassDeviceID, LPWAVEINCAPS lpCaps, UINT wSize); |
LPWAVEINCAPS lpCaps
Specifies a pointer to a WAVEINCAPS data structure.
This data structure is filled with information about the capabilities
of the device.
The WAVEINCAPS data structure must be allocated with the mmeAllocMem function before being passed to the waveInGetDevCapsEx function. See Chapter 2 for more information about the memory allocation functions.
UINT wSize
Specifies the size, in bytes, of the WAVEINCAPS data
structure.
The waveInGetDevCapsEx function queries the specified waveform audio input device to determine its capabilities. The device ID specified by the uClassDeviceID argument varies from zero to one less than the number of devices present. The WAVE_MAPPER constant can also be used as a device ID. (Use the waveInGetNumDevs function to determine the number of waveform audio input devices present in the system.)Extensions The waveInGetDevCapsEx function is a Compaq extension to the Microsoft multimedia API specification.Only wSize bytes (or less) of information are copied to the location pointed to by the lpCaps argument. If the value of the wSize argument is zero, nothing is copied and the function returns MMSYSERR_NOERROR.
The dwFormat field of the WAVEINCAPS data structure will return all the standard formats supported by the device. See Section 3.6.5 for more information about specifying this waveform audio format.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_BADDEVICEID | The specified device ID is out of range. |
MMSYSERR_NODRIVER | No waveIn driver is installed. |
MMSYSERR_INVALPARAM | The size of the WAVEINCAPS data structure is invalid. |
#include <mme/mme_api.h> MMRESULT waveInGetErrorText (UINT uError, LPSTR lpText, UINT uSize); |
LPSTR lpText
Specifies a pointer to a buffer to be filled with the text error
description.
The buffer must be allocated with the mmeAllocMem function before being passed to the waveInGetErrorText function. See Chapter 2 for more information about the memory allocation functions.
UINT uSize
Specifies the size, in bytes, of the buffer pointed to by the
lpText argument.
The waveInGetErrorText function retrieves a text description of the error identified by the specified error number. If the text error description is longer than the buffer, the description is truncated. The returned string is always null terminated. If the value of the uSize argument is zero, nothing is copied and the function returns MMSYSERR_NOERROR. All error descriptions are less than MAXERRORLENGTH characters long.Extensions None.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns the following error code:
Error Code | Description |
---|---|
MMSYSERR_BADERRNUM | The specified error number is out of range. |
#include <mme/mme_api.h> MMRESULT waveInGetID (HWAVEIN hWaveIn, PUINT lpuDeviceID); |
PUINT lpuDeviceID
Specifies a pointer to the UINT-sized memory location to be filled with
the device ID.
The waveInGetID function gets the device ID for the specified waveform audio input device.Extensions None.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_HANDLEBUSY | The handle hWaveIn is in use on another thread. |
MMSYSERR_INVALHANDLE | The specified device handle is invalid. |
#include <mme/mme_api.h> MMRESULT waveInGetFormatInfo (UINT uClassDeviceID, LPWAVEFORMATINFO lpWaveformatInfo); |
LPWAVEFORMATINFO lpWaveformatInfo
Specifies a pointer to a WAVEFORMATINFO data
structure. The
waveInGetFormatInfo
function returns high-level information common to all formats supported
by the device in this data structure.
The WAVEFORMATINFO data structure must be allocated with the mmeAllocMem function before being passed to the waveInGetFormatInfo function. See Chapter 2 for more information about the memory allocation functions.
The waveInGetFormatInfo function queries the specified waveform audio input device to determine its capabilities. Information is returned relating to all formats supported by the device, not just standard formats. (See the dwFormats description in Section 3.6.5 for a list of standard formats.) The information returned includes the number of formats supported, the maximum size of a WAVEFORMATEX data structure needed to describe any supported format, and the maximum size of an ASCII string needed to provide a text description of any supported format.Extensions The waveInGetFormatInfo function is a Compaq extension to the Microsoft multimedia API specification.The device ID specified by the uClassDeviceID argument varies from zero to one less than the number of audio devices present.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_BADDEVICEID | The specified device is invalid. |
MMSYSERR_INVALPARAM |
The parameter
lpWaveformatInfo is NULL.
The value of the cbStruct field within the parameter lpWaveformatInfo is invalid. The parameter lpWaveformatInfo is not allocated from shared memory. |
MMSYSERR_NODRIVER | A waveIn driver is not installed. |
#include <mme/mme_api.h> UINT waveInGetNumDevs() |
The waveInGetNumDevs function returns the number of waveform audio input devices present in the system.Extensions None.
Returns the number of waveform input devices present in the system.
#include <mme/mme_api.h> MMRESULT waveInGetPorts(UINT uClassDeviceID, LPDWORD lpdwPortMask, PUINT lpuNumPorts, LPSTR lpText, UINT uSize); |
LPDWORD lpdwPortMask
Specifies a memory location in which the current port selection mask is
returned. If this parameter is non-NULL, the memory location must be
allocated by the
mmeAllocMem
function. If this parameter is NULL, this value is not returned.
PUINT lpuNumPorts
Specifies a memory location in which the number of ports for this
device are returned. If this parameter is non-NULL, the memory location
must be allocated by the
mmeAllocMem
function. If this parameter is NULL, this value is not returned.
LPSTR lpText
Specifies a memory location in which the text descriptions of the ports
for this device are returned. If this parameter is non-NULL, the memory
location must be allocated by the
mmeAllocMem
function.
UINT uSize
Specifies the size of the memory area pointed to by the lpText
parameter. If lpText is non-NULL, to prevent possible
truncation, the uSize parameter must be large enough to
accommodate up to MME_MAXWAVEPORTS*MME_MAXWAVEPORTDESCLEN characters.
The waveInGetPorts function queries the current port selection mask and maximum number of ports supported for the specified waveform audio input device. Not all audio devices support a port selection capability. The port selection capability provides the ability to select one or more or the available ports (connections) for a device.Extensions The waveInGetPorts function is a Compaq extension to the Microsoft multimedia API specification.The waveInGetPorts function also returns text descriptions of all ports supported for the specified waveform audio input device. Each description is a null-terminated text string that describes the port.
The *lpdwPortMask value is a bit mask; each bit set defines whether the corresponding port is currently selected. Mask values MME_PORTMASK_01 through MME_PORTMASK_32 are defined for use in analyzing the port mask value.
The *lpuNumPorts value identifies the maximum number of ports supported on the specified device.
The lpText value contains up to MME_MAXWAVEPORTS null-terminated strings, each of maximum length MME_MAXWAVEPORTDESCLEN. These strings are stored in double subscripted array format: CHAR lpText[MME_MAXWAVEPORTS][MME_MAXWAVEPORTDESCLEN]. If the uSize value is not large enough to store all strings, then the last string stored is truncated (and null-terminated) but the function still returns MMSYSERR_NOERROR. If the value of uSize is positive but the value of lpText is NULL, then the function returns MMSYSERR_INVALPARAM.
Note that if the device provides only one input port, or if it provides no selection capability among ports, then it may return MMSYSERR_UNSUPPORTED for this function.
Returns MMSYSERR_NOERROR if the function is successful; otherwise, it returns one of the following error codes:
Error Code | Description |
---|---|
MMSYSERR_BADDEVICEID | The specified device ID is out of range. |
MMSYSERR_NOTSUPPORTED | This function is not supported for this device. |
MMSYSERR_INVALPARAM | The value of uSize is positive, but the value of lpText is NULL. |
The MSB (Microsoft Sound Board) or equivalent input device supports multiple ports. For the MSB:
Previous | Next | Contents | Index |