想用pc喇叭发出有节奏的声音怎么做?
想用pc喇叭发出有节奏的声音, 我用了api函数Beep()但是总是从声卡中发出,使用了MessageBeep(0xFFFFFFFF ),没有节奏而起很难听?我怎么解决?难道直接操作地址?(我不想让声卡禁用)
The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes.
BOOL Beep(
DWORD dwFreq, // sound frequency, in hertz
DWORD dwDuration // sound duration, in milliseconds
);
Parameters
dwFreq
Windows NT:
Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
Windows 95:
The parameter is ignored.
dwDuration
Windows NT:
Specifies the duration, in milliseconds, of the sound.
Windows 95:
The parameter is ignored.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Windows 95:
The Beep function ignores the dwFreq and dwDuration parameters. On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.
See Also
MessageBeep
问题点数:30、回复次数:13Top
1 楼sonicss(sonicss)回复于 2001-12-18 10:38:10 得分 0
关注Top
2 楼yangliu(探索软件http://www.tansoo.cn)回复于 2001-12-18 11:08:19 得分 0
在TC2.0下可用sound(),nosound(),但在BCB下就不行了,因为她不支持:)Top
3 楼csz_cmy(PIC&C51)回复于 2001-12-18 11:17:12 得分 0
GZ!Top
4 楼shally5(我在一旁静静的看着你)回复于 2001-12-18 11:36:10 得分 0
用QBASIC作就十分方便啊!Top
5 楼dingzhenhhy(霸王龙)回复于 2001-12-18 17:02:56 得分 0
难道解决不了?Top
6 楼dingzhenhhy(霸王龙)回复于 2001-12-20 08:04:18 得分 0
?Top
7 楼BCB(天下三分明月夜,二分无赖是扬州)回复于 2001-12-20 08:32:33 得分 0
可以,直接用outport语句控制
主板扬声器发各种频率,
我以前答过此种贴子Top
8 楼BCB(天下三分明月夜,二分无赖是扬州)回复于 2001-12-20 08:36:24 得分 30
procedure BeepEx(feq:word=200;delay:word=2000);
procedure BeepOff;
begin
asm
in al,$61;
and al,$fc;
out $61,al;
end;
end;
const
scale=1193180;
var
temp:word;
begin
temp:=scale div feq;
asm
in al,61h;
or al,3;
out 61h,al;
mov al,$b6;
out 43h,al;
mov ax,temp;
out 42h,al;
mov al,ah;
out 42h,al;
end;
sleep(delay);
beepoff;
end;
回复人:Kingron(戒网中……) (2001-7-16 14:25:01) 得0分
赫赫,在Win9x下就采用这个方法了,如果在NT下面,就简单了,直接用Windows.Beep(a,b)就可以了。
Top
9 楼bcboy(编程蜗牛)回复于 2001-12-20 08:40:19 得分 0
win2K,我用Beep演奏乐曲,但程序在98下变成了一种声调!
:(
Top
10 楼windgolly(超级菜鸟系列篇)回复于 2001-12-20 08:48:32 得分 0
:(Top
11 楼mengxihe(濛溪河)回复于 2001-12-20 09:54:48 得分 0
不错!Top
12 楼dingzhenhhy(霸王龙)回复于 2002-02-09 09:49:18 得分 0
酷!Top
13 楼dingzhenhhy(霸王龙)回复于 2002-02-09 09:52:08 得分 0
给分的窗口哪里去了?Top




