本文介绍了SpeakHere样品不能播放从互联网加载的声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打从互联网加载的声音文件,所以我试图从iPhone SDK SpeakHere样品开始。我录了音,然后保存并上传到互联网,我可以下载该文件,并从声音工具没有问题玩。但是,当我试图播放从SpeakHere该URL,我得到错误程序接收到的信号:EXC_BAD_ACCESS

I'd like to play sound file which loaded from internet, so I tried to start from iPhone SDK SpeakHere sample. I recorded the sound, then saved and uploaded to the internet, I could download that file and play without problem from sound tools. But when I tried to play that URL from SpeakHere, I am getting error Program received signal: "EXC_BAD_ACCESS".

跟踪左右后,我发现,在 - [AudioPlayer calculateSizesFor:] ,其设置 bufferByteSize 来一大量806128768,造成缓冲区分配失败。

After trace around, I found that the in -[AudioPlayer calculateSizesFor:], it set bufferByteSize to a huge number 806128768, which caused buffer allocation failed.

这是因为

AudioFileGetProperty(audioFileID, kAudioFilePropertyPacketSizeUpperBound, &propertySize, &maxPacketSize);

maxPacketSize 返回为806128768。

The maxPacketSize returned is 806128768.

我想知道如何使 AudioFileGetProperty 工作

我的声音文件,
你可以右键单击并从这里 直接从互联网上播放。

Yes, you need to use Audio File Stream Services to play directly from the internet.

我发现了AudioFileStreamExample的例子是有用的,它应安装在

I found the "AudioFileStreamExample" example useful, which should be installed in

/Developer/Examples/CoreAudio/Services/AudioFileStreamExample/

此外,马特·加拉格尔有一篇文章叫做,包括iPhone例如code。我还没有仔细看,但似乎它可能对您有所帮助。

Also, Matt Gallagher has an article called "Streaming and playing an MP3 stream" that includes iPhone example code. I haven't looked at it carefully, but it seems like it may be helpful to you.

这篇关于SpeakHere样品不能播放从互联网加载的声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:59