CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C++ Builder >  基础类

想用pc喇叭发出有节奏的声音怎么做?

楼主dingzhenhhy(霸王龙)2001-12-18 10:21:27 在 C++ Builder / 基础类 提问

想用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

相关问题

  • 如何在C++中编程实现PC喇叭发出音乐?
  • pc喇叭发出类似警笛的声音
  • 如何让PC喇叭发出不同音阶的声音
  • 求:如何实现PC喇叭发出声音、及声卡发出声音
  • 在C#里如何驱动PC的喇叭,让它发出声音?
  • 各位大虾,开机PC喇叭发出一长三短的声音是怎么回事???
  • 怎么使PC喇叭(注意不是音箱)发出指定的声音? beep不行,机器有声卡!!! WIN2000下也要能用啊!
  • 用PC喇叭发声的方法是?
  • pc喇叭的音量如何控制?
  • 关于用PC喇叭发音

关键词

  • beep
  • 节奏
  • sound
  • 发出
  • ignores
  • parameters
  • function

得分解答快速导航

  • 帖主:dingzhenhhy
  • BCB

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo