OrigamiEngine

[翻译] OrigamiEngine-LMLPHP

https://github.com/ap4y/OrigamiEngine

Lightweight iOS and OSX audio engine with opus, flac, cue, mp3, m4a, m3u support.

轻量级iOS,OSX音频处理工具,支持opus, flac, cue, mp3, m4a, m3u

Supported formats

  • Audio sources: http and local files 支持http方式以及本地文件方式
  • Audio files: opus, flac, mp3, m4a, wav and other from CoreAudio 支持的文件格式包括opus, flac, mp3, m4a, wav以及其他CoreAudio支持的类型
  • Playlists: cue, m3u 支持播放列表

Features

  • Ligthweight: 300kb compiled, 1.2mb with libFLAC 轻量级:编译后是300kb,链接到libFLAC后是1.2mb
  • Small memory foorprint: no more than 2.5mb for the flac files 占用内存小:flac文件不会超过2.5mb
  • Low resource consumption: about 14% CPU usage for FLAC on ipod 4g 低资源消耗:在ipod 4g上只用到了14%的CPU
  • All operations in background with GCD 所有后台操作基于GCD
  • Event-based (using dispatch sources and CoreAudio async api) 事件触发机制(使用了dispatch source以及CoreAudio 异步的api)
  • Provides full audio metadata (vorbis, id3 tags) with embeeded cover images 提供全部的音频元数据包括嵌入的图片资源
  • HTTP data caching HTTP数据缓存
  • Tested (currently about 85% code coverage) 已经测试过了(当前超过85%已经测试过)

Overview

Static library and cocoapods podspec provided. Static library can be compiled with embeeded FLAC library (check project targets). For OSX you can use static framework.

提供静态库或者cocoapods.静态库可用来编译嵌入FLAC的库,在OSX上,你可以使用静态库.

Start playback: 开始播放:

self.player = [[ORGMEngine alloc] init];
NSURL* url = [NSURL URLWithString:tfUrl.text];
[_player playUrl:url];

Common operations: 常用的操作:

[_player metadata];                         // current metadata
[_player pause]; // pause playback
[_player resume]; // resume playback
[_player stop]; // stop playback
[_player seekToTime:seekSlider.value]; // seek to second
[_player setNextUrl:url withDataFlush:YES]; // play next track and clear current buffer

Delegate methods: 代理方法:

- (NSURL*)engineExpectsNextUrl:(ORGMEngine*)engine; // provides continious playback
- (void)engine:(ORGMEngine*)engine didChangeState:(ORGMEngineState)state; // state change callback

Check example project and tests for the additional information.

Documentation

Project headers contain appledoc comments, precompiled docset here.

工程头文件件中包含了appledoc的描述.

Tests

OCUnit tests included into the project.

Credits

  • http://cogx.org/ by Vincent Spader. FLAC decoder implementation based on Cog sources
05-11 21:58