在声音模拟器的工作,而不是在真正的iPhone [英] Sound working in emulator, not in real iPhone

查看:115
本文介绍了在声音模拟器的工作,而不是在真正的iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有短短的声音效果的样本,这在模拟器中播放的蛮好的,但不是所有的真正的iPhone 3GS。这里的code,大约为-是从苹果SysSound示例:

Have few short sound effect samples, which play just fine in emulator, but not at all in real iPhone 3GS. Here's the code, about as-is from Apple SysSound sample:

CFBundleRef mb = CFBundleGetMainBundle ();
CFURLRef soundFileURLRef = CFBundleCopyResourceURL
    (mb, CFSTR("mySound"), CFSTR ("caf"), NULL);

SystemSoundID sid;
AudioServicesCreateSystemSoundID(soundFileURLRef, &sid);
AudioServicesPlaySystemSound(sid);

在使用iPhone,我能听到从iTunes(而不是试图在同一时间使用的打我的声音)keyclicks和音乐 - 但不能听到我的声音都没有。抑振工程确定,所以即使框架应该是设置正确。

When using iPhone, I can hear keyclicks and music from iTunes (not trying to use at same time as playing my sound) - but cannot hear my sound at all. Vibra works ok, so even Framework should be set up correctly.

试过连SoundEffect.h /平方米样品code,没有任何变化。使用相同的声音文件,但不应CAF是好的,特别是当它在模拟器玩?

Tried even the SoundEffect.h/m sample code, no change. Used same sound files, but shouldn't CAF be ok, especially when it plays in emulator?

我可以尝试下?

推荐答案

尝试转换为不同的格式,如WAV或MP3,然后重新播放。如果你想使用CAF,确保您在Terminal.app正确格式化咖啡馆:

Try converting to a different format such as wav or mp3, then play again. If you want to use caf, Make sure you are formatting the caf correctly in Terminal.app:

afconvert -f caff -d ima4 mysound.wav

这篇关于在声音模拟器的工作,而不是在真正的iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆