├── RemoteIODemo
├── RemoteIODemo
│ ├── libmp3lame.a
│ ├── test_wav.wav
│ ├── WavToMp3Controller.h
│ ├── ViewController.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── RecordTool.h
│ ├── LameConver.h
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Info.plist
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── AppDelegate.m
│ ├── LameConver.m
│ ├── ViewController.m
│ ├── WavToMp3Controller.m
│ ├── RecordTool.m
│ └── lame.h
├── RemoteIODemo.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── JIANHUI.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ ├── xcuserdata
│ │ └── JIANHUI.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── RemoteIODemo.xcscheme
│ └── project.pbxproj
├── RemoteIODemoTests
│ ├── Info.plist
│ └── RemoteIODemoTests.m
└── RemoteIODemoUITests
│ ├── Info.plist
│ └── RemoteIODemoUITests.m
└── README.md
/RemoteIODemo/RemoteIODemo/libmp3lame.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JIANHUI2015/RemoteIODemo/HEAD/RemoteIODemo/RemoteIODemo/libmp3lame.a
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/test_wav.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JIANHUI2015/RemoteIODemo/HEAD/RemoteIODemo/RemoteIODemo/test_wav.wav
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RemoteIODemo
2 | DEMO:[使用AUGraph录音同时播放(并转码成Mp3)](http://www.jianshu.com/p/bcc2fb23c941)
3 | [iOS-使用Lame转码:PCM->MP3](https://www.jianshu.com/p/06eaefee3314)
4 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo.xcodeproj/project.xcworkspace/xcuserdata/JIANHUI.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JIANHUI2015/RemoteIODemo/HEAD/RemoteIODemo/RemoteIODemo.xcodeproj/project.xcworkspace/xcuserdata/JIANHUI.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/WavToMp3Controller.h:
--------------------------------------------------------------------------------
1 | //
2 | // WavToMp3Controller.h
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2017/11/1.
6 | // Copyright © 2017年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface WavToMp3Controller : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/RecordTool.h:
--------------------------------------------------------------------------------
1 | //
2 | // RecordTool.h
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @protocol RecordToolDelegate
12 | - (void)gotData:(AudioBuffer)ioData;
13 | @end
14 |
15 | @interface RecordTool : NSObject
16 | @property (nonatomic, weak) id delegate;
17 | - (void)start;
18 | - (void)stop;
19 | @end
20 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/LameConver.h:
--------------------------------------------------------------------------------
1 | //
2 | // LameConver.h
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | typedef void(^successBlock)();
13 | @interface LameConver : NSObject
14 |
15 | /**
16 | PCM流转MP3文件
17 |
18 | @param pcmbuffer pcmbuffer
19 | @param path 输入路径
20 | */
21 | - (void)convertPcmToMp3:(AudioBuffer)pcmbuffer toPath:(NSString *)path;
22 |
23 | /**
24 | wav文件转mp3文件
25 |
26 | @param wavPath wav文件路径(输入)
27 | @param mp3Path mp3文件路径(输出)
28 | */
29 | - (void)converWav:(NSString *)wavPath toMp3:(NSString *)mp3Path successBlock:(successBlock)block;
30 | @end
31 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemoTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemoUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo.xcodeproj/xcuserdata/JIANHUI.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | RemoteIODemo.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | D4A60BBC1DDEDF9D00476D42
16 |
17 | primary
18 |
19 |
20 | D4A60BD51DDEDF9D00476D42
21 |
22 | primary
23 |
24 |
25 | D4A60BE01DDEDF9D00476D42
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemoTests/RemoteIODemoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // RemoteIODemoTests.m
3 | // RemoteIODemoTests
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RemoteIODemoTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation RemoteIODemoTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSMicrophoneUsageDescription
6 |
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemoUITests/RemoteIODemoUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // RemoteIODemoUITests.m
3 | // RemoteIODemoUITests
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RemoteIODemoUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation RemoteIODemoUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/LameConver.m:
--------------------------------------------------------------------------------
1 | //
2 | // LameConver.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import "LameConver.h"
10 | #import "lame.h"
11 | #import
12 | lame_t lame;
13 | @implementation LameConver
14 |
15 | - (instancetype)init
16 | {
17 | self = [super init];
18 | if (self) {
19 | [self initLame];
20 | }
21 | return self;
22 | }
23 |
24 | - (void)initLame {
25 | lame = lame_init();
26 | lame_set_in_samplerate(lame, 44100.0);
27 | lame_set_num_channels(lame, 1);
28 | lame_set_mode(lame, MONO);
29 | lame_init_params(lame);
30 | }
31 |
32 | - (void)convertPcmToMp3:(AudioBuffer)pcmbuffer toPath:(NSString *)path{
33 | int pcmLength = pcmbuffer.mDataByteSize;
34 | short *bytes = (short *)pcmbuffer.mData;
35 | int nSamples = pcmLength/2;
36 | unsigned char mp3buffer[pcmLength];
37 |
38 | int recvLen = lame_encode_buffer(lame, bytes, NULL, nSamples, mp3buffer, pcmLength);
39 |
40 | FILE *file = fopen([path cStringUsingEncoding:NSASCIIStringEncoding], "a+");
41 |
42 | fwrite(mp3buffer, recvLen, 1, file);
43 | fclose(file);
44 | }
45 |
46 | - (void)converWav:(NSString *)wavPath toMp3:(NSString *)mp3Path successBlock:(successBlock)block{
47 |
48 | @try {
49 | FILE *fwav = fopen([wavPath cStringUsingEncoding:NSASCIIStringEncoding], "rb");
50 | fseek(fwav, 1024*4, SEEK_CUR); //跳过源文件的信息头,不然在开头会有爆破音
51 | FILE *fmp3 = fopen([mp3Path cStringUsingEncoding:NSASCIIStringEncoding], "wb");
52 |
53 | lame = lame_init();
54 | lame_set_in_samplerate(lame, 44100.0); //设置wav的采样率
55 | lame_set_num_channels(lame, 2); //声道,不设置默认为双声道
56 | // lame_set_mode(lame, 0);
57 | lame_init_params(lame);
58 |
59 | const int PCM_SIZE = 640 * 2; //双声道*2 单声道640即可
60 | const int MP3_SIZE = 8800; //计算公式wav_buffer.length * 1.25 + 7200
61 | short int pcm_buffer[PCM_SIZE];
62 | unsigned char mp3_buffer[MP3_SIZE];
63 |
64 | int read, write;
65 |
66 | do {
67 | read = fread(pcm_buffer, sizeof(short int), PCM_SIZE, fwav);
68 | if (read == 0) {
69 | write = lame_encode_flush(lame, mp3_buffer, MP3_SIZE);
70 | } else {
71 | // write = lame_encode_buffer(lame, pcm_buffer, pcm_buffer, read, mp3_buffer, MP3_SIZE);
72 | write = lame_encode_buffer_interleaved(lame, pcm_buffer, read/2, mp3_buffer, MP3_SIZE);
73 | // write = lame_encode_buffer_float(lame, pcm_buffer, pcm_buffer, read/2, mp3_buffer, MP3_SIZE);
74 | }
75 | fwrite(mp3_buffer, write, 1, fmp3);
76 | } while (read != 0);
77 | lame_close(lame);
78 | fclose(fmp3);
79 | fclose(fwav);
80 | } @catch (NSException *exception) {
81 | NSLog(@"catch exception");
82 | } @finally {
83 | block();
84 | }
85 |
86 |
87 | }
88 |
89 | - (void)dealloc {
90 | lame_close(lame);
91 | }
92 |
93 | @end
94 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "RecordTool.h"
11 | #import
12 | #import "WavToMp3Controller.h"
13 | @interface ViewController ()
14 | {
15 | RecordTool *recorder;
16 | BOOL isRecording;
17 |
18 | AVAudioPlayer *player;
19 | BOOL isPlaying;
20 | }
21 | @property (weak, nonatomic) IBOutlet UILabel *inputLabel;
22 | @property (weak, nonatomic) IBOutlet UIButton *playBtn;
23 | @end
24 |
25 | @implementation ViewController
26 |
27 | - (void)viewDidLoad {
28 | [super viewDidLoad];
29 | // Do any additional setup after loading the view, typically from a nib.
30 |
31 | isRecording = false;
32 | recorder = [[RecordTool alloc] init];
33 |
34 | isPlaying = false;
35 |
36 | /** 2.判断当前的输出源 */
37 | [self routeChange:nil];
38 | [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(routeChange:)
39 | name:AVAudioSessionRouteChangeNotification
40 | object:[AVAudioSession sharedInstance]];
41 |
42 |
43 | }
44 |
45 | - (void)routeChange:(NSNotification*)notify{
46 | AVAudioSessionRouteDescription *route = [[AVAudioSession sharedInstance]currentRoute];
47 | for (AVAudioSessionPortDescription *s in [route inputs]) {
48 | NSLog(@"输入:%@",[s portName]);
49 | dispatch_async(dispatch_get_main_queue(), ^{
50 | _inputLabel.text = [[NSString alloc] initWithFormat:@"输入:%@",[s portName]];
51 | });
52 | }
53 | }
54 | - (IBAction)start:(UIButton *)sender {
55 | isRecording = !isRecording;
56 | if (isRecording) {
57 | [sender setTitle:@"Stop Record" forState:UIControlStateNormal];
58 | [recorder start];
59 | } else {
60 | [sender setTitle:@"Start Record" forState:UIControlStateNormal];
61 | [recorder stop];
62 | }
63 | }
64 | - (IBAction)play:(UIButton *)sender {
65 | if (isRecording) {
66 | NSLog(@"couldn't play while recording..");
67 | return;
68 | }
69 |
70 | if (!isPlaying) {
71 | NSString *path = [[NSString alloc] initWithFormat:@"%@/Documents/test.mp3",NSHomeDirectory()];
72 | NSURL *url = [NSURL URLWithString:path];
73 | NSError *error;
74 | player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
75 | player.delegate = self;
76 | if (error != NULL) {
77 | NSLog(@"error:%@",error);
78 | } else {
79 | [player play];
80 | isPlaying = true;
81 | [sender setTitle:@"Stop" forState:UIControlStateNormal];
82 | }
83 | } else {
84 | [player stop];
85 | isPlaying = false;
86 | [sender setTitle:@"Start" forState:UIControlStateNormal];
87 | }
88 | }
89 |
90 | - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
91 | [_playBtn setTitle:@"Start" forState:UIControlStateNormal];
92 | isPlaying = false;
93 | }
94 |
95 | - (IBAction)presentVC {
96 | WavToMp3Controller *vc = [[WavToMp3Controller alloc] init];
97 | [self presentViewController:vc animated:YES completion:NULL];
98 | }
99 |
100 |
101 | - (void)didReceiveMemoryWarning {
102 | [super didReceiveMemoryWarning];
103 | // Dispose of any resources that can be recreated.
104 | }
105 |
106 |
107 | @end
108 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/WavToMp3Controller.m:
--------------------------------------------------------------------------------
1 | //
2 | // WavToMp3Controller.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2017/11/1.
6 | // Copyright © 2017年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import "WavToMp3Controller.h"
10 | #import "LameConver.h"
11 | #import
12 | @interface WavToMp3Controller ()
13 |
14 | @property (nonatomic, strong) AVAudioPlayer *player;
15 | @property (nonatomic, assign) BOOL isPlaying;
16 |
17 | @property (nonatomic, strong) UITableView *tableView;
18 | @property (nonatomic, strong) NSMutableArray *fileArray;
19 |
20 | @property (nonatomic, copy) NSString *wavPath;
21 | @property (nonatomic, copy) NSString *mp3Path;
22 |
23 | @end
24 |
25 | @implementation WavToMp3Controller
26 |
27 | - (void)viewDidLoad {
28 | [super viewDidLoad];
29 |
30 | _isPlaying = NO;
31 |
32 | [self loadFile];
33 |
34 | [self setupUI];
35 | }
36 |
37 | - (void)loadFile {
38 | _wavPath = [[NSBundle mainBundle] pathForResource:@"test_wav" ofType:@"wav"];
39 | _mp3Path = [[NSString alloc] initWithFormat:@"%@/Documents/wav_to_mp3.mp3",NSHomeDirectory()];
40 |
41 | _fileArray = [[NSMutableArray alloc] init];
42 | [_fileArray addObject:@"test_wav.wav"];
43 | }
44 |
45 | - (void)setupUI {
46 | self.navigationItem.title = @"WavToMp3";
47 | self.view.backgroundColor = [UIColor whiteColor];
48 |
49 | UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeSystem];
50 | backBtn.frame = CGRectMake(8, 20, 100, 50);
51 | [backBtn setTitle:@"Back" forState:UIControlStateNormal];
52 | [backBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
53 | [self.view addSubview:backBtn];
54 |
55 | CGSize screenSize = [UIApplication sharedApplication].keyWindow.screen.bounds.size;
56 | _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(backBtn.frame), screenSize.width, screenSize.height) style:UITableViewStylePlain];
57 | _tableView.delegate = self;
58 | _tableView.dataSource = self;
59 | [self.view addSubview:_tableView];
60 |
61 | UILabel *head = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, screenSize.width, 100)];
62 | head.text = @"点击WAV文件转换为MP3,点击MP3文件开始播放";
63 | head.numberOfLines = 0;
64 | _tableView.tableHeaderView = head;
65 | }
66 |
67 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
68 | return _fileArray.count;
69 | }
70 |
71 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
72 | UITableViewCell *cell = [[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 300, 60)];
73 | cell.textLabel.text = _fileArray[indexPath.row];
74 | return cell;
75 | }
76 |
77 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
78 | if (indexPath.row == 0) {
79 | LameConver *conver = [[LameConver alloc] init];
80 | [conver converWav:_wavPath toMp3:_mp3Path successBlock:^{
81 | NSLog(@"转码成功");
82 | [_fileArray addObject:@"wav_to_mp3.mp3"];
83 |
84 | dispatch_async(dispatch_get_main_queue(), ^{
85 | [_tableView reloadData];
86 | });
87 | }];
88 | } else if (indexPath.row == 1){
89 | [self playMp3];
90 | }
91 | }
92 |
93 | - (void)dismiss {
94 | if (_isPlaying) {
95 | [_player stop];
96 | }
97 | [self dismissViewControllerAnimated:YES completion:NULL];
98 | }
99 |
100 | - (void)playMp3 {
101 | // if (_isPlaying) {
102 | // NSLog(@"播放中...");
103 | // return;
104 | // }
105 |
106 | NSURL *url = [NSURL URLWithString:_mp3Path];
107 | NSError *error;
108 | _player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
109 | if (!error) {
110 | [_player play];
111 | _isPlaying = true;
112 | } else {
113 |
114 | }
115 | }
116 |
117 | - (void)didReceiveMemoryWarning {
118 | [super didReceiveMemoryWarning];
119 | }
120 |
121 | @end
122 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo.xcodeproj/xcuserdata/JIANHUI.xcuserdatad/xcschemes/RemoteIODemo.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
39 |
45 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/RecordTool.m:
--------------------------------------------------------------------------------
1 | //
2 | // RecordTool.m
3 | // RemoteIODemo
4 | //
5 | // Created by JIANHUI on 2016/11/18.
6 | // Copyright © 2016年 HaiLife. All rights reserved.
7 | //
8 |
9 | #import "RecordTool.h"
10 | #import "LameConver.h"
11 |
12 | #define kInputBus 1
13 | #define kOutputBus 0
14 | @interface RecordTool()
15 | {
16 | AVAudioSession *audioSession;
17 | AUGraph auGraph;
18 | AudioUnit remoteIOUnit;
19 | AUNode remoteIONode;
20 | AURenderCallbackStruct inputProc;
21 | NSMutableData *mData;
22 |
23 | LameConver *cover;
24 | NSString *outPath;
25 | AVPlayer *player;
26 | }
27 | @end
28 |
29 | @implementation RecordTool
30 |
31 | static OSStatus CallBack(
32 | void *inRefCon,
33 | AudioUnitRenderActionFlags *ioActionFlags,
34 | const AudioTimeStamp *inTimeStamp,
35 | UInt32 inBusNumber,
36 | UInt32 inNumberFrames,
37 | AudioBufferList *ioData)
38 | {
39 | RecordTool *THIS=(__bridge RecordTool*)inRefCon;
40 | OSStatus renderErr = AudioUnitRender(THIS->remoteIOUnit, ioActionFlags,
41 | inTimeStamp, 1, inNumberFrames, ioData);
42 |
43 | [THIS->cover convertPcmToMp3:ioData->mBuffers[0] toPath:THIS->outPath];
44 | [THIS.delegate gotData:ioData->mBuffers[0]];
45 | return renderErr;
46 | }
47 |
48 | - (instancetype)init
49 | {
50 | self = [super init];
51 | if (self) {
52 | [self initRemoteIO];
53 | [self initLame];
54 | }
55 | return self;
56 | }
57 |
58 | - (void)initLame {
59 | cover = [[LameConver alloc] init];
60 | outPath = [[NSString alloc] initWithFormat:@"%@/Documents/test.mp3",NSHomeDirectory()];
61 | }
62 |
63 | - (void)initRemoteIO
64 | {
65 | audioSession = [AVAudioSession sharedInstance];
66 |
67 | NSError *error;
68 | // set Category for Play and Record
69 | [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
70 | [audioSession setPreferredSampleRate:(double)44100.0 error:&error];
71 | [audioSession setPreferredInputNumberOfChannels:1 error:&error];
72 |
73 | //init RemoteIO
74 | CheckError(NewAUGraph(&auGraph),"couldn't NewAUGraph");
75 | CheckError(AUGraphOpen(auGraph),"couldn't AUGraphOpen");
76 |
77 | AudioComponentDescription componentDesc;
78 | componentDesc.componentType = kAudioUnitType_Output;
79 | componentDesc.componentSubType = kAudioUnitSubType_RemoteIO;
80 | componentDesc.componentManufacturer = kAudioUnitManufacturer_Apple;
81 | componentDesc.componentFlags = 0;
82 | componentDesc.componentFlagsMask = 0;
83 |
84 | CheckError (AUGraphAddNode(auGraph,&componentDesc,&remoteIONode),"couldn't add remote io node");
85 | CheckError(AUGraphNodeInfo(auGraph,remoteIONode,NULL,&remoteIOUnit),"couldn't get remote io unit from node");
86 |
87 | //set BUS
88 | UInt32 oneFlag = 1;
89 | CheckError(AudioUnitSetProperty(remoteIOUnit,
90 | kAudioOutputUnitProperty_EnableIO,
91 | kAudioUnitScope_Output,
92 | kOutputBus,
93 | &oneFlag,
94 | sizeof(oneFlag)),"couldn't kAudioOutputUnitProperty_EnableIO with kAudioUnitScope_Output");
95 |
96 | CheckError(AudioUnitSetProperty(remoteIOUnit,
97 | kAudioOutputUnitProperty_EnableIO,
98 | kAudioUnitScope_Input,
99 | kInputBus,
100 | &oneFlag,
101 | sizeof(oneFlag)),"couldn't kAudioOutputUnitProperty_EnableIO with kAudioUnitScope_Input");
102 |
103 | AudioStreamBasicDescription mAudioFormat;
104 | mAudioFormat.mSampleRate = 44100.0;//采样率
105 | mAudioFormat.mFormatID = kAudioFormatLinearPCM;//PCM采样
106 | mAudioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
107 | mAudioFormat.mFramesPerPacket = 1;//每个数据包多少帧
108 | mAudioFormat.mChannelsPerFrame = 1;//1单声道,2立体声
109 | mAudioFormat.mBitsPerChannel = 16;//语音每采样点占用位数
110 | mAudioFormat.mBytesPerFrame = mAudioFormat.mBitsPerChannel*mAudioFormat.mChannelsPerFrame/8;//每帧的bytes数
111 | mAudioFormat.mBytesPerPacket = mAudioFormat.mBytesPerFrame*mAudioFormat.mFramesPerPacket;//每个数据包的bytes总数,每帧的bytes数*每个数据包的帧数
112 | mAudioFormat.mReserved = 0;
113 | UInt32 size = sizeof(mAudioFormat);
114 |
115 | CheckError(AudioUnitSetProperty(remoteIOUnit,
116 | kAudioUnitProperty_StreamFormat,
117 | kAudioUnitScope_Output,
118 | 1,
119 | &mAudioFormat,
120 | size),"couldn't set kAudioUnitProperty_StreamFormat with kAudioUnitScope_Output");
121 |
122 | CheckError(AudioUnitSetProperty(remoteIOUnit,
123 | kAudioUnitProperty_StreamFormat,
124 | kAudioUnitScope_Input,
125 | 0,
126 | &mAudioFormat,
127 | size),"couldn't set kAudioUnitProperty_StreamFormat with kAudioUnitScope_Input");
128 |
129 | inputProc.inputProc = CallBack;
130 | inputProc.inputProcRefCon = (__bridge void *)(self);
131 | CheckError(AUGraphSetNodeInputCallback(auGraph, remoteIONode, 0, &inputProc),"Error setting io output callback");
132 |
133 | CheckError(AUGraphInitialize(auGraph),"couldn't AUGraphInitialize" );
134 | CheckError(AUGraphUpdate(auGraph, NULL),"couldn't AUGraphUpdate" );
135 | }
136 |
137 | - (void)start {
138 | NSFileManager *fileMgr = [NSFileManager defaultManager];
139 | NSError *error;
140 | if ([fileMgr fileExistsAtPath:outPath]) {
141 | [fileMgr removeItemAtPath:outPath error:&error];
142 | NSLog(@"删除mp3文件");
143 | }
144 |
145 | CheckError(AUGraphStart(auGraph),"couldn't AUGraphStart");
146 | CAShow(auGraph);
147 | }
148 |
149 | - (void)stop {
150 | CheckError(AUGraphStop(auGraph), "couldn't AUGraphStop");
151 | }
152 |
153 | static void CheckError(OSStatus error, const char *operation)
154 | {
155 | if (error == noErr) return;
156 | char str[20];
157 | // see if it appears to be a 4-char-code
158 | *(UInt32 *)(str + 1) = CFSwapInt32HostToBig(error);
159 | if (isprint(str[1]) && isprint(str[2]) && isprint(str[3]) && isprint(str[4])) {
160 | str[0] = str[5] = '\'';
161 | str[6] = '\0';
162 | } else
163 | // no, format it as an integer
164 | sprintf(str, "%d", (int)error);
165 |
166 | fprintf(stderr, "Error: %s (%s)\n", operation, str);
167 | exit(1);
168 |
169 | }
170 |
171 | @end
172 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | D48C898E1DDEE0990012898E /* RecordTool.m in Sources */ = {isa = PBXBuildFile; fileRef = D48C898D1DDEE0990012898E /* RecordTool.m */; };
11 | D48C89911DDEEF3A0012898E /* libmp3lame.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D48C89901DDEEF3A0012898E /* libmp3lame.a */; };
12 | D48C89941DDEEF4C0012898E /* LameConver.m in Sources */ = {isa = PBXBuildFile; fileRef = D48C89931DDEEF4C0012898E /* LameConver.m */; };
13 | D4A60BC21DDEDF9D00476D42 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4A60BC11DDEDF9D00476D42 /* main.m */; };
14 | D4A60BC51DDEDF9D00476D42 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D4A60BC41DDEDF9D00476D42 /* AppDelegate.m */; };
15 | D4A60BC81DDEDF9D00476D42 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4A60BC71DDEDF9D00476D42 /* ViewController.m */; };
16 | D4A60BCB1DDEDF9D00476D42 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D4A60BC91DDEDF9D00476D42 /* Main.storyboard */; };
17 | D4A60BCD1DDEDF9D00476D42 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D4A60BCC1DDEDF9D00476D42 /* Assets.xcassets */; };
18 | D4A60BD01DDEDF9D00476D42 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D4A60BCE1DDEDF9D00476D42 /* LaunchScreen.storyboard */; };
19 | D4A60BDB1DDEDF9D00476D42 /* RemoteIODemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D4A60BDA1DDEDF9D00476D42 /* RemoteIODemoTests.m */; };
20 | D4A60BE61DDEDF9D00476D42 /* RemoteIODemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = D4A60BE51DDEDF9D00476D42 /* RemoteIODemoUITests.m */; };
21 | D4BD6DC81FA9552500C33863 /* test_wav.wav in Resources */ = {isa = PBXBuildFile; fileRef = D4BD6DC71FA9552500C33863 /* test_wav.wav */; };
22 | D4BD6DCB1FA9556B00C33863 /* WavToMp3Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = D4BD6DCA1FA9556B00C33863 /* WavToMp3Controller.m */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | D4A60BD71DDEDF9D00476D42 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = D4A60BB51DDEDF9D00476D42 /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = D4A60BBC1DDEDF9D00476D42;
31 | remoteInfo = RemoteIODemo;
32 | };
33 | D4A60BE21DDEDF9D00476D42 /* PBXContainerItemProxy */ = {
34 | isa = PBXContainerItemProxy;
35 | containerPortal = D4A60BB51DDEDF9D00476D42 /* Project object */;
36 | proxyType = 1;
37 | remoteGlobalIDString = D4A60BBC1DDEDF9D00476D42;
38 | remoteInfo = RemoteIODemo;
39 | };
40 | /* End PBXContainerItemProxy section */
41 |
42 | /* Begin PBXFileReference section */
43 | D48C898C1DDEE0990012898E /* RecordTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordTool.h; sourceTree = ""; };
44 | D48C898D1DDEE0990012898E /* RecordTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecordTool.m; sourceTree = ""; };
45 | D48C898F1DDEEF3A0012898E /* lame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lame.h; sourceTree = ""; };
46 | D48C89901DDEEF3A0012898E /* libmp3lame.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libmp3lame.a; sourceTree = ""; };
47 | D48C89921DDEEF4C0012898E /* LameConver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LameConver.h; sourceTree = ""; };
48 | D48C89931DDEEF4C0012898E /* LameConver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LameConver.m; sourceTree = ""; };
49 | D4A60BBD1DDEDF9D00476D42 /* RemoteIODemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RemoteIODemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
50 | D4A60BC11DDEDF9D00476D42 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
51 | D4A60BC31DDEDF9D00476D42 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
52 | D4A60BC41DDEDF9D00476D42 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
53 | D4A60BC61DDEDF9D00476D42 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
54 | D4A60BC71DDEDF9D00476D42 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
55 | D4A60BCA1DDEDF9D00476D42 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | D4A60BCC1DDEDF9D00476D42 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | D4A60BCF1DDEDF9D00476D42 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | D4A60BD11DDEDF9D00476D42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | D4A60BD61DDEDF9D00476D42 /* RemoteIODemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RemoteIODemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
60 | D4A60BDA1DDEDF9D00476D42 /* RemoteIODemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RemoteIODemoTests.m; sourceTree = ""; };
61 | D4A60BDC1DDEDF9D00476D42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
62 | D4A60BE11DDEDF9D00476D42 /* RemoteIODemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RemoteIODemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
63 | D4A60BE51DDEDF9D00476D42 /* RemoteIODemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RemoteIODemoUITests.m; sourceTree = ""; };
64 | D4A60BE71DDEDF9D00476D42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
65 | D4BD6DC71FA9552500C33863 /* test_wav.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = test_wav.wav; sourceTree = ""; };
66 | D4BD6DC91FA9556B00C33863 /* WavToMp3Controller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WavToMp3Controller.h; sourceTree = ""; };
67 | D4BD6DCA1FA9556B00C33863 /* WavToMp3Controller.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WavToMp3Controller.m; sourceTree = ""; };
68 | /* End PBXFileReference section */
69 |
70 | /* Begin PBXFrameworksBuildPhase section */
71 | D4A60BBA1DDEDF9D00476D42 /* Frameworks */ = {
72 | isa = PBXFrameworksBuildPhase;
73 | buildActionMask = 2147483647;
74 | files = (
75 | D48C89911DDEEF3A0012898E /* libmp3lame.a in Frameworks */,
76 | );
77 | runOnlyForDeploymentPostprocessing = 0;
78 | };
79 | D4A60BD31DDEDF9D00476D42 /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | );
84 | runOnlyForDeploymentPostprocessing = 0;
85 | };
86 | D4A60BDE1DDEDF9D00476D42 /* Frameworks */ = {
87 | isa = PBXFrameworksBuildPhase;
88 | buildActionMask = 2147483647;
89 | files = (
90 | );
91 | runOnlyForDeploymentPostprocessing = 0;
92 | };
93 | /* End PBXFrameworksBuildPhase section */
94 |
95 | /* Begin PBXGroup section */
96 | D4A60BB41DDEDF9D00476D42 = {
97 | isa = PBXGroup;
98 | children = (
99 | D4A60BBF1DDEDF9D00476D42 /* RemoteIODemo */,
100 | D4A60BD91DDEDF9D00476D42 /* RemoteIODemoTests */,
101 | D4A60BE41DDEDF9D00476D42 /* RemoteIODemoUITests */,
102 | D4A60BBE1DDEDF9D00476D42 /* Products */,
103 | );
104 | sourceTree = "";
105 | };
106 | D4A60BBE1DDEDF9D00476D42 /* Products */ = {
107 | isa = PBXGroup;
108 | children = (
109 | D4A60BBD1DDEDF9D00476D42 /* RemoteIODemo.app */,
110 | D4A60BD61DDEDF9D00476D42 /* RemoteIODemoTests.xctest */,
111 | D4A60BE11DDEDF9D00476D42 /* RemoteIODemoUITests.xctest */,
112 | );
113 | name = Products;
114 | sourceTree = "";
115 | };
116 | D4A60BBF1DDEDF9D00476D42 /* RemoteIODemo */ = {
117 | isa = PBXGroup;
118 | children = (
119 | D4BD6DC71FA9552500C33863 /* test_wav.wav */,
120 | D48C898F1DDEEF3A0012898E /* lame.h */,
121 | D48C89901DDEEF3A0012898E /* libmp3lame.a */,
122 | D4BD6DC91FA9556B00C33863 /* WavToMp3Controller.h */,
123 | D4BD6DCA1FA9556B00C33863 /* WavToMp3Controller.m */,
124 | D48C89921DDEEF4C0012898E /* LameConver.h */,
125 | D48C89931DDEEF4C0012898E /* LameConver.m */,
126 | D48C898C1DDEE0990012898E /* RecordTool.h */,
127 | D48C898D1DDEE0990012898E /* RecordTool.m */,
128 | D4A60BC31DDEDF9D00476D42 /* AppDelegate.h */,
129 | D4A60BC41DDEDF9D00476D42 /* AppDelegate.m */,
130 | D4A60BC61DDEDF9D00476D42 /* ViewController.h */,
131 | D4A60BC71DDEDF9D00476D42 /* ViewController.m */,
132 | D4A60BC91DDEDF9D00476D42 /* Main.storyboard */,
133 | D4A60BCC1DDEDF9D00476D42 /* Assets.xcassets */,
134 | D4A60BCE1DDEDF9D00476D42 /* LaunchScreen.storyboard */,
135 | D4A60BD11DDEDF9D00476D42 /* Info.plist */,
136 | D4A60BC01DDEDF9D00476D42 /* Supporting Files */,
137 | );
138 | path = RemoteIODemo;
139 | sourceTree = "";
140 | };
141 | D4A60BC01DDEDF9D00476D42 /* Supporting Files */ = {
142 | isa = PBXGroup;
143 | children = (
144 | D4A60BC11DDEDF9D00476D42 /* main.m */,
145 | );
146 | name = "Supporting Files";
147 | sourceTree = "";
148 | };
149 | D4A60BD91DDEDF9D00476D42 /* RemoteIODemoTests */ = {
150 | isa = PBXGroup;
151 | children = (
152 | D4A60BDA1DDEDF9D00476D42 /* RemoteIODemoTests.m */,
153 | D4A60BDC1DDEDF9D00476D42 /* Info.plist */,
154 | );
155 | path = RemoteIODemoTests;
156 | sourceTree = "";
157 | };
158 | D4A60BE41DDEDF9D00476D42 /* RemoteIODemoUITests */ = {
159 | isa = PBXGroup;
160 | children = (
161 | D4A60BE51DDEDF9D00476D42 /* RemoteIODemoUITests.m */,
162 | D4A60BE71DDEDF9D00476D42 /* Info.plist */,
163 | );
164 | path = RemoteIODemoUITests;
165 | sourceTree = "";
166 | };
167 | /* End PBXGroup section */
168 |
169 | /* Begin PBXNativeTarget section */
170 | D4A60BBC1DDEDF9D00476D42 /* RemoteIODemo */ = {
171 | isa = PBXNativeTarget;
172 | buildConfigurationList = D4A60BEA1DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemo" */;
173 | buildPhases = (
174 | D4A60BB91DDEDF9D00476D42 /* Sources */,
175 | D4A60BBA1DDEDF9D00476D42 /* Frameworks */,
176 | D4A60BBB1DDEDF9D00476D42 /* Resources */,
177 | );
178 | buildRules = (
179 | );
180 | dependencies = (
181 | );
182 | name = RemoteIODemo;
183 | productName = RemoteIODemo;
184 | productReference = D4A60BBD1DDEDF9D00476D42 /* RemoteIODemo.app */;
185 | productType = "com.apple.product-type.application";
186 | };
187 | D4A60BD51DDEDF9D00476D42 /* RemoteIODemoTests */ = {
188 | isa = PBXNativeTarget;
189 | buildConfigurationList = D4A60BED1DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemoTests" */;
190 | buildPhases = (
191 | D4A60BD21DDEDF9D00476D42 /* Sources */,
192 | D4A60BD31DDEDF9D00476D42 /* Frameworks */,
193 | D4A60BD41DDEDF9D00476D42 /* Resources */,
194 | );
195 | buildRules = (
196 | );
197 | dependencies = (
198 | D4A60BD81DDEDF9D00476D42 /* PBXTargetDependency */,
199 | );
200 | name = RemoteIODemoTests;
201 | productName = RemoteIODemoTests;
202 | productReference = D4A60BD61DDEDF9D00476D42 /* RemoteIODemoTests.xctest */;
203 | productType = "com.apple.product-type.bundle.unit-test";
204 | };
205 | D4A60BE01DDEDF9D00476D42 /* RemoteIODemoUITests */ = {
206 | isa = PBXNativeTarget;
207 | buildConfigurationList = D4A60BF01DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemoUITests" */;
208 | buildPhases = (
209 | D4A60BDD1DDEDF9D00476D42 /* Sources */,
210 | D4A60BDE1DDEDF9D00476D42 /* Frameworks */,
211 | D4A60BDF1DDEDF9D00476D42 /* Resources */,
212 | );
213 | buildRules = (
214 | );
215 | dependencies = (
216 | D4A60BE31DDEDF9D00476D42 /* PBXTargetDependency */,
217 | );
218 | name = RemoteIODemoUITests;
219 | productName = RemoteIODemoUITests;
220 | productReference = D4A60BE11DDEDF9D00476D42 /* RemoteIODemoUITests.xctest */;
221 | productType = "com.apple.product-type.bundle.ui-testing";
222 | };
223 | /* End PBXNativeTarget section */
224 |
225 | /* Begin PBXProject section */
226 | D4A60BB51DDEDF9D00476D42 /* Project object */ = {
227 | isa = PBXProject;
228 | attributes = {
229 | LastUpgradeCheck = 0810;
230 | ORGANIZATIONNAME = HaiLife;
231 | TargetAttributes = {
232 | D4A60BBC1DDEDF9D00476D42 = {
233 | CreatedOnToolsVersion = 8.1;
234 | DevelopmentTeam = DSGNEW3425;
235 | ProvisioningStyle = Automatic;
236 | };
237 | D4A60BD51DDEDF9D00476D42 = {
238 | CreatedOnToolsVersion = 8.1;
239 | DevelopmentTeam = LU7MAPSZU7;
240 | ProvisioningStyle = Automatic;
241 | TestTargetID = D4A60BBC1DDEDF9D00476D42;
242 | };
243 | D4A60BE01DDEDF9D00476D42 = {
244 | CreatedOnToolsVersion = 8.1;
245 | DevelopmentTeam = LU7MAPSZU7;
246 | ProvisioningStyle = Automatic;
247 | TestTargetID = D4A60BBC1DDEDF9D00476D42;
248 | };
249 | };
250 | };
251 | buildConfigurationList = D4A60BB81DDEDF9D00476D42 /* Build configuration list for PBXProject "RemoteIODemo" */;
252 | compatibilityVersion = "Xcode 3.2";
253 | developmentRegion = English;
254 | hasScannedForEncodings = 0;
255 | knownRegions = (
256 | en,
257 | Base,
258 | );
259 | mainGroup = D4A60BB41DDEDF9D00476D42;
260 | productRefGroup = D4A60BBE1DDEDF9D00476D42 /* Products */;
261 | projectDirPath = "";
262 | projectRoot = "";
263 | targets = (
264 | D4A60BBC1DDEDF9D00476D42 /* RemoteIODemo */,
265 | D4A60BD51DDEDF9D00476D42 /* RemoteIODemoTests */,
266 | D4A60BE01DDEDF9D00476D42 /* RemoteIODemoUITests */,
267 | );
268 | };
269 | /* End PBXProject section */
270 |
271 | /* Begin PBXResourcesBuildPhase section */
272 | D4A60BBB1DDEDF9D00476D42 /* Resources */ = {
273 | isa = PBXResourcesBuildPhase;
274 | buildActionMask = 2147483647;
275 | files = (
276 | D4A60BD01DDEDF9D00476D42 /* LaunchScreen.storyboard in Resources */,
277 | D4BD6DC81FA9552500C33863 /* test_wav.wav in Resources */,
278 | D4A60BCD1DDEDF9D00476D42 /* Assets.xcassets in Resources */,
279 | D4A60BCB1DDEDF9D00476D42 /* Main.storyboard in Resources */,
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | };
283 | D4A60BD41DDEDF9D00476D42 /* Resources */ = {
284 | isa = PBXResourcesBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | runOnlyForDeploymentPostprocessing = 0;
289 | };
290 | D4A60BDF1DDEDF9D00476D42 /* Resources */ = {
291 | isa = PBXResourcesBuildPhase;
292 | buildActionMask = 2147483647;
293 | files = (
294 | );
295 | runOnlyForDeploymentPostprocessing = 0;
296 | };
297 | /* End PBXResourcesBuildPhase section */
298 |
299 | /* Begin PBXSourcesBuildPhase section */
300 | D4A60BB91DDEDF9D00476D42 /* Sources */ = {
301 | isa = PBXSourcesBuildPhase;
302 | buildActionMask = 2147483647;
303 | files = (
304 | D48C898E1DDEE0990012898E /* RecordTool.m in Sources */,
305 | D4A60BC81DDEDF9D00476D42 /* ViewController.m in Sources */,
306 | D4BD6DCB1FA9556B00C33863 /* WavToMp3Controller.m in Sources */,
307 | D48C89941DDEEF4C0012898E /* LameConver.m in Sources */,
308 | D4A60BC51DDEDF9D00476D42 /* AppDelegate.m in Sources */,
309 | D4A60BC21DDEDF9D00476D42 /* main.m in Sources */,
310 | );
311 | runOnlyForDeploymentPostprocessing = 0;
312 | };
313 | D4A60BD21DDEDF9D00476D42 /* Sources */ = {
314 | isa = PBXSourcesBuildPhase;
315 | buildActionMask = 2147483647;
316 | files = (
317 | D4A60BDB1DDEDF9D00476D42 /* RemoteIODemoTests.m in Sources */,
318 | );
319 | runOnlyForDeploymentPostprocessing = 0;
320 | };
321 | D4A60BDD1DDEDF9D00476D42 /* Sources */ = {
322 | isa = PBXSourcesBuildPhase;
323 | buildActionMask = 2147483647;
324 | files = (
325 | D4A60BE61DDEDF9D00476D42 /* RemoteIODemoUITests.m in Sources */,
326 | );
327 | runOnlyForDeploymentPostprocessing = 0;
328 | };
329 | /* End PBXSourcesBuildPhase section */
330 |
331 | /* Begin PBXTargetDependency section */
332 | D4A60BD81DDEDF9D00476D42 /* PBXTargetDependency */ = {
333 | isa = PBXTargetDependency;
334 | target = D4A60BBC1DDEDF9D00476D42 /* RemoteIODemo */;
335 | targetProxy = D4A60BD71DDEDF9D00476D42 /* PBXContainerItemProxy */;
336 | };
337 | D4A60BE31DDEDF9D00476D42 /* PBXTargetDependency */ = {
338 | isa = PBXTargetDependency;
339 | target = D4A60BBC1DDEDF9D00476D42 /* RemoteIODemo */;
340 | targetProxy = D4A60BE21DDEDF9D00476D42 /* PBXContainerItemProxy */;
341 | };
342 | /* End PBXTargetDependency section */
343 |
344 | /* Begin PBXVariantGroup section */
345 | D4A60BC91DDEDF9D00476D42 /* Main.storyboard */ = {
346 | isa = PBXVariantGroup;
347 | children = (
348 | D4A60BCA1DDEDF9D00476D42 /* Base */,
349 | );
350 | name = Main.storyboard;
351 | sourceTree = "";
352 | };
353 | D4A60BCE1DDEDF9D00476D42 /* LaunchScreen.storyboard */ = {
354 | isa = PBXVariantGroup;
355 | children = (
356 | D4A60BCF1DDEDF9D00476D42 /* Base */,
357 | );
358 | name = LaunchScreen.storyboard;
359 | sourceTree = "";
360 | };
361 | /* End PBXVariantGroup section */
362 |
363 | /* Begin XCBuildConfiguration section */
364 | D4A60BE81DDEDF9D00476D42 /* Debug */ = {
365 | isa = XCBuildConfiguration;
366 | buildSettings = {
367 | ALWAYS_SEARCH_USER_PATHS = NO;
368 | CLANG_ANALYZER_NONNULL = YES;
369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
370 | CLANG_CXX_LIBRARY = "libc++";
371 | CLANG_ENABLE_MODULES = YES;
372 | CLANG_ENABLE_OBJC_ARC = YES;
373 | CLANG_WARN_BOOL_CONVERSION = YES;
374 | CLANG_WARN_CONSTANT_CONVERSION = YES;
375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
376 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
377 | CLANG_WARN_EMPTY_BODY = YES;
378 | CLANG_WARN_ENUM_CONVERSION = YES;
379 | CLANG_WARN_INFINITE_RECURSION = YES;
380 | CLANG_WARN_INT_CONVERSION = YES;
381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
382 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
383 | CLANG_WARN_UNREACHABLE_CODE = YES;
384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
386 | COPY_PHASE_STRIP = NO;
387 | DEBUG_INFORMATION_FORMAT = dwarf;
388 | ENABLE_STRICT_OBJC_MSGSEND = YES;
389 | ENABLE_TESTABILITY = YES;
390 | GCC_C_LANGUAGE_STANDARD = gnu99;
391 | GCC_DYNAMIC_NO_PIC = NO;
392 | GCC_NO_COMMON_BLOCKS = YES;
393 | GCC_OPTIMIZATION_LEVEL = 0;
394 | GCC_PREPROCESSOR_DEFINITIONS = (
395 | "DEBUG=1",
396 | "$(inherited)",
397 | );
398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
400 | GCC_WARN_UNDECLARED_SELECTOR = YES;
401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
402 | GCC_WARN_UNUSED_FUNCTION = YES;
403 | GCC_WARN_UNUSED_VARIABLE = YES;
404 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
405 | MTL_ENABLE_DEBUG_INFO = YES;
406 | ONLY_ACTIVE_ARCH = YES;
407 | SDKROOT = iphoneos;
408 | };
409 | name = Debug;
410 | };
411 | D4A60BE91DDEDF9D00476D42 /* Release */ = {
412 | isa = XCBuildConfiguration;
413 | buildSettings = {
414 | ALWAYS_SEARCH_USER_PATHS = NO;
415 | CLANG_ANALYZER_NONNULL = YES;
416 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
417 | CLANG_CXX_LIBRARY = "libc++";
418 | CLANG_ENABLE_MODULES = YES;
419 | CLANG_ENABLE_OBJC_ARC = YES;
420 | CLANG_WARN_BOOL_CONVERSION = YES;
421 | CLANG_WARN_CONSTANT_CONVERSION = YES;
422 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
423 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
424 | CLANG_WARN_EMPTY_BODY = YES;
425 | CLANG_WARN_ENUM_CONVERSION = YES;
426 | CLANG_WARN_INFINITE_RECURSION = YES;
427 | CLANG_WARN_INT_CONVERSION = YES;
428 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
429 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
430 | CLANG_WARN_UNREACHABLE_CODE = YES;
431 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
432 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
433 | COPY_PHASE_STRIP = NO;
434 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
435 | ENABLE_NS_ASSERTIONS = NO;
436 | ENABLE_STRICT_OBJC_MSGSEND = YES;
437 | GCC_C_LANGUAGE_STANDARD = gnu99;
438 | GCC_NO_COMMON_BLOCKS = YES;
439 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
440 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
441 | GCC_WARN_UNDECLARED_SELECTOR = YES;
442 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
443 | GCC_WARN_UNUSED_FUNCTION = YES;
444 | GCC_WARN_UNUSED_VARIABLE = YES;
445 | IPHONEOS_DEPLOYMENT_TARGET = 10.1;
446 | MTL_ENABLE_DEBUG_INFO = NO;
447 | SDKROOT = iphoneos;
448 | VALIDATE_PRODUCT = YES;
449 | };
450 | name = Release;
451 | };
452 | D4A60BEB1DDEDF9D00476D42 /* Debug */ = {
453 | isa = XCBuildConfiguration;
454 | buildSettings = {
455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
456 | DEVELOPMENT_TEAM = DSGNEW3425;
457 | ENABLE_BITCODE = NO;
458 | INFOPLIST_FILE = RemoteIODemo/Info.plist;
459 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
461 | LIBRARY_SEARCH_PATHS = (
462 | "$(inherited)",
463 | "$(PROJECT_DIR)/RemoteIODemo",
464 | );
465 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemo;
466 | PRODUCT_NAME = "$(TARGET_NAME)";
467 | };
468 | name = Debug;
469 | };
470 | D4A60BEC1DDEDF9D00476D42 /* Release */ = {
471 | isa = XCBuildConfiguration;
472 | buildSettings = {
473 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
474 | DEVELOPMENT_TEAM = DSGNEW3425;
475 | ENABLE_BITCODE = NO;
476 | INFOPLIST_FILE = RemoteIODemo/Info.plist;
477 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
479 | LIBRARY_SEARCH_PATHS = (
480 | "$(inherited)",
481 | "$(PROJECT_DIR)/RemoteIODemo",
482 | );
483 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemo;
484 | PRODUCT_NAME = "$(TARGET_NAME)";
485 | };
486 | name = Release;
487 | };
488 | D4A60BEE1DDEDF9D00476D42 /* Debug */ = {
489 | isa = XCBuildConfiguration;
490 | buildSettings = {
491 | BUNDLE_LOADER = "$(TEST_HOST)";
492 | DEVELOPMENT_TEAM = LU7MAPSZU7;
493 | INFOPLIST_FILE = RemoteIODemoTests/Info.plist;
494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
495 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemoTests;
496 | PRODUCT_NAME = "$(TARGET_NAME)";
497 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RemoteIODemo.app/RemoteIODemo";
498 | };
499 | name = Debug;
500 | };
501 | D4A60BEF1DDEDF9D00476D42 /* Release */ = {
502 | isa = XCBuildConfiguration;
503 | buildSettings = {
504 | BUNDLE_LOADER = "$(TEST_HOST)";
505 | DEVELOPMENT_TEAM = LU7MAPSZU7;
506 | INFOPLIST_FILE = RemoteIODemoTests/Info.plist;
507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
508 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemoTests;
509 | PRODUCT_NAME = "$(TARGET_NAME)";
510 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RemoteIODemo.app/RemoteIODemo";
511 | };
512 | name = Release;
513 | };
514 | D4A60BF11DDEDF9D00476D42 /* Debug */ = {
515 | isa = XCBuildConfiguration;
516 | buildSettings = {
517 | DEVELOPMENT_TEAM = LU7MAPSZU7;
518 | INFOPLIST_FILE = RemoteIODemoUITests/Info.plist;
519 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
520 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemoUITests;
521 | PRODUCT_NAME = "$(TARGET_NAME)";
522 | TEST_TARGET_NAME = RemoteIODemo;
523 | };
524 | name = Debug;
525 | };
526 | D4A60BF21DDEDF9D00476D42 /* Release */ = {
527 | isa = XCBuildConfiguration;
528 | buildSettings = {
529 | DEVELOPMENT_TEAM = LU7MAPSZU7;
530 | INFOPLIST_FILE = RemoteIODemoUITests/Info.plist;
531 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
532 | PRODUCT_BUNDLE_IDENTIFIER = com.hailife.RemoteIODemoUITests;
533 | PRODUCT_NAME = "$(TARGET_NAME)";
534 | TEST_TARGET_NAME = RemoteIODemo;
535 | };
536 | name = Release;
537 | };
538 | /* End XCBuildConfiguration section */
539 |
540 | /* Begin XCConfigurationList section */
541 | D4A60BB81DDEDF9D00476D42 /* Build configuration list for PBXProject "RemoteIODemo" */ = {
542 | isa = XCConfigurationList;
543 | buildConfigurations = (
544 | D4A60BE81DDEDF9D00476D42 /* Debug */,
545 | D4A60BE91DDEDF9D00476D42 /* Release */,
546 | );
547 | defaultConfigurationIsVisible = 0;
548 | defaultConfigurationName = Release;
549 | };
550 | D4A60BEA1DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemo" */ = {
551 | isa = XCConfigurationList;
552 | buildConfigurations = (
553 | D4A60BEB1DDEDF9D00476D42 /* Debug */,
554 | D4A60BEC1DDEDF9D00476D42 /* Release */,
555 | );
556 | defaultConfigurationIsVisible = 0;
557 | defaultConfigurationName = Release;
558 | };
559 | D4A60BED1DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemoTests" */ = {
560 | isa = XCConfigurationList;
561 | buildConfigurations = (
562 | D4A60BEE1DDEDF9D00476D42 /* Debug */,
563 | D4A60BEF1DDEDF9D00476D42 /* Release */,
564 | );
565 | defaultConfigurationIsVisible = 0;
566 | defaultConfigurationName = Release;
567 | };
568 | D4A60BF01DDEDF9D00476D42 /* Build configuration list for PBXNativeTarget "RemoteIODemoUITests" */ = {
569 | isa = XCConfigurationList;
570 | buildConfigurations = (
571 | D4A60BF11DDEDF9D00476D42 /* Debug */,
572 | D4A60BF21DDEDF9D00476D42 /* Release */,
573 | );
574 | defaultConfigurationIsVisible = 0;
575 | defaultConfigurationName = Release;
576 | };
577 | /* End XCConfigurationList section */
578 | };
579 | rootObject = D4A60BB51DDEDF9D00476D42 /* Project object */;
580 | }
581 |
--------------------------------------------------------------------------------
/RemoteIODemo/RemoteIODemo/lame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Interface to MP3 LAME encoding engine
3 | *
4 | * Copyright (c) 1999 Mark Taylor
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Library General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Library General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Library General Public
17 | * License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 | * Boston, MA 02111-1307, USA.
20 | */
21 |
22 | /* $Id: lame.h,v 1.189.2.1 2012/01/08 23:49:58 robert Exp $ */
23 |
24 | #ifndef LAME_LAME_H
25 | #define LAME_LAME_H
26 |
27 | /* for size_t typedef */
28 | #include
29 | /* for va_list typedef */
30 | #include
31 | /* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */
32 | #include
33 |
34 | #if defined(__cplusplus)
35 | extern "C" {
36 | #endif
37 |
38 | typedef void (*lame_report_function)(const char *format, va_list ap);
39 |
40 | #if defined(WIN32) || defined(_WIN32)
41 | #undef CDECL
42 | #define CDECL __cdecl
43 | #else
44 | #define CDECL
45 | #endif
46 |
47 | #define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1
48 |
49 | typedef enum vbr_mode_e {
50 | vbr_off=0,
51 | vbr_mt, /* obsolete, same as vbr_mtrh */
52 | vbr_rh,
53 | vbr_abr,
54 | vbr_mtrh,
55 | vbr_max_indicator, /* Don't use this! It's used for sanity checks. */
56 | vbr_default=vbr_mtrh /* change this to change the default VBR mode of LAME */
57 | } vbr_mode;
58 |
59 |
60 | /* MPEG modes */
61 | typedef enum MPEG_mode_e {
62 | STEREO = 0,
63 | JOINT_STEREO,
64 | DUAL_CHANNEL, /* LAME doesn't supports this! */
65 | MONO,
66 | NOT_SET,
67 | MAX_INDICATOR /* Don't use this! It's used for sanity checks. */
68 | } MPEG_mode;
69 |
70 | /* Padding types */
71 | typedef enum Padding_type_e {
72 | PAD_NO = 0,
73 | PAD_ALL,
74 | PAD_ADJUST,
75 | PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */
76 | } Padding_type;
77 |
78 |
79 |
80 | /*presets*/
81 | typedef enum preset_mode_e {
82 | /*values from 8 to 320 should be reserved for abr bitrates*/
83 | /*for abr I'd suggest to directly use the targeted bitrate as a value*/
84 | ABR_8 = 8,
85 | ABR_320 = 320,
86 |
87 | V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/
88 | VBR_10 = 410,
89 | V8 = 420,
90 | VBR_20 = 420,
91 | V7 = 430,
92 | VBR_30 = 430,
93 | V6 = 440,
94 | VBR_40 = 440,
95 | V5 = 450,
96 | VBR_50 = 450,
97 | V4 = 460,
98 | VBR_60 = 460,
99 | V3 = 470,
100 | VBR_70 = 470,
101 | V2 = 480,
102 | VBR_80 = 480,
103 | V1 = 490,
104 | VBR_90 = 490,
105 | V0 = 500,
106 | VBR_100 = 500,
107 |
108 | /*still there for compatibility*/
109 | R3MIX = 1000,
110 | STANDARD = 1001,
111 | EXTREME = 1002,
112 | INSANE = 1003,
113 | STANDARD_FAST = 1004,
114 | EXTREME_FAST = 1005,
115 | MEDIUM = 1006,
116 | MEDIUM_FAST = 1007
117 | } preset_mode;
118 |
119 |
120 | /*asm optimizations*/
121 | typedef enum asm_optimizations_e {
122 | MMX = 1,
123 | AMD_3DNOW = 2,
124 | SSE = 3
125 | } asm_optimizations;
126 |
127 |
128 | /* psychoacoustic model */
129 | typedef enum Psy_model_e {
130 | PSY_GPSYCHO = 1,
131 | PSY_NSPSYTUNE = 2
132 | } Psy_model;
133 |
134 |
135 | /* buffer considerations */
136 | typedef enum buffer_constraint_e {
137 | MDB_DEFAULT=0,
138 | MDB_STRICT_ISO=1,
139 | MDB_MAXIMUM=2
140 | } buffer_constraint;
141 |
142 |
143 | struct lame_global_struct;
144 | typedef struct lame_global_struct lame_global_flags;
145 | typedef lame_global_flags *lame_t;
146 |
147 |
148 |
149 |
150 | /***********************************************************************
151 | *
152 | * The LAME API
153 | * These functions should be called, in this order, for each
154 | * MP3 file to be encoded. See the file "API" for more documentation
155 | *
156 | ***********************************************************************/
157 |
158 |
159 | /*
160 | * REQUIRED:
161 | * initialize the encoder. sets default for all encoder parameters,
162 | * returns NULL if some malloc()'s failed
163 | * otherwise returns pointer to structure needed for all future
164 | * API calls.
165 | */
166 | lame_global_flags * CDECL lame_init(void);
167 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
168 | #else
169 | /* obsolete version */
170 | int CDECL lame_init_old(lame_global_flags *);
171 | #endif
172 |
173 | /*
174 | * OPTIONAL:
175 | * set as needed to override defaults
176 | */
177 |
178 | /********************************************************************
179 | * input stream description
180 | ***********************************************************************/
181 | /* number of samples. default = 2^32-1 */
182 | int CDECL lame_set_num_samples(lame_global_flags *, unsigned long);
183 | unsigned long CDECL lame_get_num_samples(const lame_global_flags *);
184 |
185 | /* input sample rate in Hz. default = 44100hz */
186 | int CDECL lame_set_in_samplerate(lame_global_flags *, int);
187 | int CDECL lame_get_in_samplerate(const lame_global_flags *);
188 |
189 | /* number of channels in input stream. default=2 */
190 | int CDECL lame_set_num_channels(lame_global_flags *, int);
191 | int CDECL lame_get_num_channels(const lame_global_flags *);
192 |
193 | /*
194 | scale the input by this amount before encoding. default=1
195 | (not used by decoding routines)
196 | */
197 | int CDECL lame_set_scale(lame_global_flags *, float);
198 | float CDECL lame_get_scale(const lame_global_flags *);
199 |
200 | /*
201 | scale the channel 0 (left) input by this amount before encoding. default=1
202 | (not used by decoding routines)
203 | */
204 | int CDECL lame_set_scale_left(lame_global_flags *, float);
205 | float CDECL lame_get_scale_left(const lame_global_flags *);
206 |
207 | /*
208 | scale the channel 1 (right) input by this amount before encoding. default=1
209 | (not used by decoding routines)
210 | */
211 | int CDECL lame_set_scale_right(lame_global_flags *, float);
212 | float CDECL lame_get_scale_right(const lame_global_flags *);
213 |
214 | /*
215 | output sample rate in Hz. default = 0, which means LAME picks best value
216 | based on the amount of compression. MPEG only allows:
217 | MPEG1 32, 44.1, 48khz
218 | MPEG2 16, 22.05, 24
219 | MPEG2.5 8, 11.025, 12
220 | (not used by decoding routines)
221 | */
222 | int CDECL lame_set_out_samplerate(lame_global_flags *, int);
223 | int CDECL lame_get_out_samplerate(const lame_global_flags *);
224 |
225 |
226 | /********************************************************************
227 | * general control parameters
228 | ***********************************************************************/
229 | /* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */
230 | int CDECL lame_set_analysis(lame_global_flags *, int);
231 | int CDECL lame_get_analysis(const lame_global_flags *);
232 |
233 | /*
234 | 1 = write a Xing VBR header frame.
235 | default = 1
236 | this variable must have been added by a Hungarian notation Windows programmer :-)
237 | */
238 | int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int);
239 | int CDECL lame_get_bWriteVbrTag(const lame_global_flags *);
240 |
241 | /* 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 */
242 | int CDECL lame_set_decode_only(lame_global_flags *, int);
243 | int CDECL lame_get_decode_only(const lame_global_flags *);
244 |
245 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
246 | #else
247 | /* 1=encode a Vorbis .ogg file. default=0 */
248 | /* DEPRECATED */
249 | int CDECL lame_set_ogg(lame_global_flags *, int);
250 | int CDECL lame_get_ogg(const lame_global_flags *);
251 | #endif
252 |
253 | /*
254 | internal algorithm selection. True quality is determined by the bitrate
255 | but this variable will effect quality by selecting expensive or cheap algorithms.
256 | quality=0..9. 0=best (very slow). 9=worst.
257 | recommended: 2 near-best quality, not too slow
258 | 5 good quality, fast
259 | 7 ok quality, really fast
260 | */
261 | int CDECL lame_set_quality(lame_global_flags *, int);
262 | int CDECL lame_get_quality(const lame_global_flags *);
263 |
264 | /*
265 | mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono
266 | default: lame picks based on compression ration and input channels
267 | */
268 | int CDECL lame_set_mode(lame_global_flags *, MPEG_mode);
269 | MPEG_mode CDECL lame_get_mode(const lame_global_flags *);
270 |
271 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
272 | #else
273 | /*
274 | mode_automs. Use a M/S mode with a switching threshold based on
275 | compression ratio
276 | DEPRECATED
277 | */
278 | int CDECL lame_set_mode_automs(lame_global_flags *, int);
279 | int CDECL lame_get_mode_automs(const lame_global_flags *);
280 | #endif
281 |
282 | /*
283 | force_ms. Force M/S for all frames. For testing only.
284 | default = 0 (disabled)
285 | */
286 | int CDECL lame_set_force_ms(lame_global_flags *, int);
287 | int CDECL lame_get_force_ms(const lame_global_flags *);
288 |
289 | /* use free_format? default = 0 (disabled) */
290 | int CDECL lame_set_free_format(lame_global_flags *, int);
291 | int CDECL lame_get_free_format(const lame_global_flags *);
292 |
293 | /* perform ReplayGain analysis? default = 0 (disabled) */
294 | int CDECL lame_set_findReplayGain(lame_global_flags *, int);
295 | int CDECL lame_get_findReplayGain(const lame_global_flags *);
296 |
297 | /* decode on the fly. Search for the peak sample. If the ReplayGain
298 | * analysis is enabled then perform the analysis on the decoded data
299 | * stream. default = 0 (disabled)
300 | * NOTE: if this option is set the build-in decoder should not be used */
301 | int CDECL lame_set_decode_on_the_fly(lame_global_flags *, int);
302 | int CDECL lame_get_decode_on_the_fly(const lame_global_flags *);
303 |
304 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
305 | #else
306 | /* DEPRECATED: now does the same as lame_set_findReplayGain()
307 | default = 0 (disabled) */
308 | int CDECL lame_set_ReplayGain_input(lame_global_flags *, int);
309 | int CDECL lame_get_ReplayGain_input(const lame_global_flags *);
310 |
311 | /* DEPRECATED: now does the same as
312 | lame_set_decode_on_the_fly() && lame_set_findReplayGain()
313 | default = 0 (disabled) */
314 | int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int);
315 | int CDECL lame_get_ReplayGain_decode(const lame_global_flags *);
316 |
317 | /* DEPRECATED: now does the same as lame_set_decode_on_the_fly()
318 | default = 0 (disabled) */
319 | int CDECL lame_set_findPeakSample(lame_global_flags *, int);
320 | int CDECL lame_get_findPeakSample(const lame_global_flags *);
321 | #endif
322 |
323 | /* counters for gapless encoding */
324 | int CDECL lame_set_nogap_total(lame_global_flags*, int);
325 | int CDECL lame_get_nogap_total(const lame_global_flags*);
326 |
327 | int CDECL lame_set_nogap_currentindex(lame_global_flags* , int);
328 | int CDECL lame_get_nogap_currentindex(const lame_global_flags*);
329 |
330 |
331 | /*
332 | * OPTIONAL:
333 | * Set printf like error/debug/message reporting functions.
334 | * The second argument has to be a pointer to a function which looks like
335 | * void my_debugf(const char *format, va_list ap)
336 | * {
337 | * (void) vfprintf(stdout, format, ap);
338 | * }
339 | * If you use NULL as the value of the pointer in the set function, the
340 | * lame buildin function will be used (prints to stderr).
341 | * To quiet any output you have to replace the body of the example function
342 | * with just "return;" and use it in the set function.
343 | */
344 | int CDECL lame_set_errorf(lame_global_flags *, lame_report_function);
345 | int CDECL lame_set_debugf(lame_global_flags *, lame_report_function);
346 | int CDECL lame_set_msgf (lame_global_flags *, lame_report_function);
347 |
348 |
349 |
350 | /* set one of brate compression ratio. default is compression ratio of 11. */
351 | int CDECL lame_set_brate(lame_global_flags *, int);
352 | int CDECL lame_get_brate(const lame_global_flags *);
353 | int CDECL lame_set_compression_ratio(lame_global_flags *, float);
354 | float CDECL lame_get_compression_ratio(const lame_global_flags *);
355 |
356 |
357 | int CDECL lame_set_preset( lame_global_flags* gfp, int );
358 | int CDECL lame_set_asm_optimizations( lame_global_flags* gfp, int, int );
359 |
360 |
361 |
362 | /********************************************************************
363 | * frame params
364 | ***********************************************************************/
365 | /* mark as copyright. default=0 */
366 | int CDECL lame_set_copyright(lame_global_flags *, int);
367 | int CDECL lame_get_copyright(const lame_global_flags *);
368 |
369 | /* mark as original. default=1 */
370 | int CDECL lame_set_original(lame_global_flags *, int);
371 | int CDECL lame_get_original(const lame_global_flags *);
372 |
373 | /* error_protection. Use 2 bytes from each frame for CRC checksum. default=0 */
374 | int CDECL lame_set_error_protection(lame_global_flags *, int);
375 | int CDECL lame_get_error_protection(const lame_global_flags *);
376 |
377 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
378 | #else
379 | /* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */
380 | int CDECL lame_set_padding_type(lame_global_flags *, Padding_type);
381 | Padding_type CDECL lame_get_padding_type(const lame_global_flags *);
382 | #endif
383 |
384 | /* MP3 'private extension' bit Meaningless. default=0 */
385 | int CDECL lame_set_extension(lame_global_flags *, int);
386 | int CDECL lame_get_extension(const lame_global_flags *);
387 |
388 | /* enforce strict ISO compliance. default=0 */
389 | int CDECL lame_set_strict_ISO(lame_global_flags *, int);
390 | int CDECL lame_get_strict_ISO(const lame_global_flags *);
391 |
392 |
393 | /********************************************************************
394 | * quantization/noise shaping
395 | ***********************************************************************/
396 |
397 | /* disable the bit reservoir. For testing only. default=0 */
398 | int CDECL lame_set_disable_reservoir(lame_global_flags *, int);
399 | int CDECL lame_get_disable_reservoir(const lame_global_flags *);
400 |
401 | /* select a different "best quantization" function. default=0 */
402 | int CDECL lame_set_quant_comp(lame_global_flags *, int);
403 | int CDECL lame_get_quant_comp(const lame_global_flags *);
404 | int CDECL lame_set_quant_comp_short(lame_global_flags *, int);
405 | int CDECL lame_get_quant_comp_short(const lame_global_flags *);
406 |
407 | int CDECL lame_set_experimentalX(lame_global_flags *, int); /* compatibility*/
408 | int CDECL lame_get_experimentalX(const lame_global_flags *);
409 |
410 | /* another experimental option. for testing only */
411 | int CDECL lame_set_experimentalY(lame_global_flags *, int);
412 | int CDECL lame_get_experimentalY(const lame_global_flags *);
413 |
414 | /* another experimental option. for testing only */
415 | int CDECL lame_set_experimentalZ(lame_global_flags *, int);
416 | int CDECL lame_get_experimentalZ(const lame_global_flags *);
417 |
418 | /* Naoki's psycho acoustic model. default=0 */
419 | int CDECL lame_set_exp_nspsytune(lame_global_flags *, int);
420 | int CDECL lame_get_exp_nspsytune(const lame_global_flags *);
421 |
422 | void CDECL lame_set_msfix(lame_global_flags *, double);
423 | float CDECL lame_get_msfix(const lame_global_flags *);
424 |
425 |
426 | /********************************************************************
427 | * VBR control
428 | ***********************************************************************/
429 | /* Types of VBR. default = vbr_off = CBR */
430 | int CDECL lame_set_VBR(lame_global_flags *, vbr_mode);
431 | vbr_mode CDECL lame_get_VBR(const lame_global_flags *);
432 |
433 | /* VBR quality level. 0=highest 9=lowest */
434 | int CDECL lame_set_VBR_q(lame_global_flags *, int);
435 | int CDECL lame_get_VBR_q(const lame_global_flags *);
436 |
437 | /* VBR quality level. 0=highest 9=lowest, Range [0,...,10[ */
438 | int CDECL lame_set_VBR_quality(lame_global_flags *, float);
439 | float CDECL lame_get_VBR_quality(const lame_global_flags *);
440 |
441 | /* Ignored except for VBR=vbr_abr (ABR mode) */
442 | int CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int);
443 | int CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *);
444 |
445 | int CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int);
446 | int CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *);
447 |
448 | int CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int);
449 | int CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *);
450 |
451 | /*
452 | 1=strictly enforce VBR_min_bitrate. Normally it will be violated for
453 | analog silence
454 | */
455 | int CDECL lame_set_VBR_hard_min(lame_global_flags *, int);
456 | int CDECL lame_get_VBR_hard_min(const lame_global_flags *);
457 |
458 | /* for preset */
459 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
460 | #else
461 | int CDECL lame_set_preset_expopts(lame_global_flags *, int);
462 | #endif
463 |
464 | /********************************************************************
465 | * Filtering control
466 | ***********************************************************************/
467 | /* freq in Hz to apply lowpass. Default = 0 = lame chooses. -1 = disabled */
468 | int CDECL lame_set_lowpassfreq(lame_global_flags *, int);
469 | int CDECL lame_get_lowpassfreq(const lame_global_flags *);
470 | /* width of transition band, in Hz. Default = one polyphase filter band */
471 | int CDECL lame_set_lowpasswidth(lame_global_flags *, int);
472 | int CDECL lame_get_lowpasswidth(const lame_global_flags *);
473 |
474 | /* freq in Hz to apply highpass. Default = 0 = lame chooses. -1 = disabled */
475 | int CDECL lame_set_highpassfreq(lame_global_flags *, int);
476 | int CDECL lame_get_highpassfreq(const lame_global_flags *);
477 | /* width of transition band, in Hz. Default = one polyphase filter band */
478 | int CDECL lame_set_highpasswidth(lame_global_flags *, int);
479 | int CDECL lame_get_highpasswidth(const lame_global_flags *);
480 |
481 |
482 | /********************************************************************
483 | * psycho acoustics and other arguments which you should not change
484 | * unless you know what you are doing
485 | ***********************************************************************/
486 |
487 | /* only use ATH for masking */
488 | int CDECL lame_set_ATHonly(lame_global_flags *, int);
489 | int CDECL lame_get_ATHonly(const lame_global_flags *);
490 |
491 | /* only use ATH for short blocks */
492 | int CDECL lame_set_ATHshort(lame_global_flags *, int);
493 | int CDECL lame_get_ATHshort(const lame_global_flags *);
494 |
495 | /* disable ATH */
496 | int CDECL lame_set_noATH(lame_global_flags *, int);
497 | int CDECL lame_get_noATH(const lame_global_flags *);
498 |
499 | /* select ATH formula */
500 | int CDECL lame_set_ATHtype(lame_global_flags *, int);
501 | int CDECL lame_get_ATHtype(const lame_global_flags *);
502 |
503 | /* lower ATH by this many db */
504 | int CDECL lame_set_ATHlower(lame_global_flags *, float);
505 | float CDECL lame_get_ATHlower(const lame_global_flags *);
506 |
507 | /* select ATH adaptive adjustment type */
508 | int CDECL lame_set_athaa_type( lame_global_flags *, int);
509 | int CDECL lame_get_athaa_type( const lame_global_flags *);
510 |
511 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
512 | #else
513 | /* select the loudness approximation used by the ATH adaptive auto-leveling */
514 | int CDECL lame_set_athaa_loudapprox( lame_global_flags *, int);
515 | int CDECL lame_get_athaa_loudapprox( const lame_global_flags *);
516 | #endif
517 |
518 | /* adjust (in dB) the point below which adaptive ATH level adjustment occurs */
519 | int CDECL lame_set_athaa_sensitivity( lame_global_flags *, float);
520 | float CDECL lame_get_athaa_sensitivity( const lame_global_flags* );
521 |
522 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
523 | #else
524 | /* OBSOLETE: predictability limit (ISO tonality formula) */
525 | int CDECL lame_set_cwlimit(lame_global_flags *, int);
526 | int CDECL lame_get_cwlimit(const lame_global_flags *);
527 | #endif
528 |
529 | /*
530 | allow blocktypes to differ between channels?
531 | default: 0 for jstereo, 1 for stereo
532 | */
533 | int CDECL lame_set_allow_diff_short(lame_global_flags *, int);
534 | int CDECL lame_get_allow_diff_short(const lame_global_flags *);
535 |
536 | /* use temporal masking effect (default = 1) */
537 | int CDECL lame_set_useTemporal(lame_global_flags *, int);
538 | int CDECL lame_get_useTemporal(const lame_global_flags *);
539 |
540 | /* use temporal masking effect (default = 1) */
541 | int CDECL lame_set_interChRatio(lame_global_flags *, float);
542 | float CDECL lame_get_interChRatio(const lame_global_flags *);
543 |
544 | /* disable short blocks */
545 | int CDECL lame_set_no_short_blocks(lame_global_flags *, int);
546 | int CDECL lame_get_no_short_blocks(const lame_global_flags *);
547 |
548 | /* force short blocks */
549 | int CDECL lame_set_force_short_blocks(lame_global_flags *, int);
550 | int CDECL lame_get_force_short_blocks(const lame_global_flags *);
551 |
552 | /* Input PCM is emphased PCM (for instance from one of the rarely
553 | emphased CDs), it is STRONGLY not recommended to use this, because
554 | psycho does not take it into account, and last but not least many decoders
555 | ignore these bits */
556 | int CDECL lame_set_emphasis(lame_global_flags *, int);
557 | int CDECL lame_get_emphasis(const lame_global_flags *);
558 |
559 |
560 |
561 | /************************************************************************/
562 | /* internal variables, cannot be set... */
563 | /* provided because they may be of use to calling application */
564 | /************************************************************************/
565 | /* version 0=MPEG-2 1=MPEG-1 (2=MPEG-2.5) */
566 | int CDECL lame_get_version(const lame_global_flags *);
567 |
568 | /* encoder delay */
569 | int CDECL lame_get_encoder_delay(const lame_global_flags *);
570 |
571 | /*
572 | padding appended to the input to make sure decoder can fully decode
573 | all input. Note that this value can only be calculated during the
574 | call to lame_encoder_flush(). Before lame_encoder_flush() has
575 | been called, the value of encoder_padding = 0.
576 | */
577 | int CDECL lame_get_encoder_padding(const lame_global_flags *);
578 |
579 | /* size of MPEG frame */
580 | int CDECL lame_get_framesize(const lame_global_flags *);
581 |
582 | /* number of PCM samples buffered, but not yet encoded to mp3 data. */
583 | int CDECL lame_get_mf_samples_to_encode( const lame_global_flags* gfp );
584 |
585 | /*
586 | size (bytes) of mp3 data buffered, but not yet encoded.
587 | this is the number of bytes which would be output by a call to
588 | lame_encode_flush_nogap. NOTE: lame_encode_flush() will return
589 | more bytes than this because it will encode the reamining buffered
590 | PCM samples before flushing the mp3 buffers.
591 | */
592 | int CDECL lame_get_size_mp3buffer( const lame_global_flags* gfp );
593 |
594 | /* number of frames encoded so far */
595 | int CDECL lame_get_frameNum(const lame_global_flags *);
596 |
597 | /*
598 | lame's estimate of the total number of frames to be encoded
599 | only valid if calling program set num_samples
600 | */
601 | int CDECL lame_get_totalframes(const lame_global_flags *);
602 |
603 | /* RadioGain value. Multiplied by 10 and rounded to the nearest. */
604 | int CDECL lame_get_RadioGain(const lame_global_flags *);
605 |
606 | /* AudiophileGain value. Multipled by 10 and rounded to the nearest. */
607 | int CDECL lame_get_AudiophileGain(const lame_global_flags *);
608 |
609 | /* the peak sample */
610 | float CDECL lame_get_PeakSample(const lame_global_flags *);
611 |
612 | /* Gain change required for preventing clipping. The value is correct only if
613 | peak sample searching was enabled. If negative then the waveform
614 | already does not clip. The value is multiplied by 10 and rounded up. */
615 | int CDECL lame_get_noclipGainChange(const lame_global_flags *);
616 |
617 | /* user-specified scale factor required for preventing clipping. Value is
618 | correct only if peak sample searching was enabled and no user-specified
619 | scaling was performed. If negative then either the waveform already does
620 | not clip or the value cannot be determined */
621 | float CDECL lame_get_noclipScale(const lame_global_flags *);
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 | /*
630 | * REQUIRED:
631 | * sets more internal configuration based on data provided above.
632 | * returns -1 if something failed.
633 | */
634 | int CDECL lame_init_params(lame_global_flags *);
635 |
636 |
637 | /*
638 | * OPTIONAL:
639 | * get the version number, in a string. of the form:
640 | * "3.63 (beta)" or just "3.63".
641 | */
642 | const char* CDECL get_lame_version ( void );
643 | const char* CDECL get_lame_short_version ( void );
644 | const char* CDECL get_lame_very_short_version ( void );
645 | const char* CDECL get_psy_version ( void );
646 | const char* CDECL get_lame_url ( void );
647 | const char* CDECL get_lame_os_bitness ( void );
648 |
649 | /*
650 | * OPTIONAL:
651 | * get the version numbers in numerical form.
652 | */
653 | typedef struct {
654 | /* generic LAME version */
655 | int major;
656 | int minor;
657 | int alpha; /* 0 if not an alpha version */
658 | int beta; /* 0 if not a beta version */
659 |
660 | /* version of the psy model */
661 | int psy_major;
662 | int psy_minor;
663 | int psy_alpha; /* 0 if not an alpha version */
664 | int psy_beta; /* 0 if not a beta version */
665 |
666 | /* compile time features */
667 | const char *features; /* Don't make assumptions about the contents! */
668 | } lame_version_t;
669 | void CDECL get_lame_version_numerical(lame_version_t *);
670 |
671 |
672 | /*
673 | * OPTIONAL:
674 | * print internal lame configuration to message handler
675 | */
676 | void CDECL lame_print_config(const lame_global_flags* gfp);
677 |
678 | void CDECL lame_print_internals( const lame_global_flags *gfp);
679 |
680 |
681 | /*
682 | * input pcm data, output (maybe) mp3 frames.
683 | * This routine handles all buffering, resampling and filtering for you.
684 | *
685 | * return code number of bytes output in mp3buf. Can be 0
686 | * -1: mp3buf was too small
687 | * -2: malloc() problem
688 | * -3: lame_init_params() not called
689 | * -4: psycho acoustic problems
690 | *
691 | * The required mp3buf_size can be computed from num_samples,
692 | * samplerate and encoding rate, but here is a worst case estimate:
693 | *
694 | * mp3buf_size in bytes = 1.25*num_samples + 7200
695 | *
696 | * I think a tighter bound could be: (mt, March 2000)
697 | * MPEG1:
698 | * num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512
699 | * MPEG2:
700 | * num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256
701 | *
702 | * but test first if you use that!
703 | *
704 | * set mp3buf_size = 0 and LAME will not check if mp3buf_size is
705 | * large enough.
706 | *
707 | * NOTE:
708 | * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels
709 | * will be averaged into the L channel before encoding only the L channel
710 | * This will overwrite the data in buffer_l[] and buffer_r[].
711 | *
712 | */
713 | int CDECL lame_encode_buffer (
714 | lame_global_flags* gfp, /* global context handle */
715 | const short int buffer_l [], /* PCM data for left channel */
716 | const short int buffer_r [], /* PCM data for right channel */
717 | const int nsamples, /* number of samples per channel */
718 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
719 | const int mp3buf_size ); /* number of valid octets in this
720 | stream */
721 |
722 | /*
723 | * as above, but input has L & R channel data interleaved.
724 | * NOTE:
725 | * num_samples = number of samples in the L (or R)
726 | * channel, not the total number of samples in pcm[]
727 | */
728 | int CDECL lame_encode_buffer_interleaved(
729 | lame_global_flags* gfp, /* global context handlei */
730 | short int pcm[], /* PCM data for left and right
731 | channel, interleaved */
732 | int num_samples, /* number of samples per channel,
733 | _not_ number of samples in
734 | pcm[] */
735 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
736 | int mp3buf_size ); /* number of valid octets in this
737 | stream */
738 |
739 |
740 | /* as lame_encode_buffer, but for 'float's.
741 | * !! NOTE: !! data must still be scaled to be in the same range as
742 | * short int, +/- 32768
743 | */
744 | int CDECL lame_encode_buffer_float(
745 | lame_global_flags* gfp, /* global context handle */
746 | const float pcm_l [], /* PCM data for left channel */
747 | const float pcm_r [], /* PCM data for right channel */
748 | const int nsamples, /* number of samples per channel */
749 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
750 | const int mp3buf_size ); /* number of valid octets in this
751 | stream */
752 |
753 | /* as lame_encode_buffer, but for 'float's.
754 | * !! NOTE: !! data must be scaled to +/- 1 full scale
755 | */
756 | int CDECL lame_encode_buffer_ieee_float(
757 | lame_t gfp,
758 | const float pcm_l [], /* PCM data for left channel */
759 | const float pcm_r [], /* PCM data for right channel */
760 | const int nsamples,
761 | unsigned char * mp3buf,
762 | const int mp3buf_size);
763 | int CDECL lame_encode_buffer_interleaved_ieee_float(
764 | lame_t gfp,
765 | const float pcm[], /* PCM data for left and right
766 | channel, interleaved */
767 | const int nsamples,
768 | unsigned char * mp3buf,
769 | const int mp3buf_size);
770 |
771 | /* as lame_encode_buffer, but for 'double's.
772 | * !! NOTE: !! data must be scaled to +/- 1 full scale
773 | */
774 | int CDECL lame_encode_buffer_ieee_double(
775 | lame_t gfp,
776 | const double pcm_l [], /* PCM data for left channel */
777 | const double pcm_r [], /* PCM data for right channel */
778 | const int nsamples,
779 | unsigned char * mp3buf,
780 | const int mp3buf_size);
781 | int CDECL lame_encode_buffer_interleaved_ieee_double(
782 | lame_t gfp,
783 | const double pcm[], /* PCM data for left and right
784 | channel, interleaved */
785 | const int nsamples,
786 | unsigned char * mp3buf,
787 | const int mp3buf_size);
788 |
789 | /* as lame_encode_buffer, but for long's
790 | * !! NOTE: !! data must still be scaled to be in the same range as
791 | * short int, +/- 32768
792 | *
793 | * This scaling was a mistake (doesn't allow one to exploit full
794 | * precision of type 'long'. Use lame_encode_buffer_long2() instead.
795 | *
796 | */
797 | int CDECL lame_encode_buffer_long(
798 | lame_global_flags* gfp, /* global context handle */
799 | const long buffer_l [], /* PCM data for left channel */
800 | const long buffer_r [], /* PCM data for right channel */
801 | const int nsamples, /* number of samples per channel */
802 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
803 | const int mp3buf_size ); /* number of valid octets in this
804 | stream */
805 |
806 | /* Same as lame_encode_buffer_long(), but with correct scaling.
807 | * !! NOTE: !! data must still be scaled to be in the same range as
808 | * type 'long'. Data should be in the range: +/- 2^(8*size(long)-1)
809 | *
810 | */
811 | int CDECL lame_encode_buffer_long2(
812 | lame_global_flags* gfp, /* global context handle */
813 | const long buffer_l [], /* PCM data for left channel */
814 | const long buffer_r [], /* PCM data for right channel */
815 | const int nsamples, /* number of samples per channel */
816 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
817 | const int mp3buf_size ); /* number of valid octets in this
818 | stream */
819 |
820 | /* as lame_encode_buffer, but for int's
821 | * !! NOTE: !! input should be scaled to the maximum range of 'int'
822 | * If int is 4 bytes, then the values should range from
823 | * +/- 2147483648.
824 | *
825 | * This routine does not (and cannot, without loosing precision) use
826 | * the same scaling as the rest of the lame_encode_buffer() routines.
827 | *
828 | */
829 | int CDECL lame_encode_buffer_int(
830 | lame_global_flags* gfp, /* global context handle */
831 | const int buffer_l [], /* PCM data for left channel */
832 | const int buffer_r [], /* PCM data for right channel */
833 | const int nsamples, /* number of samples per channel */
834 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
835 | const int mp3buf_size ); /* number of valid octets in this
836 | stream */
837 |
838 |
839 |
840 |
841 |
842 | /*
843 | * REQUIRED:
844 | * lame_encode_flush will flush the intenal PCM buffers, padding with
845 | * 0's to make sure the final frame is complete, and then flush
846 | * the internal MP3 buffers, and thus may return a
847 | * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long
848 | * to hold all possible emitted data.
849 | *
850 | * will also write id3v1 tags (if any) into the bitstream
851 | *
852 | * return code = number of bytes output to mp3buf. Can be 0
853 | */
854 | int CDECL lame_encode_flush(
855 | lame_global_flags * gfp, /* global context handle */
856 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
857 | int size); /* number of valid octets in this stream */
858 |
859 | /*
860 | * OPTIONAL:
861 | * lame_encode_flush_nogap will flush the internal mp3 buffers and pad
862 | * the last frame with ancillary data so it is a complete mp3 frame.
863 | *
864 | * 'mp3buf' should be at least 7200 bytes long
865 | * to hold all possible emitted data.
866 | *
867 | * After a call to this routine, the outputed mp3 data is complete, but
868 | * you may continue to encode new PCM samples and write future mp3 data
869 | * to a different file. The two mp3 files will play back with no gaps
870 | * if they are concatenated together.
871 | *
872 | * This routine will NOT write id3v1 tags into the bitstream.
873 | *
874 | * return code = number of bytes output to mp3buf. Can be 0
875 | */
876 | int CDECL lame_encode_flush_nogap(
877 | lame_global_flags * gfp, /* global context handle */
878 | unsigned char* mp3buf, /* pointer to encoded MP3 stream */
879 | int size); /* number of valid octets in this stream */
880 |
881 | /*
882 | * OPTIONAL:
883 | * Normally, this is called by lame_init_params(). It writes id3v2 and
884 | * Xing headers into the front of the bitstream, and sets frame counters
885 | * and bitrate histogram data to 0. You can also call this after
886 | * lame_encode_flush_nogap().
887 | */
888 | int CDECL lame_init_bitstream(
889 | lame_global_flags * gfp); /* global context handle */
890 |
891 |
892 |
893 | /*
894 | * OPTIONAL: some simple statistics
895 | * a bitrate histogram to visualize the distribution of used frame sizes
896 | * a stereo mode histogram to visualize the distribution of used stereo
897 | * modes, useful in joint-stereo mode only
898 | * 0: LR left-right encoded
899 | * 1: LR-I left-right and intensity encoded (currently not supported)
900 | * 2: MS mid-side encoded
901 | * 3: MS-I mid-side and intensity encoded (currently not supported)
902 | *
903 | * attention: don't call them after lame_encode_finish
904 | * suggested: lame_encode_flush -> lame_*_hist -> lame_close
905 | */
906 |
907 | void CDECL lame_bitrate_hist(
908 | const lame_global_flags * gfp,
909 | int bitrate_count[14] );
910 | void CDECL lame_bitrate_kbps(
911 | const lame_global_flags * gfp,
912 | int bitrate_kbps [14] );
913 | void CDECL lame_stereo_mode_hist(
914 | const lame_global_flags * gfp,
915 | int stereo_mode_count[4] );
916 |
917 | void CDECL lame_bitrate_stereo_mode_hist (
918 | const lame_global_flags * gfp,
919 | int bitrate_stmode_count[14][4] );
920 |
921 | void CDECL lame_block_type_hist (
922 | const lame_global_flags * gfp,
923 | int btype_count[6] );
924 |
925 | void CDECL lame_bitrate_block_type_hist (
926 | const lame_global_flags * gfp,
927 | int bitrate_btype_count[14][6] );
928 |
929 | #if (DEPRECATED_OR_OBSOLETE_CODE_REMOVED && 0)
930 | #else
931 | /*
932 | * OPTIONAL:
933 | * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file
934 | * pointer fid. These calls perform forward and backwards seeks, so make
935 | * sure fid is a real file. Make sure lame_encode_flush has been called,
936 | * and all mp3 data has been written to the file before calling this
937 | * function.
938 | * NOTE:
939 | * if VBR tags are turned off by the user, or turned off by LAME because
940 | * the output is not a regular file, this call does nothing
941 | * NOTE:
942 | * LAME wants to read from the file to skip an optional ID3v2 tag, so
943 | * make sure you opened the file for writing and reading.
944 | * NOTE:
945 | * You can call lame_get_lametag_frame instead, if you want to insert
946 | * the lametag yourself.
947 | */
948 | void CDECL lame_mp3_tags_fid(lame_global_flags *, FILE* fid);
949 | #endif
950 |
951 | /*
952 | * OPTIONAL:
953 | * lame_get_lametag_frame copies the final LAME-tag into 'buffer'.
954 | * The function returns the number of bytes copied into buffer, or
955 | * the required buffer size, if the provided buffer is too small.
956 | * Function failed, if the return value is larger than 'size'!
957 | * Make sure lame_encode flush has been called before calling this function.
958 | * NOTE:
959 | * if VBR tags are turned off by the user, or turned off by LAME,
960 | * this call does nothing and returns 0.
961 | * NOTE:
962 | * LAME inserted an empty frame in the beginning of mp3 audio data,
963 | * which you have to replace by the final LAME-tag frame after encoding.
964 | * In case there is no ID3v2 tag, usually this frame will be the very first
965 | * data in your mp3 file. If you put some other leading data into your
966 | * file, you'll have to do some bookkeeping about where to write this buffer.
967 | */
968 | size_t CDECL lame_get_lametag_frame(
969 | const lame_global_flags *, unsigned char* buffer, size_t size);
970 |
971 | /*
972 | * REQUIRED:
973 | * final call to free all remaining buffers
974 | */
975 | int CDECL lame_close (lame_global_flags *);
976 |
977 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
978 | #else
979 | /*
980 | * OBSOLETE:
981 | * lame_encode_finish combines lame_encode_flush() and lame_close() in
982 | * one call. However, once this call is made, the statistics routines
983 | * will no longer work because the data will have been cleared, and
984 | * lame_mp3_tags_fid() cannot be called to add data to the VBR header
985 | */
986 | int CDECL lame_encode_finish(
987 | lame_global_flags* gfp,
988 | unsigned char* mp3buf,
989 | int size );
990 | #endif
991 |
992 |
993 |
994 |
995 |
996 |
997 | /*********************************************************************
998 | *
999 | * decoding
1000 | *
1001 | * a simple interface to mpglib, part of mpg123, is also included if
1002 | * libmp3lame is compiled with HAVE_MPGLIB
1003 | *
1004 | *********************************************************************/
1005 |
1006 | struct hip_global_struct;
1007 | typedef struct hip_global_struct hip_global_flags;
1008 | typedef hip_global_flags *hip_t;
1009 |
1010 |
1011 | typedef struct {
1012 | int header_parsed; /* 1 if header was parsed and following data was
1013 | computed */
1014 | int stereo; /* number of channels */
1015 | int samplerate; /* sample rate */
1016 | int bitrate; /* bitrate */
1017 | int mode; /* mp3 frame type */
1018 | int mode_ext; /* mp3 frame type */
1019 | int framesize; /* number of samples per mp3 frame */
1020 |
1021 | /* this data is only computed if mpglib detects a Xing VBR header */
1022 | unsigned long nsamp; /* number of samples in mp3 file. */
1023 | int totalframes; /* total number of frames in mp3 file */
1024 |
1025 | /* this data is not currently computed by the mpglib routines */
1026 | int framenum; /* frames decoded counter */
1027 | } mp3data_struct;
1028 |
1029 | /* required call to initialize decoder */
1030 | hip_t CDECL hip_decode_init(void);
1031 |
1032 | /* cleanup call to exit decoder */
1033 | int CDECL hip_decode_exit(hip_t gfp);
1034 |
1035 | /* HIP reporting functions */
1036 | void CDECL hip_set_errorf(hip_t gfp, lame_report_function f);
1037 | void CDECL hip_set_debugf(hip_t gfp, lame_report_function f);
1038 | void CDECL hip_set_msgf (hip_t gfp, lame_report_function f);
1039 |
1040 | /*********************************************************************
1041 | * input 1 mp3 frame, output (maybe) pcm data.
1042 | *
1043 | * nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r);
1044 | *
1045 | * input:
1046 | * len : number of bytes of mp3 data in mp3buf
1047 | * mp3buf[len] : mp3 data to be decoded
1048 | *
1049 | * output:
1050 | * nout: -1 : decoding error
1051 | * 0 : need more data before we can complete the decode
1052 | * >0 : returned 'nout' samples worth of data in pcm_l,pcm_r
1053 | * pcm_l[nout] : left channel data
1054 | * pcm_r[nout] : right channel data
1055 | *
1056 | *********************************************************************/
1057 | int CDECL hip_decode( hip_t gfp
1058 | , unsigned char * mp3buf
1059 | , size_t len
1060 | , short pcm_l[]
1061 | , short pcm_r[]
1062 | );
1063 |
1064 | /* same as hip_decode, and also returns mp3 header data */
1065 | int CDECL hip_decode_headers( hip_t gfp
1066 | , unsigned char* mp3buf
1067 | , size_t len
1068 | , short pcm_l[]
1069 | , short pcm_r[]
1070 | , mp3data_struct* mp3data
1071 | );
1072 |
1073 | /* same as hip_decode, but returns at most one frame */
1074 | int CDECL hip_decode1( hip_t gfp
1075 | , unsigned char* mp3buf
1076 | , size_t len
1077 | , short pcm_l[]
1078 | , short pcm_r[]
1079 | );
1080 |
1081 | /* same as hip_decode1, but returns at most one frame and mp3 header data */
1082 | int CDECL hip_decode1_headers( hip_t gfp
1083 | , unsigned char* mp3buf
1084 | , size_t len
1085 | , short pcm_l[]
1086 | , short pcm_r[]
1087 | , mp3data_struct* mp3data
1088 | );
1089 |
1090 | /* same as hip_decode1_headers, but also returns enc_delay and enc_padding
1091 | from VBR Info tag, (-1 if no info tag was found) */
1092 | int CDECL hip_decode1_headersB( hip_t gfp
1093 | , unsigned char* mp3buf
1094 | , size_t len
1095 | , short pcm_l[]
1096 | , short pcm_r[]
1097 | , mp3data_struct* mp3data
1098 | , int *enc_delay
1099 | , int *enc_padding
1100 | );
1101 |
1102 |
1103 |
1104 | /* OBSOLETE:
1105 | * lame_decode... functions are there to keep old code working
1106 | * but it is strongly recommended to replace calls by hip_decode...
1107 | * function calls, see above.
1108 | */
1109 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
1110 | #else
1111 | int CDECL lame_decode_init(void);
1112 | int CDECL lame_decode(
1113 | unsigned char * mp3buf,
1114 | int len,
1115 | short pcm_l[],
1116 | short pcm_r[] );
1117 | int CDECL lame_decode_headers(
1118 | unsigned char* mp3buf,
1119 | int len,
1120 | short pcm_l[],
1121 | short pcm_r[],
1122 | mp3data_struct* mp3data );
1123 | int CDECL lame_decode1(
1124 | unsigned char* mp3buf,
1125 | int len,
1126 | short pcm_l[],
1127 | short pcm_r[] );
1128 | int CDECL lame_decode1_headers(
1129 | unsigned char* mp3buf,
1130 | int len,
1131 | short pcm_l[],
1132 | short pcm_r[],
1133 | mp3data_struct* mp3data );
1134 | int CDECL lame_decode1_headersB(
1135 | unsigned char* mp3buf,
1136 | int len,
1137 | short pcm_l[],
1138 | short pcm_r[],
1139 | mp3data_struct* mp3data,
1140 | int *enc_delay,
1141 | int *enc_padding );
1142 | int CDECL lame_decode_exit(void);
1143 |
1144 | #endif /* obsolete lame_decode API calls */
1145 |
1146 |
1147 | /*********************************************************************
1148 | *
1149 | * id3tag stuff
1150 | *
1151 | *********************************************************************/
1152 |
1153 | /*
1154 | * id3tag.h -- Interface to write ID3 version 1 and 2 tags.
1155 | *
1156 | * Copyright (C) 2000 Don Melton.
1157 | *
1158 | * This library is free software; you can redistribute it and/or
1159 | * modify it under the terms of the GNU Library General Public
1160 | * License as published by the Free Software Foundation; either
1161 | * version 2 of the License, or (at your option) any later version.
1162 | *
1163 | * This library is distributed in the hope that it will be useful,
1164 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
1165 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1166 | * Library General Public License for more details.
1167 | *
1168 | * You should have received a copy of the GNU Library General Public
1169 | * License along with this library; if not, write to the Free Software
1170 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
1171 | */
1172 |
1173 | /* utility to obtain alphabetically sorted list of genre names with numbers */
1174 | void CDECL id3tag_genre_list(
1175 | void (*handler)(int, const char *, void *),
1176 | void* cookie);
1177 |
1178 | void CDECL id3tag_init (lame_t gfp);
1179 |
1180 | /* force addition of version 2 tag */
1181 | void CDECL id3tag_add_v2 (lame_t gfp);
1182 |
1183 | /* add only a version 1 tag */
1184 | void CDECL id3tag_v1_only (lame_t gfp);
1185 |
1186 | /* add only a version 2 tag */
1187 | void CDECL id3tag_v2_only (lame_t gfp);
1188 |
1189 | /* pad version 1 tag with spaces instead of nulls */
1190 | void CDECL id3tag_space_v1 (lame_t gfp);
1191 |
1192 | /* pad version 2 tag with extra 128 bytes */
1193 | void CDECL id3tag_pad_v2 (lame_t gfp);
1194 |
1195 | /* pad version 2 tag with extra n bytes */
1196 | void CDECL id3tag_set_pad (lame_t gfp, size_t n);
1197 |
1198 | void CDECL id3tag_set_title(lame_t gfp, const char* title);
1199 | void CDECL id3tag_set_artist(lame_t gfp, const char* artist);
1200 | void CDECL id3tag_set_album(lame_t gfp, const char* album);
1201 | void CDECL id3tag_set_year(lame_t gfp, const char* year);
1202 | void CDECL id3tag_set_comment(lame_t gfp, const char* comment);
1203 |
1204 | /* return -1 result if track number is out of ID3v1 range
1205 | and ignored for ID3v1 */
1206 | int CDECL id3tag_set_track(lame_t gfp, const char* track);
1207 |
1208 | /* return non-zero result if genre name or number is invalid
1209 | result 0: OK
1210 | result -1: genre number out of range
1211 | result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other'
1212 | but taken as-is for ID3v2 genre tag */
1213 | int CDECL id3tag_set_genre(lame_t gfp, const char* genre);
1214 |
1215 | /* return non-zero result if field name is invalid */
1216 | int CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue);
1217 |
1218 | /* return non-zero result if image type is invalid */
1219 | int CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size);
1220 |
1221 | /* lame_get_id3v1_tag copies ID3v1 tag into buffer.
1222 | * Function returns number of bytes copied into buffer, or number
1223 | * of bytes rquired if buffer 'size' is too small.
1224 | * Function fails, if returned value is larger than 'size'.
1225 | * NOTE:
1226 | * This functions does nothing, if user/LAME disabled ID3v1 tag.
1227 | */
1228 | size_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t size);
1229 |
1230 | /* lame_get_id3v2_tag copies ID3v2 tag into buffer.
1231 | * Function returns number of bytes copied into buffer, or number
1232 | * of bytes rquired if buffer 'size' is too small.
1233 | * Function fails, if returned value is larger than 'size'.
1234 | * NOTE:
1235 | * This functions does nothing, if user/LAME disabled ID3v2 tag.
1236 | */
1237 | size_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t size);
1238 |
1239 | /* normaly lame_init_param writes ID3v2 tags into the audio stream
1240 | * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param
1241 | * to turn off this behaviour and get ID3v2 tag with above function
1242 | * write it yourself into your file.
1243 | */
1244 | void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int);
1245 | int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp);
1246 |
1247 | /* experimental */
1248 | int CDECL id3tag_set_textinfo_latin1(lame_t gfp, char const *id, char const *text);
1249 |
1250 | /* experimental */
1251 | int CDECL id3tag_set_comment_latin1(lame_t gfp, char const *lang, char const *desc, char const *text);
1252 |
1253 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVED
1254 | #else
1255 | /* experimental */
1256 | int CDECL id3tag_set_textinfo_ucs2(lame_t gfp, char const *id, unsigned short const *text);
1257 |
1258 | /* experimental */
1259 | int CDECL id3tag_set_comment_ucs2(lame_t gfp, char const *lang,
1260 | unsigned short const *desc, unsigned short const *text);
1261 |
1262 | /* experimental */
1263 | int CDECL id3tag_set_fieldvalue_ucs2(lame_t gfp, const unsigned short *fieldvalue);
1264 | #endif
1265 |
1266 | /* experimental */
1267 | int CDECL id3tag_set_fieldvalue_utf16(lame_t gfp, const unsigned short *fieldvalue);
1268 |
1269 | /* experimental */
1270 | int CDECL id3tag_set_textinfo_utf16(lame_t gfp, char const *id, unsigned short const *text);
1271 |
1272 | /* experimental */
1273 | int CDECL id3tag_set_comment_utf16(lame_t gfp, char const *lang, unsigned short const *desc, unsigned short const *text);
1274 |
1275 |
1276 | /***********************************************************************
1277 | *
1278 | * list of valid bitrates [kbps] & sample frequencies [Hz].
1279 | * first index: 0: MPEG-2 values (sample frequencies 16...24 kHz)
1280 | * 1: MPEG-1 values (sample frequencies 32...48 kHz)
1281 | * 2: MPEG-2.5 values (sample frequencies 8...12 kHz)
1282 | ***********************************************************************/
1283 |
1284 | extern const int bitrate_table [3][16];
1285 | extern const int samplerate_table [3][ 4];
1286 |
1287 | /* access functions for use in DLL, global vars are not exported */
1288 | int CDECL lame_get_bitrate(int mpeg_version, int table_index);
1289 | int CDECL lame_get_samplerate(int mpeg_version, int table_index);
1290 |
1291 |
1292 | /* maximum size of albumart image (128KB), which affects LAME_MAXMP3BUFFER
1293 | as well since lame_encode_buffer() also returns ID3v2 tag data */
1294 | #define LAME_MAXALBUMART (128 * 1024)
1295 |
1296 | /* maximum size of mp3buffer needed if you encode at most 1152 samples for
1297 | each call to lame_encode_buffer. see lame_encode_buffer() below
1298 | (LAME_MAXMP3BUFFER is now obsolete) */
1299 | #define LAME_MAXMP3BUFFER (16384 + LAME_MAXALBUMART)
1300 |
1301 |
1302 | typedef enum {
1303 | LAME_OKAY = 0,
1304 | LAME_NOERROR = 0,
1305 | LAME_GENERICERROR = -1,
1306 | LAME_NOMEM = -10,
1307 | LAME_BADBITRATE = -11,
1308 | LAME_BADSAMPFREQ = -12,
1309 | LAME_INTERNALERROR = -13,
1310 |
1311 | FRONTEND_READERROR = -80,
1312 | FRONTEND_WRITEERROR = -81,
1313 | FRONTEND_FILETOOLARGE = -82
1314 |
1315 | } lame_errorcodes_t;
1316 |
1317 | #if defined(__cplusplus)
1318 | }
1319 | #endif
1320 | #endif /* LAME_LAME_H */
1321 |
1322 |
--------------------------------------------------------------------------------