MCI_SETAUDIO command

The MCI_SETAUDIO command sets values associated with audio playback and capture. Digital-video and VCR devices recognize this command.

To send this command, call the mciSendCommand function with the following parameters.

MCIERROR mciSendCommand(
  MCIDEVICEID wDeviceID, 
  MCI_SETAUDIO, 
  DWORD dwFlags, 
  (DWORD) (LPMCI_GENERIC_PARMS) lpSetAudio
);

Parameters

wDeviceID

Device identifier of the MCI device that is to receive the command message.

dwFlags

MCI_NOTIFY, MCI_WAIT, or MCI_TEST. For information about these flags, see The Wait, Notify, and Test Flags.

lpSetAudio

Pointer to an MCI_GENERIC_PARMS structure. (Devices with extended command sets might replace this structure with a device-specific structure.)

Return Value

Returns zero if successful or an error otherwise.

Remarks

The following flags apply to the digitalvideo device type:

MCI_DGV_SETAUDIO_ALG

The lpstrAlgorithm member of the structure identified by lpSetAudio contains an address of a buffer containing the name of an audio compression algorithm. The compression algorithm is used by subsequent MCI_RESERVE or MCI_RECORD commands. The available algorithms are device dependent. If the algorithm is incompatible with the current file format, the file format is changed to the default format for the algorithm.

MCI_DGV_SETAUDIO_CLOCKTIME

The time specified is in milliseconds and is absolute time when used with MCI_DGV_SETAUDIO_OVER. (This time is not in step with the playing of the workspace.)

MCI_DGV_SETAUDIO_INPUT

Modifies the bass, treble, or volume flag so that it affects the input signal and modifies what is recorded. If possible, this is the default when monitoring the input.

MCI_DGV_SETAUDIO_ITEM

An audio constant is specified in the dwItem member of the structure identified by lpSetAudio. The constant identifies the value that is being set. The following constants are defined:

MCI_DGV_SETAUDIO_AVGBYTESPERSEC

The average number of bytes is specified in the dwValue member of the structure identified by lpSetAudio. This value sets the average number of bytes per second for playing or recording in the PCM (Pulse Code Modulation) and ADPCM (Adaptive Differential Pulse Code Modulation) formats. The file is saved in this format.

MCI_DGV_SETAUDIO_BASS

The audio low frequency level is specified as a factor in the dwValue member of the structure identified by lpSetAudio.

MCI_DGV_SETAUDIO_BITSPERSAMPLE

The number of bits per sample is specified in the dwValue member of the structure identified by lpSetAudio. This value sets the number of bits per sample played or recorded in the PCM format. The file is saved in this format.

MCI_DGV_SETAUDIO_BLOCKALIGN

The data block alignment is specified in the dwValue member of the structure identified by lpSetAudio. This value sets the alignment of data blocks relative to the start of input waveform data.

MCI_DGV_SETAUDIO_SAMPLESPERSEC

The sample rate is specified in the dwValue member of the structure identified by lpSetAudio. This value sets the sample rate for playing and recording with the PCM and ADPCM algorithms. The file is saved in this format.

MCI_DGV_SETAUDIO_SOURCE

A constant specifying the source of audio input is included in the dwValue member of the structure identified by lpSetAudio. The following constants are defined for the audio input sources:

MCI_DGV_SETAUDIO_SOURCE_AVERAGE

The average of the left and right audio channels.

MCI_DGV_SETAUDIO_SOURCE_LEFT

Left audio channel.

MCI_DGV_SETAUDIO_SOURCE_RIGHT

Right audio channel.

MCI_DGV_SETAUDIO_SOURCE_STEREO

Stereo.

MCI_DGV_SETAUDIO_STREAM

An audio-stream is specified in the dwValue member of the structure identified by lpSetAudio. The integer value specifies the audio stream played back from the workspace. If the stream is not specified, the first physically interleaved audio stream is played.

MCI_DGV_SETAUDIO_TREBLE

The audio high-frequency level is specified as a factor in the dwValue member of the structure identified by lpSetAudio.

MCI_DGV_SETAUDIO_VOLUME

The audio level for one or both audio channels is specified as a factor in the dwValue member of the structure identified by lpSetAudio. If the left and right volumes have been set to different values, then the ratio of left to right volume is approximately unchanged.

MCI_DGV_SETAUDIO_LEFT

Enables the left audio channel when used with MCI_SET_ON. Disables the left audio channel when used with MCI_SET_OFF. When this flag is used with the combination of MCI_DGV_SETAUDIO_VALUE and MCI_DGV_SETAUDIO_VOLUME, it sets the volume of the left audio channel. When this flag is used with MCI_DGV_SETAUDIO_SOURCE, it specifies the left audio channel as the source for the audio input digitizer.

MCI_DGV_SETAUDIO_OVER

A transition length parameter is included in the dwOver member of the structure identified by lpSetAudio. The length value specifies how long (in units of the current time format) it should take to make a change that uses a factor. If this flag is not used, changes occur immediately.

MCI_DGV_SETAUDIO_QUALITY

The lpstrQuality member of the structure identified by lpSetAudio contains an address of a buffer defining the audio quality. A text-string within the buffer specifies the characteristics of the audio compression algorithm.

The MCI_DGV_SETAUDIO_ALG flag can be used to select a quality descriptor for the specified algorithm. If this flag is omitted, then the current algorithm is used.

The algorithms and descriptor names available depend on the device. Each device supplies documentation for the available algorithms and a description of the applicable descriptor names. The MCI_QUALITY command can define additional descriptor names.

MCI_DGV_SETAUDIO_RECORD

Specifies whether recording includes or excludes audio data. When combined with MCI_SET_ON, audio data is recorded. When combined with MCI_SET_OFF, audio data is excluded. The default includes audio data.

MCI_DGV_SETAUDIO_RIGHT

Enables the right audio channel when used with MCI_SET_ON. Disables the right audio channel when used with MCI_SET_OFF. When this flag is used with the combination of MCI_DGV_SETAUDIO_VALUE and MCI_DGV_SETAUDIO_VOLUME, it sets the volume of the right audio channel.

MCI_DGV_SETAUDIO_VALUE

A value is specified in the dwValue member of the structure identified by lpSetAudio. The meaning of the value is specified by the constant defined for the MCI_DGV_SETAUDIO_ITEM flag.

MCI_SET_OFF

Disables the specified audio channel.

MCI_SET_ON

Enables the specified audio channel.

MCI_SETAUDIO_OUTPUT

Modifies the bass, treble, or volume flag so that it modifies only the played signal and not what is recorded. If possible, this is the default when monitoring the input.

For digital-video devices, the lpSetAudio parameter points to an MCI_DGV_SETAUDIO_PARMS structure.

The following additional flags are used with the vcr device type:

MCI_VCR_SETAUDIO_RECORD

Sets the audio recording to on or off, which is used in conjunction with one of following flags:

MCI_SET_ON

Audio recording on.

MCI_SET_OFF

Audio recording off. It might be necessary to first turn off the assemble recording (using the MCI_SET command with the MCI_VCR_SET_ASSEMBLE_RECORD flag set to off) before the audio recording can be turned off.

MCI_TRACK

The dwTrack member of the structure identified by lpSetAudio specifies which track is affected by the command.

MCI_VCR_SETAUDIO_SOURCE

Sets the audio source. This flag must be used with the MCI_VCR_SETAUDIO_TO flag.

MCI_VCR_SETAUDIO_MONITOR

Sets the audio source monitor. This flag must be used with the MCI_VCR_SETAUDIO_TO flag.

MCI_VCR_SETAUDIO_TO

The dwTo member of the structure identified by lpSetAudio contains a constant describing the type of input or monitored input. It must be one of the following:

MCI_VCR_SRC_TYPE_TUNER

Type is tuner.

MCI_VCR_SRC_TYPE_LINE

Type is line.

MCI_VCR_SRC_TYPE_AUX

Type is auxiliary.

MCI_VCR_SRC_TYPE_GENERIC

Type is generic.

MCI_VCR_SRC_TYPE_MUTE

Type is mute. This can be used only with the MCI_VCR_SETAUDIO_SOURCE flag.

MCI_VCR_SRC_TYPE_OUTPUT

Type is output.

MCI_VCR_SETAUDIO_NUMBER

The dwNumber member of the structure identified by lpSetAudio contains the audio input (of the type specified in the dwTo member) to use.

For VCR devices, the lpSetAudio parameter points to an MCI_VCR_SETAUDIO_PARMS structure.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Mmsystem.h (include Windows.h)

See also

MCI

MCI Commands