2011-09-12 62 views

回答

3

是的,AVAudioPlayer为您提供播放.wav文件的可能性。

这是很简单的:

// in the corresponding .h file: 
// @property (nonatomic, retain) AVAudioPlayer *player; 

// in the .m file: 
@synthesize player; // the player object 

NSString *soundFilePath = 
      [[NSBundle mainBundle] pathForResource: @"sound" 
              ofType: @"wav"]; 

NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath]; 

AVAudioPlayer *newPlayer = 
      [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL 
                error: nil]; 
[fileURL release]; 

self.player = newPlayer; 
[newPlayer release]; 

[player prepareToPlay]; 

来源:MultimediaPG

音频播放和录制格式 音频播放格式在iPhone支持:Playing Sounds Easily with the AVAudioPlayer Class

0

您对您的问题在这里找到完整的答案OS如下:

*AAC 
*HE-AAC 
*AMR (Adaptive Multi-Rate, a format for speech) 
*ALAC (Apple Lossless) 
*iLBC (internet Low Bitrate Codec, another format for speech) 
*IMA4 (IMA/ADPCM) 
*linear PCM (uncompressed) 
*µ-law and a-law 
*MP3 (MPEG-1 audio layer 3 

iPhone OS支持的音频录制格式如下:

*AAC (on supported devices only) 
*ALAC (Apple Lossless) 
*iLBC (internet Low Bitrate Codec, for speech) 
*IMA4 (IMA/ADPCM) 
*linear PCM 
*µ-law and a-law