iOS C++ dump PCM

作者: Youzhicha | 来源:发表于2019-08-01 09:27 被阅读0次
    #include <stdio.h>
    //只可从App层的系统API获得沙盒中Documents 目录所在的绝对路径
    //参数NSDocumentDirectory要获取那种路径
    NSArray  *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    //获取sandBox中Documents 目录所在的绝对路径
    NSString *documentsDirectory = [paths objectAtIndex:0];
    strcpy(global_debug_recording_path_, [documentsDirectory UTF8String]);
    
    extern char global_debug_recording_path_[256];  
    char file_path1[1024] = {0,};
    bool isCreated = false;
      if(!isCreated) {
          strcpy(file_path1, global_debug_recording_path_);
          strcat(file_path1, "/Source.pcm");
          file1 = fopen((const char*)file_path1, "w+");
          if (file1) {
            isCreated = true;
          }
        }
    
    if(file1){
        fwrite(source_frame->data_ , 1, sizeof(int16_t)*source_frame->samples_per_channel_*source_frame->num_channels_, file1);
    }
    
    

    swift 获取沙盒路径

    Ref:

    1.Iphone文件读写操作
    2.NULL when using fopen with xcode

    相关文章

      网友评论

        本文标题:iOS C++ dump PCM

        本文链接:https://www.haomeiwen.com/subject/xlzgcctx.html