AVAudioPlayer在iPhone上非常安静,但在iPodtouch上足够响亮
我有一些声音是在一个循环中播放的,因为噪音是用一个音频录像机记录的 这是我的密码:AVAudioPlayer在iPhone上非常安静,但在iPodtouch上足够响亮,iphone,avaudioplayer,ipod-touch,avaudiorecorder,Iphone,Avaudioplayer,Ipod Touch,Avaudiorecorder,我有一些声音是在一个循环中播放的,因为噪音是用一个音频录像机记录的 这是我的密码: NSString *pathToFile = [[NSBundle mainBundle] pathForResource:@"foghornRepeat2" ofType:@"aif"]; foghornRepeat =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:pathToFile] error:nil
NSString *pathToFile = [[NSBundle mainBundle] pathForResource:@"foghornRepeat2" ofType:@"aif"];
foghornRepeat =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:pathToFile] error:nil];
//foghornRepeat.delegate = self;
[foghornRepeat prepareToPlay];
foghornRepeat.numberOfLoops = -1;
[foghornRepeat setVolume:1];
然后,当声音通过麦克风记录时,它将播放并停止。你知道为什么在iphone上这样会很安静吗?在我的iPodtouch上很好
我还有别的办法吗
谢谢
Tom可能发生的情况是,iphone上的音频被重新路由到手机扬声器。要确保从真实扬声器播放声音,请在播放声音效果之前使用以下代码:
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);