MCI MIXSETUP: Difference between revisions
Created page with "{{DISPLAYTITLE:MCI_MIXSETUP}} This message informs the mixer device that the application wishes to read or write buffers directly and sets up the device in the correct mode (for example, PCM, MPEG audio or MIDI). ==Syntax== <PRE> param1 ULONG ulParam1; →Flags for mixer setup operation.: param2 PMCI_MIXSETUP_PARMS pParam2; →Pointer to the MCI_MIXSETUP_PARMS data structure.: </PRE> ==Parameters== ;''ulParam1'' (ULONG) - input :This parameter can contain any..." |
(No difference)
|
Latest revision as of 02:54, 26 November 2025
This message informs the mixer device that the application wishes to read or write buffers directly and sets up the device in the correct mode (for example, PCM, MPEG audio or MIDI).
Syntax
param1 ULONG ulParam1; /* Flags for mixer setup operation. */ param2 PMCI_MIXSETUP_PARMS pParam2; /* Pointer to the MCI_MIXSETUP_PARMS data structure. */
Parameters
- ulParam1 (ULONG) - input
- This parameter can contain any of the following flags:
- MCI_NOTIFY A notification message is posted to the window specified in the hwndCallback field of the data structure identified by pParam2 when the action indicated by this message is completed.
- MCI_WAIT Control is not returned until the action indicated by this message is completed.
- MCI_MIXSETUP_INIT Initializes the mixer for the correct mode according to the value specified in the ulFormatMode field of MCI_MIXSETUP_PARMS.
- MCI_MIXSETUP_DEINIT Deinitializes the mixer.
- MCI_MIXSETUP_QUERYMODE Queries a device to see if a specific mode is supported.
- pParam2 (PMCI_MIXSETUP_PARMS) - input
- A pointer to the MCI_MIXSETUP_PARMS data structure.
Returns
- rc (ULONG) - returns
- Return codes indicating success or type of failure:
- MCIERR_SUCCESS Command completed successfully.
- MCIERR_INVALID_DEVICE_ID Invalid device ID given.
- MCIERR_MISSING_PARAMETER Required parameter is missing.
- MCIERR_INVALID_MODE Device mode invalid for this command.
- MCIERR_INVALID_DEVICE_TYPE Mixer does not support the requested device type.
- MCIERR_INVALID_FLAG Invalid flag specified for this command.
Remarks
On input, the application must fill in the ulDeviceType field of the MCI_MIXSETUP_PARMS structure to inform the mixer of the media type it will be sending. The application must also fill in the pmixEvent field of the MCI_MIXSETUP_PARMS structure with a callback function for the mixer to call when it is finished writing or reading a buffer.
If the call is successful, the mixer will update the pmixWrite and pmixRead fields so that the application can write or read buffers to or from the mixer. In addition, the mixer will update the ulBufferSize and ulNumBuffers fields with the **suggested** buffer size and number of buffers to use with the requested setup. The application does not have to use these suggested values as they are simply recommendations.
If the mixer has already been initialized with **MCI_MIXSETUP** and **MCI_MIXSETUP** is called again, **MCIERR_INVALID_MODE** will be returned.
After **MCI_MIXSETUP** has been successfully called, you can use MCI_BUFFER to allocate or deallocate memory for communcation with the audio device.
Example Code
memset( &MixSetupParms, '\0', sizeof( MCI_MIXSETUP_PARMS ) );
MixSetupParms.ulBitsPerSample = 16;
MixSetupParms.ulFormatTag = MCI_WAVE_FORMAT_PCM;
MixSetupParms.ulSamplesPerSec = 22050;
MixSetupParms.ulChannels = 2; /* Stereo */
MixSetupParms.ulBitsPerSample = 16;
MixSetupParms.ulFormatMode = MCI_PLAY;
MixSetupParms.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO;
/* The mixer will inform us of entry points to */
/* read/write buffers to and also give us a */
/* handle to use with these entry points. */
MixSetupParms.pmixEvent = MyEvent;
rc = mciSendCommand( usDeviceID,
MCI_MIXSETUP,
MCI_WAIT | MCI_MIXSETUP_INIT,
( PVOID ) &MixSetupParms,
0 );