How can I play compressed sound files in C# in a portable way?

前端 未结 9 1799
陌清茗
陌清茗 2020-12-14 02:43

Is there a portable, not patent-restricted way to play compressed sound files in C# / .Net? I want to play short \"jingle\" sounds on various events occuring in the program.

9条回答
  •  独厮守ぢ
    2020-12-14 03:23

    Well, it depends on a patent-related laws in a given country, but there is no way to write a mp3 decoder without violating patents, as far as i know. I think the best cross-platform, open source solution for your problem is GStreamer. It has c# bindings, which evolve rapidly. Using and building GStreamer on Windows is not an easy task however. Here is a good starting point. Banshee project uses this approach, but it is not really usable on windows yet (however, there are some almost-working nightly builds). FMOD is also a good alternative. Unfortunately, it is not open source and i find that its API is somehow C-styled.

提交回复
热议问题