播放存储在独立存储器中的大型录制音频文件

问题描述:


我正在使用XNA Microphone类录制音频,并以wav格式将录制的数据保存在独立存储中。
如果音频的长度很小,我的应用程序工作正常。
但随着它增加应用程序消耗的内存也增加,这大大减慢了设备。
以下代码用于播放音频
播放存储在独立存储器中的大型录制音频文件

using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) 
      { 
       using (IsolatedStorageFileStream fileStream = isoStore.OpenFile(AudioFilePath, FileMode.Open)) 
       { 
        sound = SoundEffect.FromStream(FileStream); 
        sound.Play(); 
       } 
      } 


Any suggestion on how to handle the memory issue while playing large audio files.Or how can i save the PCM in other formats (wma,mp3) to reduce the size.

SoundEffect不适用于播放长段音频。顾名思义,它是用于短片,也可以同时播放很多片。

要播放更长的音频片段,请考虑MediaElement

+0

+1。这很有趣,我不知道。你知道任何可能讨论何时使用'SoundEffect'和何时使用'MediaElement'的资源吗? – 2011-04-22 19:07:05