我的问题很严重:
我正在制作音频同步的BEATBOX,同时播放16种不同的声音.
Im Making an Audio Synchronized BEATBOX with 16 different sounds playing at the same time.
为了实现mp3文件的时间同步,我们放弃了 AVAudioPlayer并包括以下的AUGraph方法:
In Order to Implement the TIME-SYNC of the mp3 files we gave up on the AVAudioPlayer and included the AUGraph Method of:
MixerHostAudio.m 和 MixerHostAudio.h
MixerHostAudio.m and MixerHostAudio.h
我从Apple的开发人员资源处下载的.
which I Downloaded at the Developer Resources form Apple.
对于Simulator而言,实现工作正常,但对于Device而言效果不佳 加载第四个文件后崩溃...
The Implementation worked fine for the Simulator, but not on Device, which CRASHED after loading the 4th file...
我们正在将文件加载为kAudioFormatLinearPCM格式.
we Were Loading the Files as kAudioFormatLinearPCM format.
我们将其更改为:kAudioFormatMPEGLayer3
We Changed it to: kAudioFormatMPEGLayer3
将所有.mp3文件全部删除,我们认为这是必需的格式.
being out files all .mp3 we thought that would be the required format.
APP确实成功加载了资源,但是在startAUGraph上出现了一个错误 方法.
The APP Did manage to load the Resources, but we got an Error on startAUGraph method.
APP Didnt在设备上崩溃,但没有播放声音,也没有在设备上播放,也没有 在模拟器中.
The APP Didnt crashed on Device, but it PLAYS NO SOUNDS, nor in Device, nor in Simulator.
我们尝试将位速率从32更改为16,这似乎有所帮助. 但是仍然没有声音..帮助!
we tried changin the bit Rate from 32 to 16 and it seems to have helped.. but NO SOund Still.. HELP!
推荐答案已解决:
显然没有办法将压缩的音频文件加载到iOS上的AUGraph或AudioBuffer中,必须转换为linearPCM,因此:
There is Apparently NO WAY to load a Compressed Audio File into the AUGraph or the AudioBuffer on iOS, there HAS to be a conversion to linearPCM, therefore:
当转换为linearPCM时,每个29秒钟的.mp3文件(每个500KB)变成了5 MB的文件.
the 29 second .mp3 files which were 500KB each turned into 5 MB files when converted to linearPCM.
iPhone 3G为每个应用程序提供大约20 MB的RAM内存,这说明了为什么加载第四个文件(4 * 5 = 20:p)后APP崩溃了
the iPhone 3G allows about 20 MB of RAM memory for each application, which explains why the APP Crashed after loading the 4th file ( 4 * 5 = 20 :p )
理想的解决方案是实现每次仅加载文件的一小部分(例如1秒)的缓冲算法.
The ideal Solution would be to implement a Buffering Algorithm that loads only a fraction of the file every time (for example, 1 second).
当时,这个解决方案让我有些头疼,因此实际解决方案正在为循环加载更短的文件,以使其能够在3G和3GS设备上加载. iPhone4将加载完整原始循环".
This Solution was a bit over my head at the time, and hence the Actual Solution was loading shorter Files for the Loop to make it able to load on 3G and 3GS Devices. iPhone4 will load the Full Original Loop.
感谢所有答复.
河南
更多推荐
mp3声音在模拟器上播放,但不在设备上播放(音频BeatBox)
发布评论