首页 > 移动平台 > 详细

iOS 代码创建无声音乐方法

时间:2018-04-17 11:26:41      阅读:294      评论:0      收藏:0      [点我收藏+]
代码创建无声音乐方法
const char bytes[] = {0x52, 0x49, 0x46, 0x46, 0x26, 0x0, 0x0, 0x0, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6d, 0x74, 0x20, 0x10, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0x0, 0x44, 0xac, 0x0, 0x0, 0x88, 0x58, 0x1, 0x0, 0x2, 0x0, 0x10, 0x0, 0x64, 0x61, 0x74, 0x61, 0x2, 0x0, 0x0, 0x0, 0xfc, 0xff};

    NSData* data = [NSData dataWithBytes:bytes length:sizeof(bytes)];
    NSString * docsDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];

    // Build the path to the database file
    NSString * filePath = [[NSString alloc] initWithString:
                           [docsDir stringByAppendingPathComponent: @"background.wav"]];
    [data writeToFile:filePath atomically:YES];

iOS 代码创建无声音乐方法

原文:http://blog.51cto.com/318881/2104286

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!