mciSendString

导读:


Device Control


To control an MCI device, you open the device, send the necessary commands to it, and then close the device. The commands can be very similar, even for completely different MCI devices. For example, the following series of MCI commands plays the sixth track of an audio CD by using the mciSendString function:

mciSendString("open cdaudio", lpszReturnString,

lstrlen(lpszReturnString), NULL);
mciSendString("set cdaudio time format tmsf", lpszReturnString,
lstrlen(lpszReturnString), NULL);
mciSendString("play cdaudio from 6 to 7", lpszReturnString,
lstrlen(lpszReturnString), NULL);
mciSendString("close cdaudio", lpszReturnString,
lstrlen(lpszReturnString), NULL);

The next example shows a similar series of MCI commands that plays the first 10,000 samples of a waveform-audio file:

mciSendString(

"open c:/mmdata/purplefi.wav type waveaudio alias finch",
lpszReturnString, lstrlen(lpszReturnString), NULL);
mciSendString("set finch time format samples", lpszReturnString,
lstrlen(lpszReturnString), NULL);
mciSendString("play finch from 1 to 10000", lpszReturnString,
lstrlen(lpszReturnString), NULL);
mciSendString("close finch", lpszReturnString,
lstrlen(lpszReturnString), NULL);

These examples illustrate some interesting facts about MCI commands:


  • The same basic commands (open, set, play, and close) are used with CD audio and waveform-audio devices. The same MCI commands are used with all MCI devices.
  • The open command for the waveform-audio device includes a filename specification. The waveform-audio device is a compound device (one associated with a data file), while the CD audio device is a simple device (one without an associated data file).
  • The set command specifies time formats in each case, but the time-format flag for the CD audio device specifies tracks/minutes/seconds/frames (TMSF) format, while the time format used with the waveform-audio device specifies "samples".
  • The variables used with the "from" and "to" flags are appropriate to the respective time format. For example, for the CD audio device, the variables specify a range of tracks, but for the waveform-audio device, the variables specify a range of samples.

 
  

本文转自
about:blank

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值