2011-09-12 6 views

Trả lời

3

Có, AVAudioPlayer cung cấp cho bạn khả năng phát các tệp .wav.

Nó khá thẳng về phía trước:

// 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]; 

Từ: Playing Sounds Easily with the AVAudioPlayer Class

0

Bạn tìm thấy câu trả lời đầy đủ về câu hỏi của bạn ở đây: MultimediaPG

Audio Formats Playback và ghi Các định dạng phát lại âm thanh được hỗ trợ trong iPhone Hệ điều hành như sau:

*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 

Các định dạng ghi âm được hỗ trợ trong iPhone OS như sau:

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