为AVFoundationAudioSettings设置AVAudioTimePitchAlgorithmVarispeed

时间:2014-05-27 00:01:42

标签: ios objective-c

根据这些docs,我可以更改AVAudioPlayer的某些设置,包括AVAudioTimePitchAlgorithmVarispeed设置。我该如何设置此值?我是否需要子类化AVAudioSetting.h?

1 个答案:

答案 0 :(得分:4)

如果不需要使用AVAudioPlayer,则可以使用AVPlayer

AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];
playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmTimeDomain;
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
[player play];