set

The set command establishes control settings for the device. CD audio, digital-video, MIDI sequencer, VCR, videodisc, video-overlay, and waveform-audio devices recognize this command.

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

_stprintf_s(
  lpszCommand, 
  TEXT("set %s %s %s"), 
  lpszDeviceID, 
  lpszSetting, 
  lpszFlags
); 

Parameters

lpszDeviceID

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

lpszSetting

Flag for establishing control settings. The following table lists device types that recognize the set command and the flags used by each type.

Value Meaning Meaning
cdaudio audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
door closed
door open
time format milliseconds
time format msf
time format tmsf
digitalvideo audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
door closed
door open
file format format
seek exactly on
seek exactly off
speed factor
still file format format
time format frames
time format milliseconds
video off
video on
overlay audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
door closed
door open
video off
video on
sequencer audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
door closed
door open
master MIDI
master none
master SMPTE
offset time
port mapper
port none
port port_number
slave file
slave MIDI
slave none
slave SMPTE
tempo tempo_value
time format milliseconds
time format SMPTE fps
time format SMPTE 30 drop
time format song pointer
vcr assemble record on
assemble record off
audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
clock time
counter format
counter value
door closed
door open
index counter
index date
index time
index timecode
length duration
pause timeout
postroll duration -
   duration
power on
power off
preroll duration duration
record format SP
record format LP
record format EP
speed factor
time format frames
time format hms
time format milliseconds
time format msf
time format SMPTE fps
time format SMPTE 30 drop
time format tmsf
time mode counter
time mode detect
time mode timecode
tracking plus
tracking minus
tracking reset
videodisc audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
door closed
door open
time format frames
time format hms
time format milliseconds
time format track
video off
video on
waveaudio alignment integer
any input
any output
audio all off
audio all on
audio left off
audio left on
audio right off
audio right on
bitspersample bit_count
bytespersec byte_rate
channels channel_count
door closed
door open
format tag pcm
format tag tag
input integer
output integer
samplespersec integer
time format bytes
time format milliseconds
time format samples

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

Value Meaning
alignment integer Sets the alignment of data blocks relative to the start of data passed to the waveform-audio device. The file is saved in this format.
any input Use any input that supports the current format when recording. This is the default setting.
any output Use any output that supports the current format when playing. This is the default.
assemble record on
assemble record off
In assemble mode, all tracks are recorded as defined by the device. Most VCRs are in assemble mode by default.
audio all off
audio all on
Disables or enables audio output. Video-overlay devices, the MCISEQ sequencer, and the MCIWAVE waveform-audio device do not support this flag.
audio left off
audio left on
audio right off
audio right on
Disables or enables output to either the left or the right audio channel. Video-overlay devices, the MCISEQ sequencer, and the MCIWAVE waveform-audio device do not support this flag.
bitspersample bit_count Sets the number of bits per PCM (Pulse Code Modulation) sample played or recorded. The file is saved in this format.
bytespersec byte_rate Sets the average number of bytes per second played or recorded. The file is saved in this format.
channels channel_count Sets the channels for playing and recording. The file is saved in this format.
clock time Sets time on the external clock to time. The format is specified as a long unsigned integer.
counter format Set the time format for the counter, as returned by status "counter". For information about applicable types, see the set "time format" command.
counter value Sets the VCR counter to the specified value. The value must be specified in the current counter format. For more information, see the set "counter format" command.
door closed Retracts the tray and closes the door, if possible. For VCRs, loads the tape automatically.
door open Opens the door and ejects the tray or tape, if possible.
file format format Specifies a file format that is used for save or capture commands. If omitted, this might default to a device driver defined format. If the specified file format conflicts with the currently selected algorithm and quality, then they are changed to the defaults for the file format. The following file formats are defined:

avi
Specifies AVI format.

avss
Specifies AVSS format.

dib
Specifies DIB format.

jfif
Specifies JFIF format.

jpeg
Specifies JPEG format.

mpeg
Specifies MPEG format.

rdib
Specifies RLE DIB format.

rjpeg
Specifies RJPEG format.

format tag pcm Sets the format type to PCM for playing and recording. The file is saved in this format.
format tag tag Sets the format type for playing and recording. The file is saved in this format.
index timecode
index counter
index date
index time
Sets the current display screen on the VCR.
input integer Sets the audio channel used as the input.
length duration Sets the user-specified length of the tape in the VCR. This length is returned by the status "length" command and is provided for compatibility with applications that require this command to return a valid length.
master midi Sets the MIDI sequencer as the synchronization source. Synchronization data is sent in MIDI format. The MCISEQ sequencer does not support this flag.
master none Inhibits the MIDI sequencer from sending synchronization data. The MCISEQ sequencer does not support this flag.
master smpte Sets the MIDI sequencer as the synchronization source. Synchronization data is sent in SMPTE (Society of Motion Picture and Television Engineers) format. The MCISEQ sequencer does not support this flag.
offset time Sets the SMPTE offset time. The offset is the beginning time of a SMPTE based sequence. The time is expressed as hh:mm:ss:ff, where hh is hours, mm is minutes, ss is seconds, and ff is frames.
output integer Sets the audio channel used as the output.
pause timeout Sets the maximum duration, in milliseconds, of a pause command. A timeout value of zero indicates that no time-out will occur.
postroll duration duration Sets the length, in the current time format, needed to brake the VCR transport when a stop or pause command is issued.
port mapper Sets the MIDI mapper as the port receiving the MIDI messages. This command fails if the MIDI mapper or a port it needs is being used by another application.
port none Disables the sending of MIDI messages. This command also closes a MIDI port.
port port_number Sets the MIDI port receiving the MIDI messages. This command fails if the port you are trying to open is being used by another application.
power on
power off
Sets the device power to on or off.
preroll duration duration Sets the length, in the current time format, needed to stabilize the VCR output.
record format SP
record format LP
record format EP
Sets the recording mode for the VCR to SP for standard play, EP for extended play, or LP for long play. These values are not intended to be VHS specific. They map to any three appropriate modes with other tape formats. For example, SP maps to the fastest, highest quality recording.
samplespersec integer Sets the sample rate for playing and recording. The file is saved in this format.
seek exactly on
seek exactly off
Selects one of two seek modes. With "seek exactly on", seek will always move to the frame specified. With "seek exactly off", seek will move to the closest key frame prior to the frame specified.
slave file Sets the MIDI sequencer to use file data as the synchronization source. This is the default setting.
slave midi Sets the MIDI sequencer to use incoming MIDI data for the synchronization source. The sequencer recognizes synchronization data with the MIDI format. The MCISEQ sequencer does not support this flag.
slave none Sets the MIDI sequencer to ignore synchronization data.
slave smpte Sets the MIDI sequencer to use incoming MIDI data for the synchronization source. The sequencer recognizes synchronization data with the SMPTE format. The MCISEQ sequencer does not support this flag.
speed factor Sets the relative speed of video and audio playback from the workspace. Factor is the ratio between the nominal frame rate and the desired frame rate, where the nominal frame rate is designated as 1000. (A rate of 500 is half normal speed, 2000 is twice normal speed, and so on.) Setting the speed to zero plays the video as fast as possible without dropping frames and without audio.
still file format format Specifies the file format used for capture commands.
tempo tempo_value Sets the tempo of the sequence according to the current time format. For a PPQN-based file, the tempo_value is interpreted as beats per minute. For a SMPTE-based file, the tempo_value is interpreted as frames per second.
time format bytes In a PCM file format, sets the time format to bytes. All position information is specified as bytes following this command.
time format frames Sets the time format to frames. All commands that use position values will assume frames. When the device is opened, frames is the default mode. Supported by videodiscs using CAV format.
time format hms Sets the time format to hours, minutes, and seconds. All commands that use position values will assume HMS. HMS is the default format for CLV videodiscs.

Specify an HMS value as hh:mm:ss, where hh is hours, mm is minutes, and ss is seconds. You can omit a field if it and all following fields are zero. For example,
3, 3:0, and 3:0:0 are all valid ways to express 3 hours.

time format milliseconds Sets the time format to milliseconds. All commands that use position values will assume milliseconds. You can abbreviate milliseconds as "ms".

For sequencer devices, the sequence file sets the default format to PPQN or SMPTE. Video-overlay devices do not support this flag.

time format msf Sets the time format to minutes, seconds, and frames. All commands that use position values will assume MSF (the default format for CD audio).

Specify an MSF value as mm:ss:ff, where mm is minutes, ss is seconds, and ff is frames. You can omit a field if it and all following fields are zero. For example, 3, 3:0, and 3:0:0 are valid ways to express 3 minutes.

The MSF fields have the following maximum values:

Minutes 99
Seconds 59
Frames  74

time format samples Sets the time format to samples. All position information is specified as samples following this command.
time format smpte 24
time format smpte 25
time format smpte 30
Sets the time format to an SMPTE frame rate.

For VCRs, sets the time format to hh:mm:ss:ff, where the legal values are 00:00:00:00 through 23:59:59:xx, and xx is one less than the frames per second as specified by the number 24, 25, or 30 as specified in the flag. On input, colons (:) are required to separate the components. The least significant units can be
omitted if they are 00; for example, 02:00 is the same
as 02:00:00:00.

All commands that use position values will assume SMPTE format.

The sequence file sets the default format to PPQN or SMPTE.

time format smpte 30 drop Sets the time format to SMPTE 30 drop frame rate.

For VCRs, same as SMPTE 30, except that certain timecode positions are dropped from the format to have the recorded timecode positions for each frame (at the NTSC frame rate of 29.97 fps) correspond to real time (at 30 fps). Timecode positions that are dropped are as follows: two every minute, on the minute, for the first nine of every ten minutes of recorded content. For example, at 01:04:59:29, the next timecode position would be 01:05:00:02, not 01:05:00:00.

All commands that use position values will assume SMPTE format.

The sequence file sets the default format to PPQN or SMPTE.

time format song pointer Sets the time format to song pointer (sixteenth notes). All commands that use position values will assume song pointer units. This flag is valid only for a sequence of division type PPQN.
time format tmsf Sets the time format to tracks, minutes, seconds, and frames. All commands that use position values will assume TMSF.

Specify a TMSF value as tt:mm:ss:ff, where tt is tracks, mm is minutes, ss is seconds, and ff is frames. You can omit a field if it and all following fields are zero. For example, 3, 3:0, 3:0:0, and 3:0:0:0 are all valid ways to express track 3.

The TMSF fields have the following maximum values:

Tracks 99
Minutes 99
Seconds 59
Frames  74

time format track Sets the position format to tracks. All commands that use position values will assume tracks.
time mode counter Sets the position-information mode to use the VCR counters.
time mode detect Sets the position information mode based on detection of timecode information on the tape. If timecode information is detected, the time type is set to "timecode"; otherwise, the time type is set to "counter".

"Detect" is a special mode. Whenever the driver is opened, a new tape is inserted, or the "time mode" command is issued, the driver checks the current time mode available on the tape and sets "time type" to either "timecode" or "counter". Once "time type" is set, the driver doesn't change it until one of the above conditions occurs again.

time mode timecode Sets the position information mode to use "timecode" information on the tape.
tracking plus
tracking minus
tracking reset
Adjusts the speed of the videotape transport in fine increments. Use the "tracking" flags when a noisy picture is obtained from a VCR. "Tracking plus" increases the transport speed. "Tracking minus" decreases the transport speed. "Tracking reset" returns the tracking adjustment to zero.
video off Disables video output.
video on Enables video output.

lpszFlags

Can be "wait", "notify", or both. For digital-video and VCR devices, "test" can also be specified. For more information about these flags, see The Wait, Notify, and Test Flags.

Return Values

Returns zero if successful or an error otherwise.

Remarks

Several properties of waveform-audio data are defined when the file to store the data is created. These properties describe how the data is structured within the file and cannot be changed once recording begins. The following list identifies these properties:

  • alignment
  • bitspersample
  • bytespersec
  • channels
  • format tag
  • samplespersec

The following command sets the time format to milliseconds and sets the waveform-audio format to 8 bit, mono, 11 kHz:

set mysound time format ms bitspersample 8 channels 1 samplespersec 11025

Requirements

**  Windows NT/2000/XP:** Included in Windows NT 3.1 and later.
**  Windows 95/98/Me:** Included in Windows 95 and later.

See Also

MCI, MCI Command Strings, capture, pause, save, status, stop