如何播放的背景音乐,并使其循环? [英] How to play a background music and make it loop?
本文介绍了如何播放的背景音乐,并使其循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何播放的背景音乐,并使其循环?
目前我使用的这块code,使其播放背景音乐:
XNA-C#
SoundEffect中bgEffect;
bgEffect = Content.Load&所述; SoundEffect中&GT(EpicUnease);
bgEffect.Play(0.1F,0.0,0.0);
解决方案
如果这不是XNA,你可以参考 System.Media
并做到这一点:
声音播放声音=新声音播放(路径);`
sound.PlayLooping();
有关XNA你会做这样的事情:
SoundEffect中bgEffect;
bgEffect = Content.Load&所述; SoundEffect中&GT(EpicUnease);
SoundEffectInstance例如= bgEffect .CreateInstance();
instance.IsLooped = TRUE;
bgEffect.Play(0.1F,0.0,0.0);
有关详细信息,请参阅本MSDN文章:<一href=\"http://msdn.microsoft.com/en-us/library/dd940203.aspx\">http://msdn.microsoft.com/en-us/library/dd940203.aspx
How to play a background music and make it loop?
Currently I'm using this piece of code to make it play the background music:
XNA-C#
SoundEffect bgEffect;
bgEffect = Content.Load<SoundEffect>("EpicUnease");
bgEffect.Play(0.1f, 0.0f, 0.0f);
解决方案
If this is not XNA, you can reference System.Media
and do this:
SoundPlayer sound = new SoundPlayer("path");`
sound.PlayLooping();
For XNA you would do something like this:
SoundEffect bgEffect;
bgEffect = Content.Load<SoundEffect>("EpicUnease");
SoundEffectInstance instance = bgEffect .CreateInstance();
instance.IsLooped = true;
bgEffect.Play(0.1f, 0.0f, 0.0f);
For more information, check out this msdn article: http://msdn.microsoft.com/en-us/library/dd940203.aspx
这篇关于如何播放的背景音乐,并使其循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文