系统声音通过扬声器非常安静地播放

我在Objective-C中使用AudioServicesPlaySystemSound播放音效。 他们在模拟器和iPad扬声器上播放的音量非常大,但是当我将iPad的音频线插入扬声器时,声音很低,几乎听不到。 我尝试过不同的扬声器,并获得相同的效果。 通过蓝牙,声音仍然安静,但至少可以听到。 这是我的代码:

- (IBAction)playSound:(UIButton *)sender
{
    NSString *path = [NSString stringWithFormat: @"%@/%@", [[NSBundle mainBundle] resourcePath], @"MySoundEffect.caf"];
    NSURL *filePath = [NSURL fileURLWithPath: path isDirectory: NO];
    NSLog(@"filepath = %@", filePath);

    SystemSoundID soundID;
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);

    AudioServicesPlaySystemSound(soundID);
}

这似乎是简单地使用AudioServicesPlaySystemSound的问题。 我的解决方法是使用SimpleAudioEngine,它在后台执行一些工作,我假设即使通过蓝牙或线路播放时也保持音量和音质不变。

链接地址: http://www.djcxy.com/p/67935.html

上一篇: System Sound plays very quietly over speakers

下一篇: Why are my audio sounds not playing on time?