Recording

The general MCI specification supports recording with digital-video, MIDI sequencer, video-cassette recorder (VCR), and waveform-audio devices; however, only waveform-audio and VCR devices currently implement recording capabilities. You can insert or overwrite recorded information into an existing file or record into a new file. To record to an existing file, open a waveform-audio device and file as you would normally. To record into a new file, when you open the device specify  new  as the device name if you are using the command-string interface. If you are using the command-message interface, specify a zero-length filename.

When MCI creates a new file for recording, the data format is set to a default format specified by the device driver. To use a format other than the default format, you can use the set.B6AA3 (MCI_SETBO5DNC) command.

To begin recording, use the recordO3IFU command (or MCI_RECORDBEWKAT and the MCI_RECORD_PARMS63O0LH structure).

If you record in insert mode to an existing file, you can use the  from  (MCI_FROM) and  to  (MCI_TO) flags of the record command to specify starting and ending positions for recording. For example, if you record to a file that is 20 seconds long, and you begin recording at 5 seconds and end recording at 10 seconds, the resulting file will be 25 seconds long. The file will have a 5-second segment inserted 5 seconds into the original recording.

If you record with overwrite mode to an existing file, you can use the  from  and  to  flags to specify starting and ending locations of the section that is overwritten. For example, if you record to a file that is 20 seconds long, and you begin recording at 5 seconds and end recording at 10 seconds, you still have a recording 20 seconds long, but the section beginning at 5 seconds and ending at 10 seconds will have been replaced.

If you do not specify an ending location, recording continues until you send a stopUDLWOB (MCI_STOP1OOF_PC) command, or until the driver runs out of free disk space. If you record to a new file, you can omit the  from  flag or set it to zero to start recording at the beginning of a new file. You can specify an ending location to terminate recording when recording to a new file.

The recordO3IFU command is sometimes accurate to within only 1 second of the starting location, such as with VCR devices. To record more accurately, you should use the cue.B61PO (MCI_CUEBO5534) command. This command is recognized by digital-video, VCR, and waveform-audio devices. For more information about recording with VCR devices, see VCR Services3N17_G8.

Saving a Recorded File

When recording is complete, use the saveUDLDV7 command (or MCI_SAVE1OOEUW8 and the MCI_SAVE_PARMSF35L2N structure) to save the recording before closing the device.

 

Note  If you close the device without saving, the recorded data is lost.

 

Checking Input Levels (PCM Only)

To get the level of the input signal before recording on a PCM (Pulse Code Modulation) waveform-audio input device, use the status3L25TX (MCI_STATUSCTUPE8) command. Specify the  level  flag (or the MCI_STATUS_ITEM flag and set the dwItem member of the MCI_STATUS_PARMS8BMTE5 structure to MCI_WAVE_STATUS_LEVEL). The average input signal level is returned. The left-channel value is in the high-order word and the right- or mono-channel value is in the low-order word.

The input level is represented as an unsigned value. For 8-bit samples, this value is in the range 0 through 127 (0x7F). For 16-bit samples, it is in the range 0 through 32,767 (0x7FFF).