gpt4 book ai didi

iphone - 超过五秒的 iphone 声音

转载 作者:搜寻专家 更新时间:2023-10-30 20:04:58 26 4
gpt4 key购买 nike

大家好。以下是我用来在 iPhone 模拟器上播放随机声音的代码。大约 30 种声音中的一些不会播放,经过一些调查后我发现没有播放的声音超过 5 秒。有人知道为什么吗?在此先感谢您的帮助!

NSString *path = [[NSBundle mainBundle] pathForResource:sound ofType:@"wav"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path], &soundID);
AudioServicesPlaySystemSound (soundID);

最佳答案

我认为使用 AudioServicesPlaySystemSound 播放声音的时间限制为 5 秒(尽管某些版本的文档声称为 30 秒)。

备选方案是 openAL 和音频队列。这里有一个关于 openAL 的有用教程:http://benbritten.com/blog/2008/11/06/openal-sound-on-the-iphone/

关于iphone - 超过五秒的 iphone 声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/929932/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com