m0_58099300 2021-08-21 08:39 采纳率: 50%
浏览 362
已结题

c语言程序无法播放音乐

为什么使用mcisendstring播放不了音乐,程序检测不出问题,但却无法听到音乐声音,求大神指点

  • 写回答

2条回答 默认 最新

  • StjpStjp 2021-08-21 09:33
    关注

    我自己编的程序
    自己看看吧

    #include <cstdio>
    #include <windows.h>
    #define qdo 262
    #define qri 294
    #define qmi 330     //q前缀为低音,1后缀为高音
    #define qfa 349
    #define qso 392
    #define qla 440
    #define qxi 494
    #define doo 523
    #define ri 578
    #define mi 659
    #define fa 698
    #define so 784
    #define la 880
    #define xi 988
    #define do1 1046
    #define ri1 1175
    #define mi1 1318
    #define fa1 1480
    #define so1 1568
    #define la1 1760
    #define xi1 1976
    #define do11 2092
    #define ri11 2350
    #define mi11 2636
    #define fa11 2960
    #define so11 3136
    #define la11 3560
    #define xi11 3952
    int main() {
        int pai=400,ban=200;
        int ting=128;
        Beep(ri1,pai);
        Beep(mi1,ban);
        Beep(do1,ban);
        Beep(ri1,pai*3);
        Beep(mi1,pai);
        Beep(fa1,pai);
        Beep(so1,pai);
        Beep(mi1,pai);
        Beep(do1,pai);
        Beep(ri1,pai);
        Beep(mi1,ban);
        Beep(do1,ban);
        Beep(ri1,pai*3);
        Sleep(ting);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(so,ban>>1);
        Beep(la,ban);
        Beep(so,ban);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,pai*2);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(so,ban>>1);
        Beep(la,ban);
        Beep(so,ban);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,pai*3);//
        Beep(qla,pai);
        Beep(ri,pai*3);
        Beep(mi,ban);
        Beep(fa,ban);
        Beep(so,pai*2);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,ban>>1);
        Beep(doo,ban>>1);
        Beep(ri,pai*2);
        Beep(qla,pai*4);
        Beep(qso,pai);
        Beep(ri,pai*3);
        Beep(mi,ban);
        Beep(fa,ban);
        Beep(so,pai*2);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,ban>>1);
        Beep(doo,ban>>1);
        Beep(ri,pai*2);
        Beep(la,pai*2);
        Beep(so,pai*2);
        Beep(do1,pai*2);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(so,ban>>1);
        Beep(la,ban);
        Beep(so,ban);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,pai*3);
        Beep(qla,pai);
        Beep(ri,pai*3);
        Beep(mi,ban);
        Beep(fa,ban);
        Beep(so,pai*2);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,ban>>1);
        Beep(doo,ban>>1);
        Beep(ri,pai*2);
        Beep(qla,pai*4);
        Beep(qso,pai);
        Beep(ri,pai*3);
        Beep(mi,ban);
        Beep(fa,ban);
        Beep(so,pai*2);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,ban>>1);
        Beep(doo,ban>>1);
        Beep(ri,pai*2);
        Beep(la,pai*2);
        Beep(so,pai*2);
        Beep(do1,pai*2);
        Beep(ri1,pai*3);
        Beep(mi1,ban);
        Beep(fa1,ban);
        Beep(so1,pai*2);
        Beep(la1,ban>>1);
        Beep(so1,ban>>1);
        Beep(fa1,ban>>1);
        Beep(mi1,ban>>1);
        Beep(ri1,ban>>1);
        Beep(do1,ban>>1);
        Beep(ri1,pai*2);
        Beep(la,pai*4);
        Beep(so,pai);
        Beep(ri,pai*3);
        Beep(mi,ban);
        Beep(fa,ban);
        Beep(so,pai*2);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(fa,ban>>1);
        Beep(mi,ban>>1);
        Beep(ri,ban>>1);
        Beep(doo,ban>>1);
        Beep(ri,pai*2);
        Beep(la,pai*2);
        Beep(so,pai*2);
        Beep(do1,pai*2);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,ban);
        Beep(ri1,ban);
        Beep(ri,ban);
        Beep(ri1,ban);
        Beep(do1,ban);
        Beep(xi,ban>>1);
        Beep(la,ban>>1);
        Beep(xi,ban);
        Beep(la,ban>>1);
        Beep(so,ban>>1);
        Beep(ri1,pai);
        Beep(ri1,pai*6);
        return 0;
    }
     
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 8月29日
  • 已采纳回答 8月21日
  • 创建了问题 8月21日

悬赏问题

  • ¥15 系统 24h2 专业工作站版,浏览文件夹的图库,视频,图片之类的怎样删除?
  • ¥15 怎么把512还原为520格式
  • ¥15 MATLAB的动态模态分解出现错误,以CFX非定常模拟结果为快照
  • ¥15 求高通平台Softsim调试经验
  • ¥15 canal如何实现将mysql多张表(月表)采集入库到目标表中(一张表)?
  • ¥15 wpf ScrollViewer实现冻结左侧宽度w范围内的视图
  • ¥15 栅极驱动低侧烧毁MOSFET
  • ¥30 写segy数据时出错3
  • ¥100 linux下qt运行QCefView demo报错
  • ¥50 F1C100S下的红外解码IR_RX驱动问题