简体   繁体   English

如何在C#中播放声音?

[英]How can I play sound in C#?

I'm trying to make a small game. 我正在尝试制作一款小游戏。 There is about 20 effect sounds and I combined them all into one mp3 file. 有大约20种效果声音,我将它们全部合并为一个mp3文件。 My question is: Is there a way to load the mp3 file into the memory and then play multiple sections of it at the same time? 我的问题是:有没有办法将mp3文件加载到内存中,然后同时播放它的多个部分?

Any help is appreciated, thanks you! 任何帮助表示赞赏,谢谢!

nAudio is your friend nAudio是你的朋友

You can open the same file (stream or byte array) as many times as you like and set the position you want to play from 您可以根据需要多次打开相同的文件(流或字节数组)并设置要播放的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM