开发者

Playing large recorded audio files stored in Isolated Storage

开发者 https://www.devze.com 2023-02-28 01:11 出处:网络
I am recording audio using the XNA Microphone class and saving the recorded data in isolated storage in wav format.If the length of audio is small my app is working fine.But as it increases the memory

I am recording audio using the XNA Microphone class and saving the recorded data in isolated storage in wav format.

If the length of audio is small my app is working fine.

But as it increases the memory consumed by the app also increases,which drastically slows down the device.

The following code is used to play the audio

using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (IsolatedStorageFileStream file开发者_StackOverflowStream = 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 isn't intended for playing long pieces of audio. As the name suggests it is intended for short pieces and also playing lots of them, possibly at the same time.

To play longer pieces of audio you shoudl consider the MediaElement.

0

精彩评论

暂无评论...
验证码 换一张
取 消