在Windows Phone 8的同时播放两个音频文件的最佳方法 [英] Best way to play two audio files simultaneously in Windows Phone 8

查看:210
本文介绍了在Windows Phone 8的同时播放两个音频文件的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前正在研究如何我可以去打2 MP3或AAC格式的文件在在Windows Phone 8的同一时间。



目前我使用XNA SoundEffect类,但只允许WAV文件是不理想的传输在网络上。



虽然研究我跑进SharpDX但似乎主要被照顾到.WAV或。打一个文件在同一时间



我也发现了这个问题:
在Windows中同时播放两个声音8地铁应用程序(C#/ XAML)
多的媒体元素都是可能的Windows 8的,但我不知道,如果他们在的Windows Phone(这个问题似乎不同意



任何想法,将不胜感激。



更新:它无法通过MediaElement的做,因为我以为的 http://msdn.microsoft.com/en-us/library/windowsphone/design/hh202883(v = vs.105)的.aspx


解决方案

您可以尝试做到这一点通过MediaFoundation.MediaEngine(见的支持的Microsoft媒体基金会的API的Windows Phone 8 关于如何正确初始化它WP8)的指导方针。在SharpDX是有Win8的样品 MediaPlayerApp 这可以作为一个起点,只玩音频(删除所有的D3D部分和应用指南WP8)。也有它在MonoGame 的MediaPlayer的使用



关于玩SharpDX多个WAV同时,这是完全可能的XAudio2,和SharpDX不具有关于XAudio2任何限制。

有只相当于WP8 CLR Garbarge收藏家似乎阻止时,它正在收集,包括原生音频线程像XAudio2所有本地线程巨大的关注,这可能导致音频口吃。没有什么,我们可以做这一点,因为这是与操作系统和.NET线程的调度问题。



我也即将能力有些怀疑WP8在实时解码两个MP3 ...让我们知道,如果你有一定的效果。


Currently looking into how I can go about playing two mp3 or aac format files at the same time in Windows Phone 8.

At the moment I am using the XNA SoundEffect class but that only allows WAV files which is not ideal for transferring over a network.

While researching I ran into SharpDX but that appears to mainly be catered to .WAV or playing one file at a time.

I also discovered this question: play two sounds simultaneously in Windows 8 Metro App (C#/XAML) Multiple media elements are possible in Windows 8 but I'm not sure if they are in Windows Phone (this question seems to disagree)

Any ideas would be greatly appreciated.

UPDATE: It can't be done through MediaElement as I thought http://msdn.microsoft.com/en-us/library/windowsphone/design/hh202883(v=vs.105).aspx

解决方案

You could try to do it through MediaFoundation.MediaEngine (see "Supported Microsoft Media Foundation APIs for Windows Phone 8" for guidelines on how to initialize it correctly on WP8). In SharpDX there is a Win8 samples MediaPlayerApp that could be used as a starting point to play only audio (remove all the d3d part and apply guidelines for WP8). There is also a usage of it in MonoGame MediaPlayer class.

Concerning playing multiple WAV with SharpDX at the same time, it is perfectly possible with XAudio2, and SharpDX doesn't have any limitation concerning XAudio2.

There is only a huge concern about the WP8 CLR Garbarge collector that seems to block all native threads when it is collecting, including native audio threads like XAudio2, and that could cause audio stuttering. There is nothing we can do about this, as this is an issue with the OS and the scheduling of threads with .NET.

I have also some doubt about the ability of WP8 to decode two MP3 in realtime... Let us know if you have some results.

这篇关于在Windows Phone 8的同时播放两个音频文件的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆