setaudio command

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

To send this command, call the mciSendString function with the lpszCommand parameter set as follows.

_stprintf_s(
  lpszCommand, 
  TEXT("setaudio %s %s %s"), 
  lpszDeviceID, 
  lpszAudio, 
  lpszFlags
); 

Parameters

lpszDeviceID

Identifier of an MCI device. This identifier or alias is assigned when the device is opened.

lpszAudio

Flag for audio playback and capture. The following table lists device types that recognize the setaudio command and the flags used by each type.

Value Meaning Meaning
digitalvideo algorithm algorithmalignment to integerbass to factorbitspersample to bit_count bytespersec to integerclocktime input left off left on left volume to factoroff on output over durationquality descriptorrecord off record on right off right on right volume to factorsamplespersec to integersource to sourcenamestream to numbertreble to factorvolume to factor
vcr off on monitor to type number numberrecord off record track track_number off record on record track track_number on source to type number numbertrack track_number off track track_number on

The following table lists the flags that can be specified in the lpszAudio parameter and their meanings.

Value Meaning
algorithm algorithm Selects a specific audio compression algorithm for use by a subsequent reserve or record command. The algorithms supported are device specific. MCI defines the values "g711", "g721", "g722", "g728", "pcm", "cdxa", "adpcm", and "adpcm4e" for algorithm. If a device supports the algorithm names "pcm", "cdxa", and "adpcm4e", they adhere to standard definitions. The "cdxa" algorithm has been defined by Sony Corporation. The "adpcm4e" algorithm has been defined by Intel Corporation. The "g711", "g721", "g722", and "g728" values represent audio algorithms recommended by the International Telegraph and Telephone Consultative Committee (CCITT).
If the specified algorithm conflicts with the current file format, the file format is changed to the default format for the algorithm.
alignment to integer Sets the alignment of data blocks relative to the start of input waveform-audio data.
bass to factor Sets the audio low frequency level.
bitspersample to bit_count Sets the number of bits per sample recorded. The file is saved in this format. This flag applies only to devices supporting the "pcm" algorithm.
bytespersec to integer Sets the average number of bytes per second for recording in the "pcm" and "adpcm" algorithms. The file is saved in this format.
clocktime Indicates the time specified in the "over" flag is in milliseconds. This time is absolute and not in step with the playing of the workspace.
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.
left off left on Enables or disables audio output on the left channel. The audio presentation source can be the external input or the workspace. The default is "left on". If there is only one channel, that channel is set on or off.
left volume to factor Sets the audio volume of the left audio channel. If there is only one channel it sets its volume.
monitor to type number number Controls which source input will be passed to the VCR output without changing the recording source input selection. Type can be "output," or one of the valid input sources. If number is not specified, then the first input of that type will be chosen.
off on Enables or disables audio. The audio presentation source can either be the external input or the workspace. This command affects the left and right audio channels simultaneously. The default is setaudio "on".
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 a file.
over duration Specifies how long it should take to make a change that uses a factor variable. The units for duration are in the current time format. Changes occur in step with the playing of the workspace. When playing is suspended, the change is also suspended until the play continues. If "over" is not specified or not supported, the change occurs immediately.
quality descriptor Specifies the characteristics of the audio compression performed when audio is recorded to a file. All devices support the three descriptors "low", "medium", and "high". The default is device specific.If the "algorithm" flag is not specified, the "quality" adjustment applies to the current algorithm.
The quality command can be used to define additional descriptor names.
record off Clears the audio-source selection so that no audio will be recorded with the next record command.
record on Enables recording of audio data. The default is to record audio data.
record track track_number off Clears the audio-source selection so that no audio will be recorded with the next record command. "Track" allows independent track selection. Track 2 corresponds to the PCM track in Hi8. If "track" is not specified, a default value of 1 is assumed.
record track track_number on Selects the audio source to be recorded with the next record command. "Track" allows independent track selection. Track 2 corresponds to the PCM track in Hi8. If "track" is not specified, a default value of 1 is assumed.
right off right on Enables or disables audio output on the right channel. The audio presentation source can be the external input or the workspace. The default is "right on". If there is only one channel, this flag has no effect.
right volume to factor Sets the audio volume to the right audio channel. If there is only one channel, it has no effect.
samplespersec to integer Sets the sample rate for recording with the "pcm" and "adpcm" algorithms. The file is saved in this format.
source to sourcename Specifies the source for the audio input digitizer. The constants defined for sourcename include: "left", "right", "average", and "stereo". The first three specify monophonic recording using the left input only, the right input only, and the average of the two inputs.
source to type number number Selects the audio source to be recorded on the tape. Type must be "tuner", "line", "svideo", "aux", "generic", or "mute".
stream to number Specifies the audio stream played back from the workspace. If the stream is not specified and the file format does not define a default, then the interleaved audio stream that is physically first will be played.
track track_number off Disables an individual track.
track track_number on Enables an individual track.
treble to factor Sets the audio high-frequency level.
volume to factor Sets the average audio volume for both audio channels. If the left and right volumes have been set to different values, then the ratio of left-to-right volume is approximately unchanged.

lpszFlags

Can be "wait", "notify", "test", or a combination of these. For more information about these flags, see The Wait, Notify, and Test Flags.

Return Value

Returns zero if successful or an error otherwise.

Remarks

For VCR devices, using setaudio with a flag that turns off an individual track ("track track_number off") might cause your application to receive a status message indicating that the command could not be carried out. Some VCRs can turn off only combinations of tracks, not individual tracks; for example, the first audio track and a video track of a video cassette. In this case, simply use setaudio and setvideo to continue to turn off the other tracks that make up the combination. The driver will turn off the tracks when it receives the command to turn off the last track in the combination.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]

See also

MCI

MCI Command Strings

record

reserve

setvideo