2011-07-27 74 views
0

好吧,我有點新的objective-c。我使用AVAudioRecorder設置了一臺錄音機。它效果很好。但....我不知道如何訪問保存的文件,赫克我甚至不知道他們是否得救。該程序至少暫時將其保存到名爲「sounds.caf」的NSDocumentsDirectory中。我想知道如果這些被永久保存,如果沒有,那麼我怎麼能這樣做。然後,如何在保存後訪問它們。謝謝您的幫助。保存和訪問音頻記錄

另外作爲旁註id喜歡知道它是否可能結合兩個聲音文件並將它們一起記錄到一個新文件中。

回答

0

您可以使用下面的代碼保存您的音頻文件。

#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] 
#define DOCUMENTS_FOLDER1 [DOCUMENTS_FOLDER stringByAppendingPathComponent:@"Recordering"] 
#define FILEPATH [DOCUMENTS_FOLDER stringByAppendingPathComponent:[self dateString]] 


BOOL success = [self.myRecorder startRecording:FILEPATH]; 

if (!success){ 

    printf("Error starting recording\n"); 

    [self.myRecorder stopRecording]; 

    self.myRecorder = nil; 

    isRecording = NO; 

    return; 

}