Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
由于缺少用于播放 MP3 文件的托管 .NET api,我正在使用PlaySound(byte[]) as P/Invoke,它现在可以成功播放 MP3 文件。
PlaySound(byte[])
由于许可证限制,我不能使用任何第三方库。
现在,我想使用 Mono 将应用程序移植到 Linux 和 OS X,但我不确定应该在这些平台上使用哪些 P/Invokes。
对类似问题的回答说
你可以打开("/dev/dsp") 并写入它。我相信,这就是你所能得到的“本机系统调用”。
但我不知道如何在 C# 中做到这一点
谢谢。
您需要使用 SDL_Mixer 库和 SMPEG 库来支持 mp3。代码应该可以在所有操作系统中重用。