zoukankan      html  css  js  c++  java
  • 播放声音 Beep和MessageBeep函数(c++) (windows)

     

    在<windows.h>中

    一:BOOL WINAPI MessageBeep (_in UINT uType );

      播放一个波形文件 (也就是wac格式),每个声音类型的波形声音在注册表中有一个条目 (entry ) 指定

       如MB_OK

    二:BOOL WINAPI BEEP ( 

      _in DWORD dwFreq, //频率

      _in DWORD dwDuration //毫秒

      );

    G 调:G A B C D E #F G

    C 调:C D E F G A B

    E 调:E #F #G A B #C #D

     
    #include <windows.h>
    #include <cstdio>
    #define TIME 1000
     
    int main () 
    {
    	printf("        起来!不愿做奴隶的人们!
    
    	把我们的血肉筑成我们新的长城!
    
    	中华民族到了最危险的时候,
    
    	每个人被迫着发出最后的吼声。
    
    	起来!起来!起来!
    
    	我们万众一心,
    
    	冒着敌人的炮火,前进!
    
    	冒着敌人的炮火,前进!
    
    	前进!前进、进!
    
    ");
    	printf("向伟大的祖国致敬 作者YaoLin_X
    不得盗用本人的作品以做违法《国歌法》的事
    若不听劝阻,承担法律责任,本人不负任何责任
    默认用户已经同意");
    	Beep(294,TIME/2  ); Beep(392,TIME*3/2); Beep(392,TIME/2  ); Beep(392,TIME*3/4); Beep(392,TIME/4  );
    	Beep(294,TIME/2  ); Beep(330,TIME/4  );	Beep(349,TIME/4  ); Beep(392,TIME    ); Beep(392,TIME    );
    	Sleep(TIME/2     ); Beep(494,TIME/2  );	Beep(392,TIME/2  ); Beep(440,TIME/4  );	Beep(494,TIME/4  );
    	Beep(587,TIME    );	Beep(587,TIME    );	Beep(494,TIME*3/4);	Beep(494,TIME/4  );	Beep(392,TIME*3/4);
    	Beep(494,TIME/4  );	Beep(587,TIME*3/4);	Beep(494,TIME/4  );	Beep(440,TIME    );	Beep(440,TIME*2  );
    	Beep(659,TIME    ); Beep(587,TIME    );	Beep(440,TIME    ); Beep(494,TIME    );	Beep(587,TIME/2  );
    	Beep(494,TIME/2  );	Sleep(TIME/2     );	Beep(587,TIME/2  );	Beep(494,TIME/2  );	Beep(440,TIME/4  );
    	Beep(494,TIME/4  ); Beep(392,TIME    );	Beep(494,TIME    );	Sleep(TIME       ); Beep(294,TIME*3/4);
    	Beep(330,TIME/4  ); Beep(392,TIME/2  ); Beep(392,TIME/2  ); Beep(494,TIME*3/4); Beep(494,TIME/4  );
    	Beep(587,TIME/2  ); Beep(587,TIME/2  );	Beep(440,TIME/2  ); Beep(440,TIME/4  ); Beep(440,TIME/4  );
    	Beep(330,TIME    ); Beep(440,TIME*3/2); Beep(294,TIME/2  ); Beep(392,TIME*3/2); Beep(392,TIME/2  );
    	Beep(494,TIME*3/2); Beep(494,TIME/2  );	Beep(587,TIME*2  ); Beep(392,TIME*3/4);	Beep(494,TIME/4  );
    	Beep(587,TIME/2  ); Beep(587,TIME/2  );	Beep(659,TIME    ); Beep(587,TIME    );	Beep(494,TIME*3/4);
    	Beep(392,TIME/4  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(494,TIME/2  );	
    	Sleep(TIME/2     );	Beep(392,TIME/2  );	Sleep(TIME/2     );	Beep(294,TIME    );	Beep(392,TIME    );
    	Beep(494,TIME*3/4);	Beep(392,TIME/4  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );
    	Beep(494,TIME/2  );	Sleep(TIME/2     );	Beep(392,TIME/2  );	Sleep(TIME/2     );	Beep(294,TIME    );
    	Beep(392,TIME    );	Beep(294,TIME    );	Beep(392,TIME    );	Beep(294,TIME    );	Beep(392,TIME    );
    	Beep(392,TIME    );
    	return 0;
    }
    

      

     
     
     
  • 相关阅读:
    开源天气预报api整理
    Android gradle 相关配置
    Android Base64转图片
    【转】数据加密算法详解
    【转】零基础学习Fiddler抓包改包
    【转】你所不知道的Android Studio调试技巧
    【转】Android Studio-1.2版本设置教程
    Android app应用多语言切换功能实现
    Android通用流行框架大全
    38个学习新技能的最佳网站
  • 原文地址:https://www.cnblogs.com/Srand-X/p/12803920.html
Copyright © 2011-2022 走看看