如何使用FMOD以C代码播放MP3文件?

问题描述

我试图在我的C代码中播放一个简单的文件,所以我查找了如何在Stack Overflow上进行操作,但是当我尝试应用答案(即下载FMOD并使用它)时,我得到了错误

代码是:

    #include <stdlib.h>
    #include <math.h>
    #include <stdio.h>
    #include <conio.h>
    #include <inc/fmod.h>
    
    FSOUND_SAMPLE* handle;
    int main()
    {
     // init FMOD sound system
       FSOUND_Init (44100,32,0);
    
       // load and play mp3
       handle=FSOUND_Sample_Load (0,"mp3.file",0);
       FSOUND_PlaySound (0,handle);
    
       // wait until the users hits a key to end the app
       while (!_kbhit())
       {
       }
    
       // clean up
       FSOUND_Sample_Free (handle);
       FSOUND_Close();
    }

但是错误告诉我:

 "gcc -Wall -c "Cases.c" (in directory: C:\Users\xeobi\Documents\C Files)
Cases.c:5:10: Fatal error: inc/fmod.h: No such file or directory
    5 | #include <inc/fmod.h>
      |          ^~~~~~~~~~~~
compilation terminated.
Compilation Failed."

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)