我有以下代码可以播放声音缓冲区,但无论我尝试什么,即使系统音量已达到最高水平,扬声器和耳机的音量仍然太低。我的代码有什么问题?
-(void)playSound:(NSData *)data {
NSError* error;
player = [[AVAudioPlayer alloc] initWithData:data error:&error];
if (error) {
// TODO: log error
}
[player setNumberOfLoops:0];
[player setVolume:1.0f];
player.delegate = (id)self;
[soundArray insertObject:player atIndex:0];
[player prepareToPlay];
[player play];
}