├── AmrConvertAndRecord
├── VoiceConvert
│ ├── lib
│ │ ├── .svn
│ │ │ ├── tmp
│ │ │ │ ├── svn-8Sn2QB
│ │ │ │ └── svn-IZtFSB
│ │ │ ├── dir-prop-base
│ │ │ ├── prop-base
│ │ │ │ ├── libopencore-amrnb.a.svn-base
│ │ │ │ └── libopencore-amrwb.a.svn-base
│ │ │ ├── text-base
│ │ │ │ ├── libopencore-amrnb.a.svn-base
│ │ │ │ └── libopencore-amrwb.a.svn-base
│ │ │ └── entries
│ │ ├── .DS_Store
│ │ ├── libopencore-amrnb.a
│ │ └── libopencore-amrwb.a
│ ├── .svn
│ │ ├── dir-prop-base
│ │ ├── text-base
│ │ │ ├── VoiceConverter.h.svn-base
│ │ │ └── VoiceConverter.mm.svn-base
│ │ └── entries
│ ├── .DS_Store
│ ├── amrwapper
│ │ ├── .DS_Store
│ │ ├── wav.h
│ │ ├── .svn
│ │ │ ├── text-base
│ │ │ │ ├── wav.h.svn-base
│ │ │ │ ├── amrFileCodec.h.svn-base
│ │ │ │ ├── wav.mm.svn-base
│ │ │ │ └── amrFileCodec.mm.svn-base
│ │ │ └── entries
│ │ ├── amrFileCodec.h
│ │ ├── wav.mm
│ │ └── amrFileCodec.mm
│ ├── VoiceConverter.h
│ ├── VoiceConverter.mm
│ ├── opencore-amrwb
│ │ ├── .svn
│ │ │ ├── entries
│ │ │ └── text-base
│ │ │ │ ├── if_rom.h.svn-base
│ │ │ │ └── dec_if.h.svn-base
│ │ ├── if_rom.h
│ │ └── dec_if.h
│ └── opencore-amrnb
│ │ ├── .svn
│ │ ├── entries
│ │ └── text-base
│ │ │ ├── interf_dec.h.svn-base
│ │ │ └── interf_enc.h.svn-base
│ │ ├── interf_dec.h
│ │ └── interf_enc.h
├── en.lproj
│ └── InfoPlist.strings
├── .DS_Store
├── Default.png
├── Default@2x.png
├── img
│ ├── .DS_Store
│ ├── RecordingBkg.png
│ ├── RecordingBkg@2x.png
│ ├── chat_voice_03@2x.png
│ ├── RecordingSignal001.png
│ ├── RecordingSignal002.png
│ ├── RecordingSignal003.png
│ ├── RecordingSignal004.png
│ ├── RecordingSignal005.png
│ ├── RecordingSignal006.png
│ ├── RecordingSignal007.png
│ ├── RecordingSignal008.png
│ ├── RecordingSignal001@2x.png
│ ├── RecordingSignal002@2x.png
│ ├── RecordingSignal003@2x.png
│ ├── RecordingSignal004@2x.png
│ ├── RecordingSignal005@2x.png
│ ├── RecordingSignal006@2x.png
│ ├── RecordingSignal007@2x.png
│ ├── RecordingSignal008@2x.png
│ ├── recorder_trash_can0.png
│ ├── recorder_trash_can1.png
│ ├── recorder_trash_can2.png
│ ├── recorder_trash_can0@2x.png
│ ├── recorder_trash_can1@2x.png
│ └── recorder_trash_can2@2x.png
├── Default-568h@2x.png
├── UIViewAnimation
│ ├── .DS_Store
│ ├── UIView+Animation.h
│ └── UIView+Animation.m
├── VoiceRecorderVC
│ ├── .DS_Store
│ ├── ChatVoiceRecorderVC
│ │ ├── ChatRecorderView
│ │ │ ├── .svn
│ │ │ │ ├── props
│ │ │ │ │ └── 1.wav.svn-work
│ │ │ │ ├── text-base
│ │ │ │ │ ├── ChatRecorderView.h.svn-base
│ │ │ │ │ ├── ChatRecorderView.m.svn-base
│ │ │ │ │ └── ChatRecorderView.xib.svn-base
│ │ │ │ └── entries
│ │ │ ├── ChatRecorderView.h
│ │ │ └── ChatRecorderView.m
│ │ ├── .DS_Store
│ │ ├── ChatVoiceRecorderVC.h
│ │ ├── .svn
│ │ │ ├── text-base
│ │ │ │ ├── ChatVoiceRecorderVC.h.svn-base
│ │ │ │ ├── ChatVoiceRecorderVC.xib.svn-base
│ │ │ │ └── ChatVoiceRecorderVC.m.svn-base
│ │ │ └── entries
│ │ └── ChatVoiceRecorderVC.m
│ ├── .svn
│ │ ├── entries
│ │ └── text-base
│ │ │ ├── VoiceRecorderBaseVC.h.svn-base
│ │ │ └── VoiceRecorderBaseVC.m.svn-base
│ ├── VoiceRecorderBaseVC.h
│ └── VoiceRecorderBaseVC.m
├── CustomWindow.h
├── main.m
├── AmrConvertAndRecord-Prefix.pch
├── AppDelegate.h
├── CustomWindow.m
├── ViewController.h
├── AmrConvertAndRecord-Info.plist
├── AppDelegate.m
└── ViewController.m
├── icon.png
├── icon@2x.png
└── AmrConvertAndRecord.xcodeproj
├── xcuserdata
├── Jeans.xcuserdatad
│ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── AmrConvertAndRecord.xcscheme
├── dazhan.xcuserdatad
│ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── AmrConvertAndRecord.xcscheme
└── justinjing.xcuserdatad
│ └── xcschemes
│ ├── xcschememanagement.plist
│ └── AmrConvertAndRecord.xcscheme
├── project.xcworkspace
├── contents.xcworkspacedata
└── xcuserdata
│ ├── Jeans.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ ├── dazhan.xcuserdatad
│ └── UserInterfaceState.xcuserstate
│ └── justinjing.xcuserdatad
│ └── UserInterfaceState.xcuserstate
└── project.pbxproj
/AmrConvertAndRecord/VoiceConvert/lib/.svn/tmp/svn-8Sn2QB:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/tmp/svn-IZtFSB:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/icon.png
--------------------------------------------------------------------------------
/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/icon@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/.svn/dir-prop-base:
--------------------------------------------------------------------------------
1 | K 10
2 | svn:ignore
3 | V 10
4 | .DS_Store
5 |
6 | END
7 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/dir-prop-base:
--------------------------------------------------------------------------------
1 | K 10
2 | svn:ignore
3 | V 10
4 | .DS_Store
5 |
6 | END
7 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/Default.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/Default@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/Default-568h@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingBkg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingBkg.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/prop-base/libopencore-amrnb.a.svn-base:
--------------------------------------------------------------------------------
1 | K 13
2 | svn:mime-type
3 | V 24
4 | application/octet-stream
5 | END
6 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/prop-base/libopencore-amrwb.a.svn-base:
--------------------------------------------------------------------------------
1 | K 13
2 | svn:mime-type
3 | V 24
4 | application/octet-stream
5 | END
6 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingBkg@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingBkg@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/chat_voice_03@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/chat_voice_03@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/UIViewAnimation/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/UIViewAnimation/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/lib/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceRecorderVC/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal001.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal002.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal003.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal004.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal005.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal006.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal007.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal008.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal001@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal001@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal002@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal002@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal003@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal003@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal004@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal004@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal005@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal005@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal006@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal006@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal007@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal007@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/RecordingSignal008@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/RecordingSignal008@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can0.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can1.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can2.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can0@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can0@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can1@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/img/recorder_trash_can2@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/img/recorder_trash_can2@2x.png
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/amrwapper/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/.svn/props/1.wav.svn-work:
--------------------------------------------------------------------------------
1 | K 13
2 | svn:mime-type
3 | V 24
4 | application/octet-stream
5 | END
6 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/libopencore-amrnb.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/lib/libopencore-amrnb.a
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/libopencore-amrwb.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/lib/libopencore-amrwb.a
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.DS_Store
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/Jeans.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/dazhan.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/text-base/libopencore-amrnb.a.svn-base:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/lib/.svn/text-base/libopencore-amrnb.a.svn-base
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/text-base/libopencore-amrwb.a.svn-base:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord/VoiceConvert/lib/.svn/text-base/libopencore-amrwb.a.svn-base
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/Jeans.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/Jeans.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/dazhan.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/dazhan.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/justinjing.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/justinjing/RecordWAVToAMRDemo/HEAD/AmrConvertAndRecord.xcodeproj/project.xcworkspace/xcuserdata/justinjing.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/AmrConvertAndRecord/CustomWindow.h:
--------------------------------------------------------------------------------
1 | //
2 | // CustomWindow.h
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CustomWindow : UIWindow
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/AmrConvertAndRecord-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'AmrConvertAndRecord' target in the 'AmrConvertAndRecord' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_4_0
8 | #warning "This project uses features only available in iOS SDK 4.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/VoiceConverter.h:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceConverter.h
3 | // Jeans
4 | //
5 | // Created by Jeans Huang on 12-7-22.
6 | // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface VoiceConverter : NSObject
12 |
13 | + (int)amrToWav:(NSString*)_amrPath wavSavePath:(NSString*)_savePath;
14 |
15 | + (int)wavToAmr:(NSString*)_wavPath amrSavePath:(NSString*)_savePath;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "CustomWindow.h"
11 |
12 | @class ViewController;
13 |
14 | @interface AppDelegate : UIResponder
15 |
16 | @property (strong, nonatomic) CustomWindow *window;
17 |
18 | @property (strong, nonatomic) ViewController *viewController;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/.svn/text-base/VoiceConverter.h.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceConverter.h
3 | // taojinroad
4 | //
5 | // Created by Jeans Huang on 12-7-22.
6 | // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface VoiceConverter : NSObject
12 |
13 | + (int)amrToWav:(NSString*)fileNameString;
14 | + (int)wavToAmr:(NSString*)fileNameString;
15 | //获取文件完整路径
16 | + (NSString*)getFilePath:(NSString*)fileNameString;
17 |
18 | //文件是否存在
19 | + (BOOL)isFileExistWithFileName:(NSString*)fileName;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/Jeans.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | AmrConvertAndRecord.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2EDEC373170590E40028A6CF
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/dazhan.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | AmrConvertAndRecord.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2EDEC373170590E40028A6CF
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/justinjing.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | AmrConvertAndRecord.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2EDEC373170590E40028A6CF
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatVoiceRecorderVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // ChatVoiceRecorderVC.h
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "VoiceRecorderBaseVC.h"
10 |
11 |
12 | #define kRecorderViewRect CGRectMake(100, 120, 120, 120)
13 | //#define kCancelOriginY (kRecorderViewRect.origin.y + kRecorderViewRect.size.height + 180)
14 | #define kCancelOriginY ([[UIScreen mainScreen]bounds].size.height-70)
15 |
16 | @interface ChatVoiceRecorderVC : VoiceRecorderBaseVC
17 |
18 | //开始录音
19 | - (void)beginRecordByFileName:(NSString*)_fileName;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.svn/text-base/ChatVoiceRecorderVC.h.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // ChatVoiceRecorderVC.h
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import "VoiceRecorderBaseVC.h"
10 |
11 |
12 | #define kRecorderViewRect CGRectMake(80, 120, 160, 160)
13 | //#define kCancelOriginY (kRecorderViewRect.origin.y + kRecorderViewRect.size.height + 180)
14 | #define kCancelOriginY ([[UIScreen mainScreen]bounds].size.height-70)
15 |
16 | @interface ChatVoiceRecorderVC : VoiceRecorderBaseVC
17 |
18 | //开始录音
19 | - (void)beginRecordByChatTopicId:(NSString*)_topicId;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/ChatRecorderView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ChatRecorderView.h
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/24/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 |
13 | @interface ChatRecorderView : UIView
14 |
15 | @property (retain, nonatomic) UIImageView *peakMeterIV;
16 |
17 | @property (retain, nonatomic) UIImageView *trashCanIV;
18 |
19 | @property (retain, nonatomic) UILabel *countDownLabel;
20 |
21 | //还原界面
22 | - (void)restoreDisplay;
23 |
24 | //是否准备删除
25 | - (void)prepareToDelete:(BOOL)_preareDelete;
26 |
27 | //是否摇晃垃圾桶
28 | - (void)rockTrashCan:(BOOL)_isTure;
29 |
30 | //更新音频峰值
31 | - (void)updateMetersByAvgPower:(float)_avgPower;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/CustomWindow.m:
--------------------------------------------------------------------------------
1 | //
2 | // CustomWindow.m
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "CustomWindow.h"
10 |
11 | @implementation CustomWindow
12 |
13 | - (id)initWithFrame:(CGRect)frame
14 | {
15 | self = [super initWithFrame:frame];
16 | if (self) {
17 | // Initialization code
18 | }
19 | return self;
20 | }
21 |
22 | -(void)sendEvent:(UIEvent *)event {
23 | if (event.type == UIEventTypeTouches) {//发送一个名为‘nScreenTouch’(自定义)的事件
24 | [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"nScreenTouch" object:nil userInfo:[NSDictionary dictionaryWithObject:event forKey:@"data"]]];
25 | }
26 | [super sendEvent:event];
27 | }
28 |
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/.svn/text-base/ChatRecorderView.h.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // ChatRecorderView.h
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/24/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 |
13 | @interface ChatRecorderView : UIView
14 |
15 | @property (retain, nonatomic) IBOutlet UIImageView *peakMeterIV;
16 |
17 | @property (retain, nonatomic) IBOutlet UIImageView *trashCanIV;
18 |
19 | @property (retain, nonatomic) IBOutlet UILabel *countDownLabel;
20 |
21 | //还原界面
22 | - (void)restoreDisplay;
23 |
24 | //是否准备删除
25 | - (void)prepareToDelete:(BOOL)_preareDelete;
26 |
27 | //是否摇晃垃圾桶
28 | - (void)rockTrashCan:(BOOL)_isTure;
29 |
30 | //更新音频峰值
31 | - (void)updateMetersByAvgPower:(float)_avgPower;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/VoiceConverter.mm:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceConverter.m
3 | // Jeans
4 | //
5 | // Created by Jeans Huang on 12-7-22.
6 | // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "VoiceConverter.h"
10 | #import "wav.h"
11 | #import "interf_dec.h"
12 | #import "dec_if.h"
13 | #import "interf_enc.h"
14 | #import "amrFileCodec.h"
15 |
16 | @implementation VoiceConverter
17 |
18 | + (int)amrToWav:(NSString*)_amrPath wavSavePath:(NSString*)_savePath{
19 |
20 | if (! DecodeAMRFileToWAVEFile([_amrPath cStringUsingEncoding:NSASCIIStringEncoding], [_savePath cStringUsingEncoding:NSASCIIStringEncoding]))
21 | return 0;
22 |
23 | return 1;
24 | }
25 |
26 | + (int)wavToAmr:(NSString*)_wavPath amrSavePath:(NSString*)_savePath{
27 |
28 | if (EncodeWAVEFileToAMRFile([_wavPath cStringUsingEncoding:NSASCIIStringEncoding], [_savePath cStringUsingEncoding:NSASCIIStringEncoding], 1, 16))
29 | return 0;
30 |
31 | return 1;
32 | }
33 |
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrwb/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceConvert/opencore-amrwb
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2012-10-11T23:43:36.653566Z
11 | 7781
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | dec_if.h
30 | file
31 |
32 |
33 |
34 |
35 | 2013-01-17T09:44:07.000000Z
36 | e5de674a7a422729648aa2c647e6afb3
37 | 2012-10-11T23:43:36.653566Z
38 | 7781
39 | hjp
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 1043
62 |
63 | if_rom.h
64 | file
65 |
66 |
67 |
68 |
69 | 2013-01-17T09:44:07.000000Z
70 | 9caccb0cc7d913bd0a1e5bc0e0af19cc
71 | 2012-10-11T23:43:36.653566Z
72 | 7781
73 | hjp
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 931
96 |
97 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrnb/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceConvert/opencore-amrnb
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2012-10-11T23:43:36.653566Z
11 | 7781
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | interf_enc.h
30 | file
31 |
32 |
33 |
34 |
35 | 2013-01-17T09:44:08.000000Z
36 | 6d3a6787a7828b418ac07055cc1e5c9b
37 | 2012-10-11T23:43:36.653566Z
38 | 7781
39 | hjp
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 1456
62 |
63 | interf_dec.h
64 | file
65 |
66 |
67 |
68 |
69 | 2013-01-17T09:44:08.000000Z
70 | fd595d2fd1cf0b7dce7a70ba75b07d27
71 | 2012-10-11T23:43:36.653566Z
72 | 7781
73 | hjp
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 1063
96 |
97 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/lib/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceConvert/lib
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-25T09:02:51.040043Z
11 | 10761
12 | hjp
13 | has-props
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | libopencore-amrwb.a
30 | file
31 |
32 |
33 |
34 |
35 | 2012-12-14T09:54:13.000000Z
36 | 8d3d5ca95ecd5491cfe57df6f917153d
37 | 2013-03-25T09:02:51.040043Z
38 | 10761
39 | hjp
40 | has-props
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 985036
62 |
63 | libopencore-amrnb.a
64 | file
65 |
66 |
67 |
68 |
69 | 2012-12-14T09:54:13.000000Z
70 | 7fc4b61d8d4457cd1a17e1bbf64d1268
71 | 2013-03-25T09:02:51.040043Z
72 | 10761
73 | hjp
74 | has-props
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 2718572
96 |
97 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrwb/if_rom.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRWB_IF_ROM_H
20 | #define OPENCORE_AMRWB_IF_ROM_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include
27 | typedef int16_t Word16;
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrwb/.svn/text-base/if_rom.h.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRWB_IF_ROM_H
20 | #define OPENCORE_AMRWB_IF_ROM_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include
27 | typedef int16_t Word16;
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceRecorderVC
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-26T04:10:51.553114Z
11 | 10780
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | ChatVoiceRecorderVC
30 | dir
31 |
32 | VoiceRecorderBaseVC.h
33 | file
34 |
35 |
36 |
37 |
38 | 2013-03-25T06:38:02.000000Z
39 | 2acfdd72f877fa50d04f6a732eb9b2e1
40 | 2013-03-25T09:02:51.040043Z
41 | 10761
42 | hjp
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | 2162
65 |
66 | VoiceRecorderBaseVC.m
67 | file
68 |
69 |
70 |
71 |
72 | 2013-03-25T14:04:18.000000Z
73 | 612aa93c1975d9938e2d9e9e5bad6e74
74 | 2013-03-26T03:01:29.834751Z
75 | 10772
76 | hjp
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | 5813
99 |
100 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ChatVoiceRecorderVC.h"
11 | #import "VoiceConverter.h"
12 |
13 | @interface ViewController : UIViewController
14 |
15 | @property (retain, nonatomic) ChatVoiceRecorderVC *recorderVC;
16 |
17 | @property (retain, nonatomic) AVAudioPlayer *player;
18 |
19 | @property (retain, nonatomic) IBOutlet UIButton *recordBtn; //录音按钮
20 | @property (retain, nonatomic) IBOutlet UILabel *amrTowavLabel;
21 | @property (retain, nonatomic) IBOutlet UILabel *wavToamrLabel;
22 | @property (retain, nonatomic) IBOutlet UILabel *originWavLabel;
23 | @property (retain, nonatomic) IBOutlet UIButton *palyAMR;
24 | @property (copy, nonatomic) NSString *originWav; //原wav文件名
25 | @property (copy, nonatomic) NSString *convertAmr; //转换后的amr文件名
26 | @property (copy, nonatomic) NSString *convertWav; //amr转wav的文件名
27 |
28 |
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrwb/dec_if.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRWB_DEC_IF_H
20 | #define OPENCORE_AMRWB_DEC_IF_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #define _good_frame 0
27 |
28 | void* D_IF_init(void);
29 | void D_IF_decode(void* state, const unsigned char* bits, short* synth, int bfi);
30 | void D_IF_exit(void* state);
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrnb/interf_dec.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_DEC_H
20 | #define OPENCORE_AMRNB_INTERF_DEC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | void* Decoder_Interface_init(void);
27 | void Decoder_Interface_exit(void* state);
28 | void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi);
29 |
30 | #ifdef __cplusplus
31 | }
32 | #endif
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrwb/.svn/text-base/dec_if.h.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRWB_DEC_IF_H
20 | #define OPENCORE_AMRWB_DEC_IF_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #define _good_frame 0
27 |
28 | void* D_IF_init(void);
29 | void D_IF_decode(void* state, const unsigned char* bits, short* synth, int bfi);
30 | void D_IF_exit(void* state);
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrnb/.svn/text-base/interf_dec.h.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_DEC_H
20 | #define OPENCORE_AMRNB_INTERF_DEC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | void* Decoder_Interface_init(void);
27 | void Decoder_Interface_exit(void* state);
28 | void Decoder_Interface_Decode(void* state, const unsigned char* in, short* out, int bfi);
29 |
30 | #ifdef __cplusplus
31 | }
32 | #endif
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceConvert
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-26T03:01:29.834751Z
11 | 10772
12 | hjp
13 | has-props
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | opencore-amrwb
30 | dir
31 |
32 | VoiceConverter.h
33 | file
34 |
35 |
36 |
37 |
38 | 2013-01-17T09:44:08.000000Z
39 | d993e6fea6718bdb4099b1716085103a
40 | 2012-10-11T23:43:36.653566Z
41 | 7781
42 | hjp
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | 470
65 |
66 | VoiceConverter.mm
67 | file
68 |
69 |
70 |
71 |
72 | 2013-03-25T14:05:13.000000Z
73 | 98477e3433c1271644643baaf433da65
74 | 2013-03-26T03:01:29.834751Z
75 | 10772
76 | hjp
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | 2340
99 |
100 | lib
101 | dir
102 |
103 | opencore-amrnb
104 | dir
105 |
106 | amrwapper
107 | dir
108 |
109 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/wav.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef WAV_H
20 | #define WAV_H
21 |
22 | #include
23 |
24 | class WavWriter {
25 | public:
26 | WavWriter(const char *filename, int sampleRate, int bitsPerSample, int channels);
27 | ~WavWriter();
28 |
29 | void writeData(const unsigned char* data, int length);
30 |
31 | private:
32 | void writeString(const char *str);
33 | void writeInt32(int value);
34 | void writeInt16(int value);
35 |
36 | void writeHeader(int length);
37 |
38 | FILE *wav;
39 | int dataLength;
40 |
41 | int sampleRate;
42 | int bitsPerSample;
43 | int channels;
44 | };
45 |
46 | #endif
47 |
48 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.svn/text-base/wav.h.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef WAV_H
20 | #define WAV_H
21 |
22 | #include
23 |
24 | class WavWriter {
25 | public:
26 | WavWriter(const char *filename, int sampleRate, int bitsPerSample, int channels);
27 | ~WavWriter();
28 |
29 | void writeData(const unsigned char* data, int length);
30 |
31 | private:
32 | void writeString(const char *str);
33 | void writeInt32(int value);
34 | void writeInt16(int value);
35 |
36 | void writeHeader(int length);
37 |
38 | FILE *wav;
39 | int dataLength;
40 |
41 | int sampleRate;
42 | int bitsPerSample;
43 | int channels;
44 | };
45 |
46 | #endif
47 |
48 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/UIViewAnimation/UIView+Animation.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Animation.h
3 | //
4 | //
5 | // Created by Jeans on 3/9/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #define kDefaultAnimateTime 0.25f
12 |
13 | typedef enum AnimateType{ //动画类型
14 | AnimateTypeOfTV, //电视
15 | AnimateTypeOfPopping, //弹性缩小放大
16 | AnimateTypeOfLeft, //左
17 | AnimateTypeOfRight, //右
18 | AnimateTypeOfTop, //上
19 | AnimateTypeOfBottom //下
20 | }AnimateType;
21 |
22 | @interface UIView (Animation)
23 |
24 | #pragma mark - 获取顶部View
25 | + (UIView *)getTopView;
26 |
27 | #pragma mark - 顶层maskView触摸
28 | + (void)setTopMaskViewCanTouch:(BOOL)_canTouch;
29 |
30 | /**
31 | 显示view
32 | @param _view 需要显示的view
33 | @param _aType 动画类型
34 | @param _fRect 最终位置
35 | */
36 | + (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect;
37 |
38 |
39 | /**
40 | 消失view
41 | */
42 | + (void)hideView;
43 |
44 |
45 | /**
46 | 消失view
47 | @param _aType 动画类型
48 | */
49 | + (void)hideViewByType:(AnimateType)_aType;
50 |
51 |
52 | #pragma mark - 下面的增加了完成块
53 | + (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect completion:(void(^)(BOOL finished))completion;
54 | + (void)hideViewByCompletion:(void(^)(BOOL finished))completion;
55 | + (void)hideViewByType:(AnimateType)_aType completion:(void(^)(BOOL finished))completion;
56 | @end
57 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-26T03:01:29.834751Z
11 | 10772
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | ChatRecorderView.xib
30 | file
31 |
32 |
33 |
34 | delete
35 | 2013-03-25T08:50:37.000000Z
36 | daf676e5b3ba6d1cf57c06a54cfad074
37 | 2013-03-25T09:02:51.040043Z
38 | 10761
39 | hjp
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 9495
62 |
63 | ChatRecorderView.h
64 | file
65 |
66 |
67 |
68 |
69 | 2013-03-24T14:05:59.000000Z
70 | a7ca4cf5b42e473363519699ec1f8170
71 | 2013-03-25T09:02:51.040043Z
72 | 10761
73 | hjp
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 648
96 |
97 | ChatRecorderView.m
98 | file
99 |
100 |
101 |
102 |
103 | 2013-03-25T14:20:39.000000Z
104 | d569a69a0639c95ed9f5101b5d1b87a6
105 | 2013-03-26T03:01:29.834751Z
106 | 10772
107 | hjp
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 4512
130 |
131 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceRecorderVC/ChatVoiceRecorderVC
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-26T04:10:51.553114Z
11 | 10780
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | ChatVoiceRecorderVC.m
30 | file
31 |
32 |
33 |
34 |
35 | 2013-03-26T04:08:29.000000Z
36 | 64aa43b9b9315679fcd449846cd972a9
37 | 2013-03-26T04:10:51.553114Z
38 | 10780
39 | hjp
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 7536
62 |
63 | ChatRecorderView
64 | dir
65 |
66 | ChatVoiceRecorderVC.xib
67 | file
68 |
69 |
70 |
71 | delete
72 | 2013-03-25T08:20:47.000000Z
73 | edfbf4d7e8a6aa8ea35915701e06bc47
74 | 2013-03-25T09:02:51.040043Z
75 | 10761
76 | hjp
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | 6361
99 |
100 | ChatVoiceRecorderVC.h
101 | file
102 |
103 |
104 |
105 |
106 | 2013-03-25T09:00:23.000000Z
107 | 175b495481d5df8705c37968dcaab6e6
108 | 2013-03-25T09:02:51.040043Z
109 | 10761
110 | hjp
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | 548
133 |
134 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/AmrConvertAndRecord-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundlePrimaryIcon
14 |
15 | CFBundleIconFiles
16 |
17 | icon.png
18 | icon@2x.png
19 |
20 |
21 |
22 | CFBundleIdentifier
23 | com.xzw.${PRODUCT_NAME:rfc1034identifier}
24 | CFBundleInfoDictionaryVersion
25 | 6.0
26 | CFBundleName
27 | ${PRODUCT_NAME}
28 | CFBundlePackageType
29 | APPL
30 | CFBundleShortVersionString
31 | 1.0
32 | CFBundleSignature
33 | ????
34 | CFBundleVersion
35 | 1.0
36 | LSRequiresIPhoneOS
37 |
38 | UIRequiredDeviceCapabilities
39 |
40 | armv7
41 |
42 | UISupportedInterfaceOrientations
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationLandscapeLeft
46 | UIInterfaceOrientationLandscapeRight
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrnb/interf_enc.h:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_ENC_H
20 | #define OPENCORE_AMRNB_INTERF_ENC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #ifndef AMRNB_WRAPPER_INTERNAL
27 | /* Copied from enc/src/gsmamr_enc.h */
28 | enum Mode {
29 | MR475 = 0,/* 4.75 kbps */
30 | MR515, /* 5.15 kbps */
31 | MR59, /* 5.90 kbps */
32 | MR67, /* 6.70 kbps */
33 | MR74, /* 7.40 kbps */
34 | MR795, /* 7.95 kbps */
35 | MR102, /* 10.2 kbps */
36 | MR122, /* 12.2 kbps */
37 | MRDTX, /* DTX */
38 | N_MODES /* Not Used */
39 | };
40 | #endif
41 |
42 | void* Encoder_Interface_init(int dtx);
43 | void Encoder_Interface_exit(void* state);
44 | int Encoder_Interface_Encode(void* state, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/opencore-amrnb/.svn/text-base/interf_enc.h.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #ifndef OPENCORE_AMRNB_INTERF_ENC_H
20 | #define OPENCORE_AMRNB_INTERF_ENC_H
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #ifndef AMRNB_WRAPPER_INTERNAL
27 | /* Copied from enc/src/gsmamr_enc.h */
28 | enum Mode {
29 | MR475 = 0,/* 4.75 kbps */
30 | MR515, /* 5.15 kbps */
31 | MR59, /* 5.90 kbps */
32 | MR67, /* 6.70 kbps */
33 | MR74, /* 7.40 kbps */
34 | MR795, /* 7.95 kbps */
35 | MR102, /* 10.2 kbps */
36 | MR122, /* 12.2 kbps */
37 | MRDTX, /* DTX */
38 | N_MODES /* Not Used */
39 | };
40 | #endif
41 |
42 | void* Encoder_Interface_init(int dtx);
43 | void Encoder_Interface_exit(void* state);
44 | int Encoder_Interface_Encode(void* state, enum Mode mode, const short* speech, unsigned char* out, int forceSpeech);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/amrFileCodec.h:
--------------------------------------------------------------------------------
1 | //
2 | // amrFileCodec.h
3 | // amrDemoForiOS
4 | //
5 | // Created by Tang Xiaoping on 9/27/11.
6 | // Copyright 2011 test. All rights reserved.
7 | //
8 | #ifndef amrFileCodec_h
9 | #define amrFileCodec_h
10 | #include
11 | #include
12 | #include
13 | #include "interf_dec.h"
14 | #include "interf_enc.h"
15 |
16 | #define AMR_MAGIC_NUMBER "#!AMR\n"
17 |
18 | #define PCM_FRAME_SIZE 160 // 8khz 8000*0.02=160
19 | #define MAX_AMR_FRAME_SIZE 32
20 | #define AMR_FRAME_COUNT_PER_SECOND 50
21 |
22 | typedef struct
23 | {
24 | char chChunkID[4];
25 | int nChunkSize;
26 | }XCHUNKHEADER;
27 |
28 | typedef struct
29 | {
30 | short nFormatTag;
31 | short nChannels;
32 | int nSamplesPerSec;
33 | int nAvgBytesPerSec;
34 | short nBlockAlign;
35 | short nBitsPerSample;
36 | }WAVEFORMAT;
37 |
38 | typedef struct
39 | {
40 | short nFormatTag;
41 | short nChannels;
42 | int nSamplesPerSec;
43 | int nAvgBytesPerSec;
44 | short nBlockAlign;
45 | short nBitsPerSample;
46 | short nExSize;
47 | }WAVEFORMATX;
48 |
49 | typedef struct
50 | {
51 | char chRiffID[4];
52 | int nRiffSize;
53 | char chRiffFormat[4];
54 | }RIFFHEADER;
55 |
56 | typedef struct
57 | {
58 | char chFmtID[4];
59 | int nFmtSize;
60 | WAVEFORMAT wf;
61 | }FMTBLOCK;
62 |
63 | // WAVE音频采样频率是8khz
64 | // 音频样本单元数 = 8000*0.02 = 160 (由采样频率决定)
65 | // 声道数 1 : 160
66 | // 2 : 160*2 = 320
67 | // bps决定样本(sample)大小
68 | // bps = 8 --> 8位 unsigned char
69 | // 16 --> 16位 unsigned short
70 | int EncodeWAVEFileToAMRFile(const char* pchWAVEFilename, const char* pchAMRFileName, int nChannels, int nBitsPerSample);
71 |
72 | // 将AMR文件解码成WAVE文件
73 | int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename);
74 |
75 | #endif
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.svn/text-base/amrFileCodec.h.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // amrFileCodec.h
3 | // amrDemoForiOS
4 | //
5 | // Created by Tang Xiaoping on 9/27/11.
6 | // Copyright 2011 test. All rights reserved.
7 | //
8 | #ifndef amrFileCodec_h
9 | #define amrFileCodec_h
10 | #include
11 | #include
12 | #include
13 | #include "interf_dec.h"
14 | #include "interf_enc.h"
15 |
16 | #define AMR_MAGIC_NUMBER "#!AMR\n"
17 |
18 | #define PCM_FRAME_SIZE 160 // 8khz 8000*0.02=160
19 | #define MAX_AMR_FRAME_SIZE 32
20 | #define AMR_FRAME_COUNT_PER_SECOND 50
21 |
22 | typedef struct
23 | {
24 | char chChunkID[4];
25 | int nChunkSize;
26 | }XCHUNKHEADER;
27 |
28 | typedef struct
29 | {
30 | short nFormatTag;
31 | short nChannels;
32 | int nSamplesPerSec;
33 | int nAvgBytesPerSec;
34 | short nBlockAlign;
35 | short nBitsPerSample;
36 | }WAVEFORMAT;
37 |
38 | typedef struct
39 | {
40 | short nFormatTag;
41 | short nChannels;
42 | int nSamplesPerSec;
43 | int nAvgBytesPerSec;
44 | short nBlockAlign;
45 | short nBitsPerSample;
46 | short nExSize;
47 | }WAVEFORMATX;
48 |
49 | typedef struct
50 | {
51 | char chRiffID[4];
52 | int nRiffSize;
53 | char chRiffFormat[4];
54 | }RIFFHEADER;
55 |
56 | typedef struct
57 | {
58 | char chFmtID[4];
59 | int nFmtSize;
60 | WAVEFORMAT wf;
61 | }FMTBLOCK;
62 |
63 | // WAVE音频采样频率是8khz
64 | // 音频样本单元数 = 8000*0.02 = 160 (由采样频率决定)
65 | // 声道数 1 : 160
66 | // 2 : 160*2 = 320
67 | // bps决定样本(sample)大小
68 | // bps = 8 --> 8位 unsigned char
69 | // 16 --> 16位 unsigned short
70 | int EncodeWAVEFileToAMRFile(const char* pchWAVEFilename, const char* pchAMRFileName, int nChannels, int nBitsPerSample);
71 |
72 | // 将AMR文件解码成WAVE文件
73 | int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename);
74 |
75 | #endif
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 10838
5 | svn://hjp@192.168.0.240/repository/taojinroad/mobile/iphone/TJRtaojinroad/TJRtaojinroad/TJRManagerUI/VoiceConvert/amrwapper
6 | svn://hjp@192.168.0.240/repository
7 |
8 |
9 |
10 | 2013-03-26T03:01:29.834751Z
11 | 10772
12 | hjp
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | eccd39b4-39d4-47ab-bb89-e81f4763b8b8
28 |
29 | amrFileCodec.h
30 | file
31 |
32 |
33 |
34 |
35 | 2013-01-17T09:44:08.000000Z
36 | c53ac6ff08c29e3338da789e2c6482ff
37 | 2012-10-11T23:43:36.653566Z
38 | 7781
39 | hjp
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 1505
62 |
63 | wav.h
64 | file
65 |
66 |
67 |
68 |
69 | 2013-01-17T09:44:08.000000Z
70 | 518475e56474f4d14d568a671133550a
71 | 2012-10-11T23:43:36.653566Z
72 | 7781
73 | hjp
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 1206
96 |
97 | amrFileCodec.mm
98 | file
99 |
100 |
101 |
102 |
103 | 2013-03-25T14:04:18.000000Z
104 | 6787a44167d4b84f40391a6fc58259b8
105 | 2013-03-26T03:01:29.834751Z
106 | 10772
107 | hjp
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | 10422
130 |
131 | wav.mm
132 | file
133 |
134 |
135 |
136 |
137 | 2013-03-25T12:29:26.000000Z
138 | f364aaec5f1505a71c45d432fb191f62
139 | 2013-03-26T03:01:29.834751Z
140 | 10772
141 | hjp
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 | 2884
164 |
165 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/VoiceRecorderBaseVC.h:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceRecorderBaseVC.h
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AudioToolbox/AudioToolbox.h"
11 | #import
12 | #import
13 |
14 | //默认最大录音时间
15 | #define kDefaultMaxRecordTime 60
16 |
17 | @protocol VoiceRecorderBaseVCDelegate
18 |
19 | //录音完成回调,返回文件路径和文件名
20 | - (void)VoiceRecorderBaseVCRecordFinish:(NSString *)_filePath fileName:(NSString*)_fileName;
21 |
22 | @end
23 |
24 | @interface VoiceRecorderBaseVC : UIViewController{
25 |
26 | @protected
27 | NSInteger maxRecordTime; //最大录音时间
28 | NSString *recordFileName;//录音文件名
29 | NSString *recordFilePath;//录音文件路径
30 | }
31 |
32 | @property (assign, nonatomic) id vrbDelegate;
33 |
34 | @property (assign, nonatomic) NSInteger maxRecordTime;//最大录音时间
35 | @property (copy, nonatomic) NSString *recordFileName;//录音文件名
36 | @property (copy, nonatomic) NSString *recordFilePath;//录音文件路径
37 |
38 | /**
39 | 生成当前时间字符串
40 | @returns 当前时间字符串
41 | */
42 | + (NSString*)getCurrentTimeString;
43 |
44 | /**
45 | 获取缓存路径
46 | @returns 缓存路径
47 | */
48 | + (NSString*)getCacheDirectory;
49 |
50 | /**
51 | 判断文件是否存在
52 | @param _path 文件路径
53 | @returns 存在返回yes
54 | */
55 | + (BOOL)fileExistsAtPath:(NSString*)_path;
56 |
57 | /**
58 | 删除文件
59 | @param _path 文件路径
60 | @returns 成功返回yes
61 | */
62 | + (BOOL)deleteFileAtPath:(NSString*)_path;
63 |
64 |
65 | #pragma mark -
66 |
67 | /**
68 | 生成文件路径
69 | @param _fileName 文件名
70 | @param _type 文件类型
71 | @returns 文件路径
72 | */
73 | + (NSString*)getPathByFileName:(NSString *)_fileName;
74 | + (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type;
75 |
76 | /**
77 | 获取录音设置
78 | @returns 录音设置
79 | */
80 | + (NSDictionary*)getAudioRecorderSettingDict;
81 | @end
82 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/.svn/text-base/VoiceRecorderBaseVC.h.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceRecorderBaseVC.h
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import "TJRBaseViewController.h"
10 |
11 |
12 | //默认最大录音时间
13 | #define kDefaultMaxRecordTime 60
14 |
15 | @protocol VoiceRecorderBaseVCDelegate
16 |
17 | - (void)VoiceRecorderBaseVCRecordFinish:(NSString *)_filePath fileName:(NSString*)_fileName;
18 |
19 | @end
20 |
21 | @interface VoiceRecorderBaseVC : TJRBaseViewController{
22 |
23 | @protected
24 | NSInteger maxRecordTime; //最大录音时间
25 | NSString *recordFileName;//录音文件名
26 | NSString *recordFilePath;//录音文件路径
27 | }
28 |
29 | @property (assign, nonatomic) id vrbDelegate;
30 |
31 | @property (assign, nonatomic) NSInteger maxRecordTime;//最大录音时间
32 | @property (copy, nonatomic) NSString *recordFileName;//录音文件名
33 | @property (copy, nonatomic) NSString *recordFilePath;//录音文件路径
34 |
35 | /**
36 | 生成当前时间字符串
37 | @returns 当前时间字符串
38 | */
39 | + (NSString*)getCurrentTimeString;
40 |
41 | /**
42 | 获取缓存路径
43 | @returns 缓存路径
44 | */
45 | + (NSString*)getCacheDirectory;
46 |
47 | /**
48 | 判断文件是否存在
49 | @param _path 文件路径
50 | @returns 存在返回yes
51 | */
52 | + (BOOL)fileExistsAtPath:(NSString*)_path;
53 |
54 | /**
55 | 删除文件
56 | @param _path 文件路径
57 | @returns 成功返回yes
58 | */
59 | + (BOOL)deleteFileAtPath:(NSString*)_path;
60 |
61 |
62 | #pragma mark -
63 |
64 | /**
65 | 生成文件名
66 | @param _userId 用户id
67 | @param _topicId 房间id
68 | @param _type 文件类型
69 | @returns 文件名
70 | */
71 | + (NSString*)getFileNameByUserId:(NSString*)_userId topicId:(NSString*)_topicId;
72 | + (NSString*)getFileNameByUserId:(NSString*)_userId topicId:(NSString*)_topicId type:(NSString*)_type;
73 |
74 |
75 | /**
76 | 生成文件路径
77 | @param _fileName 文件名
78 | @param _type 文件类型
79 | @returns 文件路径
80 | */
81 | + (NSString*)getPathByFileName:(NSString *)_fileName;
82 | + (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type;
83 |
84 | /**
85 | 获取录音设置
86 | @returns 录音设置
87 | */
88 | + (NSDictionary*)getAudioRecorderSettingDict;
89 | @end
90 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/.svn/text-base/VoiceConverter.mm.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceConverter.m
3 | // taojinroad
4 | //
5 | // Created by Jeans Huang on 12-7-22.
6 | // Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
7 | //
8 |
9 | #import "VoiceConverter.h"
10 | #import "wav.h"
11 | #import "interf_dec.h"
12 | #import "dec_if.h"
13 | #import "interf_enc.h"
14 | #import "amrFileCodec.h"
15 |
16 | @implementation VoiceConverter
17 |
18 | + (int)amrToWav:(NSString *)fileNameString{
19 |
20 | NSString *path = [self getFilePath:fileNameString];
21 |
22 | NSString *savePath = [path stringByReplacingOccurrencesOfString:@"amr" withString:@"wav"];
23 |
24 | if (! DecodeAMRFileToWAVEFile([path cStringUsingEncoding:NSASCIIStringEncoding], [savePath cStringUsingEncoding:NSASCIIStringEncoding]))
25 | return 0;
26 |
27 | return 1;
28 | }
29 |
30 | + (int)wavToAmr:(NSString *)fileNameString{
31 |
32 | // NSString *path = [self getFilePath:fileNameString];
33 |
34 | // WAVE音频采样频率是8khz
35 | // 音频样本单元数 = 8000*0.02 = 160 (由采样频率决定)
36 | // 声道数 1 : 160
37 | // 2 : 160*2 = 320
38 | // bps决定样本(sample)大小
39 | // bps = 8 --> 8位 unsigned char
40 | // 16 --> 16位 unsigned short
41 |
42 | // EncodeWAVEFileToAMRFile([docFilePath cStringUsingEncoding:NSASCIIStringEncoding],[docFilePath2 cStringUsingEncoding:NSASCIIStringEncoding],1,16);
43 |
44 | NSString *savePath = [fileNameString stringByReplacingOccurrencesOfString:@"wav" withString:@"amr"];
45 |
46 | if (EncodeWAVEFileToAMRFile([fileNameString cStringUsingEncoding:NSASCIIStringEncoding], [savePath cStringUsingEncoding:NSASCIIStringEncoding], 1, 16))
47 | return 0;
48 |
49 | return 1;
50 | }
51 |
52 | //获取文件完整路径
53 | + (NSString*)getFilePath:(NSString*)fileNameString{
54 | // return fileNameString;
55 | NSString *documentsDirectory= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
56 |
57 | NSString* file=[[[[fileNameString componentsSeparatedByString:@"/"]lastObject]componentsSeparatedByString:@"="]lastObject];
58 |
59 | NSString *soundFilePath= [documentsDirectory
60 | stringByAppendingPathComponent:file];
61 |
62 | return soundFilePath;
63 | }
64 |
65 | + (BOOL)isFileExistWithFileName:(NSString*)fileName{
66 | BOOL exist = NO;
67 |
68 | NSFileManager *fileManager = [[NSFileManager alloc]init];
69 | exist = [fileManager fileExistsAtPath:[VoiceConverter getFilePath:fileName]];
70 | [fileManager release];
71 | return exist;
72 | }
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // AmrConvertAndRecord
4 | //
5 | // Created by Jeans on 3/29/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | #import "ViewController.h"
12 |
13 | @implementation AppDelegate
14 |
15 | - (void)dealloc
16 | {
17 | [_window release];
18 | [_viewController release];
19 | [super dealloc];
20 | }
21 |
22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
23 | {
24 | self.window = [[[CustomWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
25 | // Override point for customization after application launch.
26 | self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
27 | self.window.rootViewController = self.viewController;
28 | [self.window makeKeyAndVisible];
29 | return YES;
30 | }
31 |
32 | - (void)applicationWillResignActive:(UIApplication *)application
33 | {
34 | // 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.
35 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
36 | }
37 |
38 | - (void)applicationDidEnterBackground:(UIApplication *)application
39 | {
40 | // 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.
41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
42 | }
43 |
44 | - (void)applicationWillEnterForeground:(UIApplication *)application
45 | {
46 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
47 | }
48 |
49 | - (void)applicationDidBecomeActive:(UIApplication *)application
50 | {
51 | // 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.
52 | }
53 |
54 | - (void)applicationWillTerminate:(UIApplication *)application
55 | {
56 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/wav.mm:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #import
20 | #include "wav.h"
21 |
22 | void WavWriter::writeString(const char *str) {
23 | fputc(str[0], wav);
24 | fputc(str[1], wav);
25 | fputc(str[2], wav);
26 | fputc(str[3], wav);
27 | }
28 |
29 | void WavWriter::writeInt32(int value) {
30 | fputc((value >> 0) & 0xff, wav);
31 | fputc((value >> 8) & 0xff, wav);
32 | fputc((value >> 16) & 0xff, wav);
33 | fputc((value >> 24) & 0xff, wav);
34 | }
35 |
36 | void WavWriter::writeInt16(int value) {
37 | fputc((value >> 0) & 0xff, wav);
38 | fputc((value >> 8) & 0xff, wav);
39 | }
40 |
41 | void WavWriter::writeHeader(int length) {
42 | writeString("RIFF");
43 | writeInt32(4 + 8 + 20 + 8 + length); //将16改为20
44 | writeString("WAVE");
45 |
46 | writeString("fmt ");
47 | writeInt32(20);
48 |
49 | int bytesPerFrame = bitsPerSample/8*channels;
50 | int bytesPerSec = bytesPerFrame*sampleRate;
51 | writeInt16(1); // Format
52 | writeInt16(channels); // Channels
53 | writeInt32(sampleRate); // Samplerate
54 | writeInt32(bytesPerSec); // Bytes per sec
55 | writeInt16(bytesPerFrame); // Bytes per frame
56 | writeInt16(bitsPerSample); // Bits per sample
57 |
58 | writeInt32(0); //这儿需要字节对齐 nExSize
59 |
60 | writeString("data");
61 | writeInt32(length);
62 | }
63 |
64 | WavWriter::WavWriter(const char *filename, int sampleRate, int bitsPerSample, int channels)
65 | {
66 |
67 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
68 | NSString *documentPath = [paths objectAtIndex:0];
69 | NSString *docFilePath = [documentPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%s", filename]];
70 | NSLog(@"documentPath=%@", documentPath);
71 |
72 | wav = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "wb");
73 | if (wav == NULL)
74 | return;
75 | dataLength = 0;
76 | this->sampleRate = sampleRate;
77 | this->bitsPerSample = bitsPerSample;
78 | this->channels = channels;
79 |
80 | writeHeader(dataLength);
81 | }
82 |
83 | WavWriter::~WavWriter() {
84 | if (wav == NULL)
85 | return;
86 | fseek(wav, 0, SEEK_SET);
87 | writeHeader(dataLength);
88 | fclose(wav);
89 | }
90 |
91 | void WavWriter::writeData(const unsigned char* data, int length) {
92 | if (wav == NULL)
93 | return;
94 | fwrite(data, length, 1, wav);
95 | dataLength += length;
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.svn/text-base/wav.mm.svn-base:
--------------------------------------------------------------------------------
1 | /* ------------------------------------------------------------------
2 | * Copyright (C) 2009 Martin Storsjo
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 | * express or implied.
14 | * See the License for the specific language governing permissions
15 | * and limitations under the License.
16 | * -------------------------------------------------------------------
17 | */
18 |
19 | #import
20 | #include "wav.h"
21 |
22 | void WavWriter::writeString(const char *str) {
23 | fputc(str[0], wav);
24 | fputc(str[1], wav);
25 | fputc(str[2], wav);
26 | fputc(str[3], wav);
27 | }
28 |
29 | void WavWriter::writeInt32(int value) {
30 | fputc((value >> 0) & 0xff, wav);
31 | fputc((value >> 8) & 0xff, wav);
32 | fputc((value >> 16) & 0xff, wav);
33 | fputc((value >> 24) & 0xff, wav);
34 | }
35 |
36 | void WavWriter::writeInt16(int value) {
37 | fputc((value >> 0) & 0xff, wav);
38 | fputc((value >> 8) & 0xff, wav);
39 | }
40 |
41 | void WavWriter::writeHeader(int length) {
42 | writeString("RIFF");
43 | writeInt32(4 + 8 + 20 + 8 + length); //将16改为20
44 | writeString("WAVE");
45 |
46 | writeString("fmt ");
47 | writeInt32(20);
48 |
49 | int bytesPerFrame = bitsPerSample/8*channels;
50 | int bytesPerSec = bytesPerFrame*sampleRate;
51 | writeInt16(1); // Format
52 | writeInt16(channels); // Channels
53 | writeInt32(sampleRate); // Samplerate
54 | writeInt32(bytesPerSec); // Bytes per sec
55 | writeInt16(bytesPerFrame); // Bytes per frame
56 | writeInt16(bitsPerSample); // Bits per sample
57 |
58 | writeInt32(0); //这儿需要字节对齐 nExSize
59 |
60 | writeString("data");
61 | writeInt32(length);
62 | }
63 |
64 | WavWriter::WavWriter(const char *filename, int sampleRate, int bitsPerSample, int channels)
65 | {
66 |
67 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
68 | NSString *documentPath = [paths objectAtIndex:0];
69 | NSString *docFilePath = [documentPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%s", filename]];
70 | NSLog(@"documentPath=%@", documentPath);
71 |
72 | wav = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "wb");
73 | if (wav == NULL)
74 | return;
75 | dataLength = 0;
76 | this->sampleRate = sampleRate;
77 | this->bitsPerSample = bitsPerSample;
78 | this->channels = channels;
79 |
80 | writeHeader(dataLength);
81 | }
82 |
83 | WavWriter::~WavWriter() {
84 | if (wav == NULL)
85 | return;
86 | fseek(wav, 0, SEEK_SET);
87 | writeHeader(dataLength);
88 | fclose(wav);
89 | }
90 |
91 | void WavWriter::writeData(const unsigned char* data, int length) {
92 | if (wav == NULL)
93 | return;
94 | fwrite(data, length, 1, wav);
95 | dataLength += length;
96 | }
97 |
98 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/Jeans.xcuserdatad/xcschemes/AmrConvertAndRecord.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/dazhan.xcuserdatad/xcschemes/AmrConvertAndRecord.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/xcuserdata/justinjing.xcuserdatad/xcschemes/AmrConvertAndRecord.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/VoiceRecorderBaseVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceRecorderBaseVC.m
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "VoiceRecorderBaseVC.h"
10 |
11 | @interface VoiceRecorderBaseVC ()
12 | @end
13 |
14 | @implementation VoiceRecorderBaseVC
15 | @synthesize vrbDelegate,maxRecordTime,recordFileName,recordFilePath;
16 |
17 |
18 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19 | {
20 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21 | if (self) {
22 | // Custom initialization
23 | maxRecordTime = kDefaultMaxRecordTime;
24 | }
25 | return self;
26 | }
27 |
28 | - (void)viewDidLoad
29 | {
30 | [super viewDidLoad];
31 | // Do any additional setup after loading the view.
32 | }
33 |
34 | - (void)didReceiveMemoryWarning
35 | {
36 | [super didReceiveMemoryWarning];
37 | // Dispose of any resources that can be recreated.
38 | }
39 |
40 | - (void)dealloc{
41 | [recordFilePath release];
42 | [recordFileName release];
43 | [super dealloc];
44 | }
45 |
46 | /**
47 | 生成当前时间字符串
48 | @returns 当前时间字符串
49 | */
50 | + (NSString*)getCurrentTimeString
51 | {
52 | NSDateFormatter *dateformat=[[[NSDateFormatter alloc]init]autorelease];
53 | [dateformat setDateFormat:@"yyyyMMddHHmmss"];
54 | return [dateformat stringFromDate:[NSDate date]];
55 | }
56 |
57 |
58 | /**
59 | 获取缓存路径
60 | @returns 缓存路径
61 | */
62 | + (NSString*)getCacheDirectory
63 | {
64 | return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
65 |
66 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
67 | return [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Voice"];
68 | }
69 |
70 | /**
71 | 判断文件是否存在
72 | @param _path 文件路径
73 | @returns 存在返回yes
74 | */
75 | + (BOOL)fileExistsAtPath:(NSString*)_path
76 | {
77 | return [[NSFileManager defaultManager] fileExistsAtPath:_path];
78 | }
79 |
80 | /**
81 | 删除文件
82 | @param _path 文件路径
83 | @returns 成功返回yes
84 | */
85 | + (BOOL)deleteFileAtPath:(NSString*)_path
86 | {
87 | return [[NSFileManager defaultManager] removeItemAtPath:_path error:nil];
88 | }
89 |
90 | /**
91 | 生成文件路径
92 | @param _fileName 文件名
93 | @param _type 文件类型
94 | @returns 文件路径
95 | */
96 | + (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type
97 | {
98 | NSString* fileDirectory = [[[VoiceRecorderBaseVC getCacheDirectory]stringByAppendingPathComponent:_fileName]stringByAppendingPathExtension:_type];
99 | return fileDirectory;
100 | }
101 |
102 | /**
103 | 生成文件路径
104 | @param _fileName 文件名
105 | @returns 文件路径
106 | */
107 | + (NSString*)getPathByFileName:(NSString *)_fileName{
108 | NSString* fileDirectory = [[VoiceRecorderBaseVC getCacheDirectory]stringByAppendingPathComponent:_fileName];
109 | return fileDirectory;
110 | }
111 |
112 | /**
113 | 获取录音设置
114 | @returns 录音设置
115 | */
116 | + (NSDictionary*)getAudioRecorderSettingDict
117 | {
118 | NSDictionary *recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys:
119 | [NSNumber numberWithFloat: 8000.0],AVSampleRateKey, //采样率
120 | [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,
121 | [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采样位数 默认 16
122 | [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,//通道的数目
123 | // [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,//大端还是小端 是内存的组织方式
124 | // [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,//采样信号是整数还是浮点数
125 | // [NSNumber numberWithInt: AVAudioQualityMedium],AVEncoderAudioQualityKey,//音频编码质量
126 | nil];
127 | return [recordSetting autorelease];
128 | }
129 |
130 |
131 |
132 | @end
133 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/.svn/text-base/ChatRecorderView.m.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // ChatRecorderView.m
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/24/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import "ChatRecorderView.h"
10 |
11 | #define kTrashImage1 [UIImage imageNamed:@"recorder_trash_can0.png"]
12 | #define kTrashImage2 [UIImage imageNamed:@"recorder_trash_can1.png"]
13 | #define kTrashImage3 [UIImage imageNamed:@"recorder_trash_can2.png"]
14 |
15 | @interface ChatRecorderView(){
16 | NSArray *peakImageAry;
17 | NSArray *trashImageAry;
18 | BOOL isPrepareDelete;
19 | BOOL isTrashCanRocking;
20 | }
21 |
22 | @end
23 |
24 | @implementation ChatRecorderView
25 |
26 | - (id)initWithFrame:(CGRect)frame
27 | {
28 | self = [super initWithFrame:frame];
29 | if (self) {
30 | [self initilization];
31 | }
32 | return self;
33 | }
34 |
35 | - (id)initWithCoder:(NSCoder *)aDecoder{
36 | self = [super initWithCoder:aDecoder];
37 | if (self) {
38 | [self initilization];
39 | }
40 | return self;
41 | }
42 |
43 | - (void)initilization{
44 | //初始化音量peak峰值图片数组
45 | peakImageAry = [[NSArray alloc]initWithObjects:
46 | [UIImage imageNamed:@"recorder_mic_0.png"],
47 | [UIImage imageNamed:@"recorder_mic_1.png"],
48 | [UIImage imageNamed:@"recorder_mic_2.png"],
49 | [UIImage imageNamed:@"recorder_mic_3.png"], nil];
50 | trashImageAry = [[NSArray alloc]initWithObjects:kTrashImage1,kTrashImage2,kTrashImage3,kTrashImage2, nil];
51 | }
52 |
53 | - (void)dealloc {
54 | [peakImageAry release];
55 | [trashImageAry release];
56 | [_peakMeterIV release];
57 | [_trashCanIV release];
58 | [_countDownLabel release];
59 | [super dealloc];
60 | }
61 |
62 | #pragma mark -还原显示界面
63 | - (void)restoreDisplay{
64 | //还原录音图
65 | _peakMeterIV.image = [peakImageAry objectAtIndex:0];
66 | //停止震动
67 | [self rockTrashCan:NO];
68 | //还原倒计时文本
69 | _countDownLabel.text = @"";
70 | }
71 |
72 | #pragma mark - 是否准备删除
73 | - (void)prepareToDelete:(BOOL)_preareDelete{
74 | if (_preareDelete != isPrepareDelete) {
75 | isPrepareDelete = _preareDelete;
76 | [self rockTrashCan:isPrepareDelete];
77 | }
78 | }
79 | #pragma mark - 是否摇晃垃圾桶
80 | - (void)rockTrashCan:(BOOL)_isTure{
81 | if (_isTure != isTrashCanRocking) {
82 | isTrashCanRocking = _isTure;
83 | if (isTrashCanRocking) {
84 | //摇晃
85 | // CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
86 | // animation.fromValue = [NSNumber numberWithFloat:0.95];
87 | // animation.toValue = [NSNumber numberWithFloat:1.1];
88 | // animation.duration = 0.14;
89 | // animation.autoreverses = YES;
90 | // animation.repeatCount = NSIntegerMax;
91 | // animation.removedOnCompletion = NO;
92 | // animation.fillMode = kCAFillModeForwards;
93 | // [_trashCanIV.layer addAnimation:animation forKey:@"shakeAnimation"];
94 |
95 | // _trashCanIV.image = nil;
96 | _trashCanIV.animationImages = trashImageAry;
97 | _trashCanIV.animationRepeatCount = 0;
98 | _trashCanIV.animationDuration = 1;
99 | [_trashCanIV startAnimating];
100 | }else{
101 | //停止
102 | // [_trashCanIV.layer removeAnimationForKey:@"shakeAnimation"];
103 | if (_trashCanIV.isAnimating)
104 | [_trashCanIV stopAnimating];
105 | _trashCanIV.animationImages = nil;
106 | _trashCanIV.image = kTrashImage1;
107 | }
108 | }
109 | }
110 |
111 | //- (void)startShake
112 | //{
113 | // CABasicAnimation *shakeAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
114 | // shakeAnimation.duration = 0.08;
115 | // shakeAnimation.autoreverses = YES;
116 | // shakeAnimation.repeatCount = MAXFLOAT;
117 | // shakeAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, -0.1, 0, 0, 1)];
118 | // shakeAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, 0.1, 0, 0, 1)];
119 | //
120 | // [self.layer addAnimation:shakeAnimation forKey:@"shakeAnimation"];
121 | //}
122 | //
123 | //- (void)stopShake
124 | //{
125 | // [self.layer removeAnimationForKey:@"shakeAnimation"];
126 | //}
127 |
128 | #pragma mark - 更新音频峰值
129 | - (void)updateMetersByAvgPower:(float)_avgPower{
130 | //-160表示完全安静,0表示最大输入值
131 | //
132 |
133 | NSInteger imageIndex = 0;
134 | if (_avgPower >= -40 && _avgPower < -30)
135 | imageIndex = 1;
136 | else if (_avgPower >= -30 && _avgPower < -25)
137 | imageIndex = 2;
138 | else if (_avgPower >= -25)
139 | imageIndex = 3;
140 |
141 | _peakMeterIV.image = [peakImageAry objectAtIndex:imageIndex];
142 | }
143 |
144 | @end
145 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/ChatRecorderView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ChatRecorderView.m
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/24/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "ChatRecorderView.h"
10 |
11 | #define kTrashImage1 [UIImage imageNamed:@"recorder_trash_can0.png"]
12 | #define kTrashImage2 [UIImage imageNamed:@"recorder_trash_can1.png"]
13 | #define kTrashImage3 [UIImage imageNamed:@"recorder_trash_can2.png"]
14 |
15 | @interface ChatRecorderView(){
16 | NSMutableArray *peakImageAry;
17 | NSArray *trashImageAry;
18 | BOOL isPrepareDelete;
19 | BOOL isTrashCanRocking;
20 | }
21 |
22 | @end
23 |
24 | @implementation ChatRecorderView
25 |
26 | - (id)initWithFrame:(CGRect)frame
27 | {
28 | self = [super initWithFrame:frame];
29 | if (self) {
30 | [self initilization];
31 | }
32 | return self;
33 | }
34 |
35 | - (id)initWithCoder:(NSCoder *)aDecoder{
36 | self = [super initWithCoder:aDecoder];
37 | if (self) {
38 | [self initilization];
39 | }
40 | return self;
41 | }
42 |
43 | - (void)initilization{
44 | //初始化音量peak峰值图片数组
45 |
46 |
47 | peakImageAry = [[NSMutableArray alloc]initWithCapacity:2];
48 | for (int i=1; i<9; i++)
49 | {
50 | [peakImageAry addObject:[UIImage imageNamed:[NSString stringWithFormat:@"RecordingSignal00%d.png",i]]];
51 | }
52 |
53 | NSLog(@" peakImageAry ==%d", [peakImageAry count]);
54 | trashImageAry = [[NSArray alloc]initWithObjects:kTrashImage1,kTrashImage2,kTrashImage3,kTrashImage2, nil];
55 |
56 | self.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"chat_voice_03.png"]];
57 |
58 | UIImageView *phoneIV=[[UIImageView alloc]initWithFrame:CGRectMake(30, 10, 36, 100)];
59 | phoneIV.image=[UIImage imageNamed:@"RecordingBkg"];
60 | [self addSubview:phoneIV];
61 |
62 |
63 | _peakMeterIV=[[UIImageView alloc]initWithFrame:CGRectMake(76,48, 18, 61)];
64 | _peakMeterIV.image=[UIImage imageNamed:@"RecordingSignal000"];
65 | [self addSubview:_peakMeterIV];
66 | }
67 |
68 | - (void)dealloc {
69 | [peakImageAry release];
70 | [trashImageAry release];
71 | [_peakMeterIV release];
72 | [_trashCanIV release];
73 | [_countDownLabel release];
74 | [super dealloc];
75 | }
76 |
77 | #pragma mark -还原显示界面
78 | - (void)restoreDisplay{
79 | //停止震动
80 | [self rockTrashCan:NO];
81 | //还原倒计时文本
82 | _countDownLabel.text = @"";
83 | }
84 |
85 | #pragma mark - 是否准备删除
86 | - (void)prepareToDelete:(BOOL)_preareDelete{
87 | if (_preareDelete != isPrepareDelete) {
88 | isPrepareDelete = _preareDelete;
89 | [self rockTrashCan:isPrepareDelete];
90 | }
91 | }
92 | #pragma mark - 是否摇晃垃圾桶
93 | - (void)rockTrashCan:(BOOL)_isTure{
94 | if (_isTure != isTrashCanRocking) {
95 | isTrashCanRocking = _isTure;
96 | if (isTrashCanRocking) {
97 | //摇晃
98 | _trashCanIV.animationImages = trashImageAry;
99 | _trashCanIV.animationRepeatCount = 0;
100 | _trashCanIV.animationDuration = 1;
101 | [_trashCanIV startAnimating];
102 | }else{
103 | //停止
104 | if (_trashCanIV.isAnimating)
105 | [_trashCanIV stopAnimating];
106 | _trashCanIV.animationImages = nil;
107 | _trashCanIV.image = kTrashImage1;
108 | }
109 | }
110 | }
111 |
112 |
113 | #pragma mark - 更新音频峰值
114 | - (void)updateMetersByAvgPower:(float)lowPassResults{
115 |
116 | if (0 0) {
84 | player = [player initWithContentsOfURL:[NSURL URLWithString:[VoiceRecorderBaseVC getPathByFileName:originWav ofType:@"wav"]] error:nil];
85 | [player play];
86 | }
87 | }
88 | #pragma mark - wav转amr
89 | - (IBAction)wavToAmrBtnPressed:(id)sender {
90 | if (originWav.length > 0){
91 | NSDate *date = [NSDate date];
92 | self.convertAmr = [originWav stringByAppendingString:@"wavToAmr"];
93 |
94 | //转格式
95 | [VoiceConverter wavToAmr:[VoiceRecorderBaseVC getPathByFileName:originWav ofType:@"wav"] amrSavePath:[VoiceRecorderBaseVC getPathByFileName:convertAmr ofType:@"amr"]];
96 |
97 | [self setLabelByFilePath:[VoiceRecorderBaseVC getPathByFileName:convertAmr ofType:@"amr"] fileName:convertAmr convertTime:[[NSDate date] timeIntervalSinceDate:date] label:_wavToamrLabel];
98 | }
99 | }
100 | #pragma mark - amr转wav
101 | - (IBAction)amrToWavBtnPressed:(id)sender {
102 | if (convertAmr.length > 0){
103 | NSDate *date = [NSDate date];
104 | self.convertWav = [originWav stringByAppendingString:@"amrToWav"];
105 |
106 | //转格式
107 | [VoiceConverter amrToWav:[VoiceRecorderBaseVC getPathByFileName:convertAmr ofType:@"amr"] wavSavePath:[VoiceRecorderBaseVC getPathByFileName:convertWav ofType:@"wav"]];
108 |
109 | [self setLabelByFilePath:[VoiceRecorderBaseVC getPathByFileName:convertWav ofType:@"wav"] fileName:convertWav convertTime:[[NSDate date] timeIntervalSinceDate:date] label:_amrTowavLabel];
110 | }
111 | }
112 | #pragma mark - 播放转换后wav
113 | - (IBAction)playConvertWavBtnPressed:(id)sender {
114 | if (convertWav.length > 0){
115 | player = [player initWithContentsOfURL:[NSURL URLWithString:[VoiceRecorderBaseVC getPathByFileName:convertWav ofType:@"wav"]] error:nil];
116 | [player play];
117 | }
118 | }
119 |
120 | #pragma mark - VoiceRecorderBaseVC Delegate Methods
121 | //录音完成回调,返回文件路径和文件名
122 | - (void)VoiceRecorderBaseVCRecordFinish:(NSString *)_filePath fileName:(NSString*)_fileName{
123 | NSLog(@"录音完成,文件路径:%@",_filePath);
124 | [self setLabelByFilePath:_filePath fileName:_fileName convertTime:0 label:_originWavLabel];
125 | }
126 |
127 | #pragma mark - 根据文件设置label
128 | - (void)setLabelByFilePath:(NSString*)_filePath fileName:(NSString*)_fileName convertTime:(NSTimeInterval)_convertTime label:(UILabel*)_label{
129 |
130 | NSInteger size = [self getFileSize:_filePath]/1024;
131 | _label.text = [NSString stringWithFormat:@"文件名:%@\n文件大小:%dkb\n",_fileName,size];
132 |
133 | NSRange range = [_filePath rangeOfString:@"wav"];
134 | if (range.length > 0) {
135 | AVAudioPlayer *play = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL URLWithString:_filePath] error:nil];
136 | _label.text = [_label.text stringByAppendingFormat:@"文件时长:%f\n",play.duration];
137 | }
138 |
139 | if (_convertTime > 0)
140 | _label.text = [_label.text stringByAppendingFormat:@"转换时间:%f",_convertTime];
141 | }
142 | #pragma mark - 获取文件大小
143 | - (NSInteger) getFileSize:(NSString*) path{
144 | NSFileManager * filemanager = [[[NSFileManager alloc]init] autorelease];
145 | if([filemanager fileExistsAtPath:path]){
146 | NSDictionary * attributes = [filemanager attributesOfItemAtPath:path error:nil];
147 | NSNumber *theFileSize;
148 | if ( (theFileSize = [attributes objectForKey:NSFileSize]) )
149 | return [theFileSize intValue];
150 | else
151 | return -1;
152 | }
153 | else{
154 | return -1;
155 | }
156 | }
157 |
158 | @end
159 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/.svn/text-base/VoiceRecorderBaseVC.m.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // VoiceRecorderBaseVC.m
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import "VoiceRecorderBaseVC.h"
10 |
11 | @interface VoiceRecorderBaseVC ()
12 | @end
13 |
14 | @implementation VoiceRecorderBaseVC
15 | @synthesize vrbDelegate,maxRecordTime,recordFileName,recordFilePath;
16 |
17 |
18 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
19 | {
20 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
21 | if (self) {
22 | // Custom initialization
23 | maxRecordTime = kDefaultMaxRecordTime;
24 | }
25 | return self;
26 | }
27 |
28 | - (void)viewDidLoad
29 | {
30 | [super viewDidLoad];
31 | // Do any additional setup after loading the view.
32 | }
33 |
34 | - (void)didReceiveMemoryWarning
35 | {
36 | [super didReceiveMemoryWarning];
37 | // Dispose of any resources that can be recreated.
38 | }
39 |
40 | - (void)dealloc{
41 | [recordFilePath release];
42 | [recordFileName release];
43 | [super dealloc];
44 | }
45 |
46 | /**
47 | 生成当前时间字符串
48 | @returns 当前时间字符串
49 | */
50 | + (NSString*)getCurrentTimeString
51 | {
52 | NSDateFormatter *dateformat=[[[NSDateFormatter alloc]init]autorelease];
53 | [dateformat setDateFormat:@"yyyyMMddHHmmss"];
54 | return [dateformat stringFromDate:[NSDate date]];
55 | }
56 |
57 |
58 | /**
59 | 获取缓存路径
60 | @returns 缓存路径
61 | */
62 | + (NSString*)getCacheDirectory
63 | {
64 | return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
65 |
66 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
67 | return [[paths objectAtIndex:0]stringByAppendingPathComponent:@"Voice"];
68 | }
69 |
70 | /**
71 | 判断文件是否存在
72 | @param _path 文件路径
73 | @returns 存在返回yes
74 | */
75 | + (BOOL)fileExistsAtPath:(NSString*)_path
76 | {
77 | return [[NSFileManager defaultManager] fileExistsAtPath:_path];
78 | }
79 |
80 | /**
81 | 删除文件
82 | @param _path 文件路径
83 | @returns 成功返回yes
84 | */
85 | + (BOOL)deleteFileAtPath:(NSString*)_path
86 | {
87 | return [[NSFileManager defaultManager] removeItemAtPath:_path error:nil];
88 | }
89 | /**
90 | 生成文件名
91 | @param _userId 用户id
92 | @param _topicId 房间id
93 | @returns 文件名
94 | */
95 | + (NSString*)getFileNameByUserId:(NSString*)_userId topicId:(NSString*)_topicId{
96 | return [NSString stringWithFormat:@"%@_%@_%@",[VoiceRecorderBaseVC getCurrentTimeString],_topicId,_userId];
97 | }
98 |
99 | /**
100 | 生成文件名
101 | @param _userId 用户id
102 | @param _topicId 房间id
103 | @param _type 文件类型
104 | @returns 文件名
105 | */
106 | + (NSString*)getFileNameByUserId:(NSString*)_userId topicId:(NSString*)_topicId type:(NSString*)_type
107 | {
108 | return [NSString stringWithFormat:@"%@_%@_%@.%@",[VoiceRecorderBaseVC getCurrentTimeString],_topicId,_userId,_type];
109 | }
110 |
111 | /**
112 | 生成文件路径
113 | @param _fileName 文件名
114 | @param _type 文件类型
115 | @returns 文件路径
116 | */
117 | + (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type
118 | {
119 | NSString* fileDirectory = [[[VoiceRecorderBaseVC getCacheDirectory]stringByAppendingPathComponent:_fileName]stringByAppendingPathExtension:_type];
120 | return fileDirectory;
121 | }
122 |
123 | /**
124 | 生成文件路径
125 | @param _fileName 文件名
126 | @returns 文件路径
127 | */
128 | + (NSString*)getPathByFileName:(NSString *)_fileName{
129 | NSString* fileDirectory = [[VoiceRecorderBaseVC getCacheDirectory]stringByAppendingPathComponent:_fileName];
130 | return fileDirectory;
131 | }
132 |
133 | /**
134 | 获取录音设置
135 | @returns 录音设置
136 | */
137 | + (NSDictionary*)getAudioRecorderSettingDict
138 | {
139 | NSDictionary *recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys:
140 | [NSNumber numberWithFloat: 8000.0],AVSampleRateKey, //采样率
141 | [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,
142 | [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采样位数 默认 16
143 | [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,//通道的数目
144 | // [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,//大端还是小端 是内存的组织方式
145 | // [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,//采样信号是整数还是浮点数
146 | // [NSNumber numberWithInt: AVAudioQualityMedium],AVEncoderAudioQualityKey,//音频编码质量
147 | nil];
148 | return [recordSetting autorelease];
149 |
150 | // NSDictionary *recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys:
151 | // [NSNumber numberWithFloat: 44100],AVSampleRateKey, //采样率
152 | // [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,
153 | //// [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采样位数 默认 16
154 | // [NSNumber numberWithInt: 2], AVNumberOfChannelsKey,//通道的数目
155 | //// [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,//大端还是小端 是内存的组织方式
156 | // [NSNumber numberWithInt:AVAudioQualityMedium],AVEncoderAudioQualityKey,
157 | // nil];//采样信号是整数还是浮点数
158 | // return [recordSetting autorelease];
159 | NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
160 | [NSNumber numberWithFloat: 44100], AVSampleRateKey,
161 | [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,
162 | [NSNumber numberWithInt: 2], AVNumberOfChannelsKey,
163 | [NSNumber numberWithInt: AVAudioQualityMedium], AVEncoderAudioQualityKey,
164 | nil];
165 | return settings;
166 | }
167 |
168 |
169 |
170 | @end
171 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.svn/text-base/ChatVoiceRecorderVC.xib.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1552
5 | 11E53
6 | 3084
7 | 1138.47
8 | 569.00
9 |
13 |
14 | IBProxyObject
15 | IBUIImageView
16 | IBUIView
17 |
18 |
19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
20 |
21 |
25 |
26 |
30 |
34 |
78 |
79 |
80 |
81 |
82 |
83 | view
84 |
85 |
86 |
87 | 3
88 |
89 |
90 |
91 |
92 |
93 | 0
94 |
95 |
96 |
97 |
98 |
99 | 1
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | -1
108 |
109 |
110 | File's Owner
111 |
112 |
113 | -2
114 |
115 |
116 |
117 |
118 | 4
119 |
120 |
121 |
122 |
123 |
124 |
125 | ChatVoiceRecorderVC
126 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
127 | UIResponder
128 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
129 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
130 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
131 |
132 |
133 |
134 |
135 |
136 | 4
137 |
138 |
139 | 0
140 | IBCocoaTouchFramework
141 | YES
142 | 3
143 | 2083
144 |
145 |
146 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatVoiceRecorderVC.m:
--------------------------------------------------------------------------------
1 | //
2 | // ChatVoiceRecorderVC.m
3 | // Jeans
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "ChatVoiceRecorderVC.h"
10 | #import "UIView+Animation.h"
11 | #import "ChatRecorderView.h"
12 |
13 | @interface ChatVoiceRecorderVC (){
14 | CGFloat curCount; //当前计数,初始为0
15 | ChatRecorderView *recorderView; //录音界面
16 | CGPoint curTouchPoint; //触摸点
17 | BOOL canNotSend; //不能发送
18 | NSTimer *timer;
19 | }
20 |
21 | @property (retain, nonatomic) AVAudioRecorder *recorder;
22 |
23 | @end
24 |
25 | @implementation ChatVoiceRecorderVC
26 | @synthesize recorder;
27 |
28 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
29 | {
30 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
31 | if (self) {
32 | // Custom initialization
33 | }
34 | return self;
35 | }
36 |
37 | - (void)viewDidLoad
38 | {
39 | [super viewDidLoad];
40 | // Do any additional setup after loading the view from its nib.
41 | }
42 |
43 | - (void)didReceiveMemoryWarning
44 | {
45 | [super didReceiveMemoryWarning];
46 | // Dispose of any resources that can be recreated.
47 | }
48 |
49 | - (void)dealloc{
50 | [recorder release];
51 | [recorderView release];
52 | [super dealloc];
53 | }
54 |
55 | #pragma mark - 开始录音
56 | - (void)beginRecordByFileName:(NSString*)_fileName;{
57 |
58 | //设置文件名和录音路径
59 | self.recordFileName = _fileName;
60 | self.recordFilePath = [VoiceRecorderBaseVC getPathByFileName:recordFileName ofType:@"wav"];
61 |
62 | //初始化录音
63 | self.recorder = [[[AVAudioRecorder alloc]initWithURL:[NSURL URLWithString:recordFilePath]
64 | settings:[VoiceRecorderBaseVC getAudioRecorderSettingDict]
65 | error:nil]autorelease];
66 | recorder.delegate = self;
67 | recorder.meteringEnabled = YES;
68 |
69 | [recorder prepareToRecord];
70 |
71 | //还原计数
72 | curCount = 0;
73 | //还原发送
74 | canNotSend = NO;
75 |
76 | //开始录音
77 | [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error:nil];
78 | [[AVAudioSession sharedInstance] setActive:YES error:nil];
79 | UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
80 | AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
81 | [recorder record];
82 |
83 | //启动计时器
84 | [self startTimer];
85 |
86 | //显示录音界面
87 | [self initRecordView];
88 | [UIView showView:recorderView
89 | animateType:AnimateTypeOfPopping
90 | finalRect:kRecorderViewRect
91 | completion:^(BOOL finish){
92 | if (finish){
93 | //注册nScreenTouch事件
94 | [self addScreenTouchObserver];
95 | }
96 | }];
97 | //设置遮罩背景不可触摸
98 | [UIView setTopMaskViewCanTouch:NO];
99 | }
100 | #pragma mark - 初始化录音界面
101 |
102 | - (void)initRecordView
103 | {
104 | if (recorderView == nil)
105 | {
106 | recorderView = [[ChatRecorderView alloc]initWithFrame:CGRectMake(0, 0, 120, 120)];
107 | //还原界面显示
108 | [recorderView restoreDisplay];
109 | }
110 | }
111 | #pragma mark - 启动定时器
112 | - (void)startTimer{
113 | timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(updateMeters) userInfo:nil repeats:YES];
114 | }
115 |
116 | #pragma mark - 停止定时器
117 | - (void)stopTimer{
118 | if (timer && timer.isValid){
119 | [timer invalidate];
120 | timer = nil;
121 | }
122 | }
123 | #pragma mark - 更新音频峰值
124 | - (void)updateMeters{
125 | if (recorder.isRecording){
126 |
127 | //更新峰值
128 | [recorder updateMeters];
129 | double lowPassResults = pow(10, (0.05 * [recorder peakPowerForChannel:0]));
130 | [recorderView updateMetersByAvgPower:lowPassResults];
131 | // NSLog(@"峰值:%f",[recorder averagePowerForChannel:0]);
132 |
133 | //倒计时
134 | if (curCount >= maxRecordTime - 10 && curCount < maxRecordTime) {
135 | //剩下10秒
136 | recorderView.countDownLabel.text = [NSString stringWithFormat:@"录音剩下:%d秒",(int)(maxRecordTime-curCount)];
137 | }else if (curCount >= maxRecordTime){
138 | //时间到
139 | [self touchEnded:curTouchPoint];
140 | }
141 | curCount += 0.1f;
142 | }
143 | }
144 |
145 | #pragma mark - 移除触摸观察者
146 | - (void)removeScreenTouchObserver{
147 | [[NSNotificationCenter defaultCenter] removeObserver:self name:@"nScreenTouch" object:nil];//移除nScreenTouch事件
148 | }
149 | #pragma mark - 添加触摸观察者
150 | - (void)addScreenTouchObserver{
151 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onScreenTouch:) name:@"nScreenTouch" object:nil];
152 | }
153 | -(void)onScreenTouch:(NSNotification *)notification {
154 | UIEvent *event=[notification.userInfo objectForKey:@"data"];
155 | NSSet *allTouches = event.allTouches;
156 |
157 | //如果未触摸或只有单点触摸
158 | if ((curTouchPoint.x == CGPointZero.x && curTouchPoint.y == CGPointZero.y) || allTouches.count == 1)
159 | [self transferTouch:[allTouches anyObject]];
160 | else{
161 | //遍历touch,找到最先触摸的那个touch
162 | for (UITouch *touch in allTouches){
163 | CGPoint prePoint = [touch previousLocationInView:nil];
164 |
165 | if (prePoint.x == curTouchPoint.x && prePoint.y == curTouchPoint.y)
166 | [self transferTouch:touch];
167 | }
168 | }
169 | }
170 | //传递触点
171 | - (void)transferTouch:(UITouch*)_touch{
172 | CGPoint point = [_touch locationInView:nil];
173 | switch (_touch.phase) {
174 | case UITouchPhaseBegan:
175 | [self touchBegan:point];
176 | break;
177 | case UITouchPhaseMoved:
178 | [self touchMoved:point];
179 | break;
180 | case UITouchPhaseCancelled:
181 | case UITouchPhaseEnded:
182 | [self touchEnded:point];
183 | break;
184 | default:
185 | break;
186 | }
187 | }
188 | #pragma mark - 触摸开始
189 | - (void)touchBegan:(CGPoint)_point{
190 | curTouchPoint = _point;
191 | }
192 | #pragma mark - 触摸移动
193 | - (void)touchMoved:(CGPoint)_point{
194 | curTouchPoint = _point;
195 | //判断是否移动到取消区域
196 | canNotSend = _point.y < kCancelOriginY ? YES : NO;
197 |
198 | //设置取消动画
199 | [recorderView prepareToDelete:canNotSend];
200 | }
201 | #pragma mark - 触摸结束
202 | - (void)touchEnded:(CGPoint)_point{
203 | //停止计时器
204 | [self stopTimer];
205 |
206 | curTouchPoint = CGPointZero;
207 | [self removeScreenTouchObserver];
208 |
209 | [UIView hideViewByCompletion:^(BOOL finish){
210 |
211 | //停止录音
212 | if (recorder.isRecording)
213 | [recorder stop];
214 |
215 | if (canNotSend) {
216 | //取消发送,删除文件
217 | [VoiceRecorderBaseVC deleteFileAtPath:recordFilePath];
218 | }else{
219 | //回调录音文件路径
220 | if ([self.vrbDelegate respondsToSelector:@selector(VoiceRecorderBaseVCRecordFinish:fileName:)])
221 | [self.vrbDelegate VoiceRecorderBaseVCRecordFinish:recordFilePath fileName:recordFileName];
222 | }
223 | }];
224 | }
225 |
226 |
227 | #pragma mark - AVAudioRecorder Delegate Methods
228 | - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag{
229 | NSLog(@"录音停止");
230 |
231 | [self stopTimer];
232 | curCount = 0;
233 | }
234 | - (void)audioRecorderBeginInterruption:(AVAudioRecorder *)recorder{
235 | NSLog(@"录音开始");
236 | [self stopTimer];
237 | curCount = 0;
238 | }
239 | - (void)audioRecorderEndInterruption:(AVAudioRecorder *)recorder withOptions:(NSUInteger)flags{
240 | NSLog(@"录音中断");
241 | [self stopTimer];
242 | curCount = 0;
243 | }
244 |
245 | @end
246 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/.svn/text-base/ChatVoiceRecorderVC.m.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // ChatVoiceRecorderVC.m
3 | // TJRtaojinroad
4 | //
5 | // Created by Jeans on 3/23/13.
6 | // Copyright (c) 2013 淘金路. All rights reserved.
7 | //
8 |
9 | #import "ChatVoiceRecorderVC.h"
10 | #import "AudioToolbox/AudioToolbox.h"
11 | #import
12 | #import
13 | #import "UIView+Animation.h"
14 | #import "ChatRecorderView.h"
15 |
16 | @interface ChatVoiceRecorderVC (){
17 | CGFloat curCount; //当前计数,初始为0
18 | ChatRecorderView *recorderView; //录音界面
19 | CGPoint curTouchPoint; //触摸点
20 | BOOL canNotSend; //不能发送
21 | NSTimer *timer;
22 | }
23 |
24 | @property (retain, nonatomic) AVAudioRecorder *recorder;
25 |
26 | @end
27 |
28 | @implementation ChatVoiceRecorderVC
29 | @synthesize recorder;
30 |
31 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
32 | {
33 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
34 | if (self) {
35 | // Custom initialization
36 | }
37 | return self;
38 | }
39 |
40 | - (void)viewDidLoad
41 | {
42 | [super viewDidLoad];
43 | // Do any additional setup after loading the view from its nib.
44 | }
45 |
46 | - (void)didReceiveMemoryWarning
47 | {
48 | [super didReceiveMemoryWarning];
49 | // Dispose of any resources that can be recreated.
50 | }
51 |
52 | - (void)dealloc{
53 | [recorder release];
54 | TT_RELEASE_SAFELY(recorderView);
55 | [super dealloc];
56 | }
57 |
58 | #pragma mark - 开始录音
59 | - (void)beginRecordByChatTopicId:(NSString *)_topicId{
60 | //创建目录
61 | // [[NSFileManager defaultManager]createDirectoryAtPath:[VoiceRecorderBaseVC getCacheDirectory] withIntermediateDirectories:NO attributes:nil error:nil];
62 |
63 | //设置文件名和录音路径
64 | self.recordFileName = [VoiceRecorderBaseVC getFileNameByUserId:ROOTCONTROLLER_USER.userId topicId:_topicId];
65 | self.recordFilePath = [VoiceRecorderBaseVC getPathByFileName:recordFileName ofType:@"wav"];
66 |
67 | //初始化录音
68 | self.recorder = [[[AVAudioRecorder alloc]initWithURL:[NSURL URLWithString:recordFilePath] settings:[VoiceRecorderBaseVC getAudioRecorderSettingDict] error:nil]autorelease];
69 | recorder.delegate = self;
70 | recorder.meteringEnabled = YES;
71 |
72 | [recorder prepareToRecord];
73 |
74 | //还原计数
75 | curCount = 0;
76 | //还原发送
77 | canNotSend = NO;
78 |
79 | //开始录音
80 | [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error:nil];
81 | [[AVAudioSession sharedInstance] setActive:YES error:nil];
82 | [recorder record];
83 |
84 | //启动计时器
85 | [self startTimer];
86 |
87 | //显示录音界面
88 | [self initRecordView];
89 | [UIView showView:recorderView
90 | animateType:AnimateTypeOfPopping
91 | finalRect:kRecorderViewRect
92 | completion:^(BOOL finish){
93 | if (finish){
94 | //注册nScreenTouch事件
95 | [self addScreenTouchObserver];
96 |
97 | }
98 | }];
99 | //设置遮罩背景不可触摸
100 | [UIView setTopMaskViewCanTouch:NO];
101 | }
102 | #pragma mark - 初始化录音界面
103 | - (void)initRecordView{
104 | if (recorderView == nil)
105 | recorderView = (ChatRecorderView*)[[[[NSBundle mainBundle]loadNibNamed:@"ChatRecorderView" owner:self options:nil]lastObject]retain];
106 | //还原界面显示
107 | [recorderView restoreDisplay];
108 | }
109 | #pragma mark - 启动定时器
110 | - (void)startTimer{
111 | timer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(updateMeters) userInfo:nil repeats:YES];
112 | }
113 |
114 | #pragma mark - 停止定时器
115 | - (void)stopTimer{
116 | if (timer && timer.isValid){
117 | [timer invalidate];
118 | timer = nil;
119 | }
120 | }
121 | #pragma mark - 更新音频峰值
122 | - (void)updateMeters{
123 | if (recorder.isRecording){
124 |
125 | //更新峰值
126 | [recorder updateMeters];
127 | [recorderView updateMetersByAvgPower:[recorder averagePowerForChannel:0]];
128 | // NSLog(@"峰值:%f",[recorder averagePowerForChannel:0]);
129 |
130 | //倒计时
131 | if (curCount >= maxRecordTime - 10 && curCount < maxRecordTime) {
132 | //剩下10秒
133 | recorderView.countDownLabel.text = [NSString stringWithFormat:@"录音剩下:%d秒",(int)(maxRecordTime-curCount)];
134 | }else if (curCount >= maxRecordTime){
135 | //时间到
136 | [self touchEnded:curTouchPoint];
137 | }
138 | curCount += 0.1f;
139 | }
140 | }
141 |
142 | #pragma mark - 移除触摸观察者
143 | - (void)removeScreenTouchObserver{
144 | [[NSNotificationCenter defaultCenter] removeObserver:self name:@"nScreenTouch" object:nil];//移除nScreenTouch事件
145 | }
146 | #pragma mark - 添加触摸观察者
147 | - (void)addScreenTouchObserver{
148 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onScreenTouch:) name:@"nScreenTouch" object:nil];
149 | }
150 | -(void)onScreenTouch:(NSNotification *)notification {
151 | UIEvent *event=[notification.userInfo objectForKey:@"data"];
152 | NSSet *allTouches = event.allTouches;
153 |
154 | //如果未触摸或只有单点触摸
155 | if ((curTouchPoint.x == CGPointZero.x && curTouchPoint.y == CGPointZero.y) || allTouches.count == 1)
156 | [self transferTouch:[allTouches anyObject]];
157 | else{
158 | //遍历touch,找到最先触摸的那个touch
159 | for (UITouch *touch in allTouches){
160 | CGPoint prePoint = [touch previousLocationInView:nil];
161 |
162 | if (prePoint.x == curTouchPoint.x && prePoint.y == curTouchPoint.y)
163 | [self transferTouch:touch];
164 | }
165 | }
166 | }
167 | //传递触点
168 | - (void)transferTouch:(UITouch*)_touch{
169 | CGPoint point = [_touch locationInView:nil];
170 | switch (_touch.phase) {
171 | case UITouchPhaseBegan:
172 | [self touchBegan:point];
173 | break;
174 | case UITouchPhaseMoved:
175 | [self touchMoved:point];
176 | break;
177 | case UITouchPhaseCancelled:
178 | case UITouchPhaseEnded:
179 | [self touchEnded:point];
180 | break;
181 | default:
182 | break;
183 | }
184 | }
185 | #pragma mark - 触摸开始
186 | - (void)touchBegan:(CGPoint)_point{
187 | curTouchPoint = _point;
188 | }
189 | #pragma mark - 触摸移动
190 | - (void)touchMoved:(CGPoint)_point{
191 | curTouchPoint = _point;
192 | //判断是否移动到取消区域
193 | canNotSend = _point.y < kCancelOriginY ? YES : NO;
194 |
195 | //设置取消动画
196 | [recorderView prepareToDelete:canNotSend];
197 | }
198 | #pragma mark - 触摸结束
199 | - (void)touchEnded:(CGPoint)_point{
200 | //停止计时器
201 | [self stopTimer];
202 |
203 |
204 |
205 | curTouchPoint = CGPointZero;
206 | [self removeScreenTouchObserver];
207 |
208 | [UIView hideViewByCompletion:^(BOOL finish){
209 |
210 | //停止录音
211 | if (recorder.isRecording)
212 | [recorder stop];
213 |
214 | if (canNotSend) {
215 | //取消发送,删除文件
216 | [VoiceRecorderBaseVC deleteFileAtPath:recordFilePath];
217 | }else{
218 | //回调录音文件路径
219 | if ([self.vrbDelegate respondsToSelector:@selector(VoiceRecorderBaseVCRecordFinish:fileName:)])
220 | [self.vrbDelegate VoiceRecorderBaseVCRecordFinish:recordFilePath fileName:recordFileName];
221 | }
222 | }];
223 | }
224 |
225 |
226 | #pragma mark - AVAudioRecorder Delegate Methods
227 | - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag{
228 | NSLog(@"录音停止");
229 |
230 | [self stopTimer];
231 | curCount = 0;
232 | }
233 | - (void)audioRecorderBeginInterruption:(AVAudioRecorder *)recorder{
234 | NSLog(@"录音开始");
235 | [self stopTimer];
236 | curCount = 0;
237 | }
238 | - (void)audioRecorderEndInterruption:(AVAudioRecorder *)recorder withOptions:(NSUInteger)flags{
239 | NSLog(@"录音中断");
240 | [self stopTimer];
241 | curCount = 0;
242 | }
243 |
244 | @end
245 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/UIViewAnimation/UIView+Animation.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Animation.m
3 | //
4 | //
5 | // Created by Jeans on 3/9/13.
6 | // Copyright (c) 2013 Jeans. All rights reserved.
7 | //
8 |
9 | #import "UIView+Animation.h"
10 | #import "AppDelegate.h"
11 |
12 | #define kScaleMin 0.007f
13 | #define kScaleDefault 1.0f
14 | #define kScaleDelta 0.05f
15 |
16 |
17 | #define kFirstAnimateTime 0.3f
18 | #define kSecondAnimateTime 0.2f
19 |
20 | #define kMaskViewFinalAlpha 0.2f //背景的透明度
21 |
22 | @interface ViewInfo : NSObject{
23 | AnimateType aType; //动画类型
24 | UIView *displayView; //显示页面
25 | CGRect displayRect; //显示的位置
26 | UIControl *maskView; //遮挡页面
27 | void (^showBlock)(BOOL finished);
28 | void (^hideBlock)(BOOL finished);
29 | }
30 |
31 | @property (retain, nonatomic) UIView *displayView;
32 | @property (assign, nonatomic) AnimateType aType;
33 | @property (assign, nonatomic) CGRect displayRect;
34 | @property (retain, nonatomic) UIControl *maskView;
35 | @property (copy, nonatomic) void (^showBlock)(BOOL finished);
36 | @property (copy, nonatomic) void (^hideBlock)(BOOL finished);
37 | @end
38 |
39 | @implementation ViewInfo
40 |
41 | @synthesize displayView,aType,maskView,displayRect,showBlock,hideBlock;
42 | - (void)dealloc{
43 | Block_release(hideBlock);
44 | Block_release(showBlock);
45 | [maskView release];
46 | [displayView release];
47 | [super dealloc];
48 | }
49 |
50 | @end
51 |
52 | @implementation UIView (Animation)
53 |
54 | static NSMutableArray *displayViewAry;//已显示的页面数组
55 |
56 | #pragma mark - 获取顶部View
57 | + (AppDelegate *)getAppDelegate {
58 | return (AppDelegate *)[[UIApplication sharedApplication] delegate];
59 | }
60 | + (UIView *)getTopView{
61 | return [[[UIView getAppDelegate] viewController] view];
62 | }
63 |
64 | #pragma mark - 顶层maskView触摸
65 | + (void)setTopMaskViewCanTouch:(BOOL)_canTouch{
66 | ViewInfo *info = [displayViewAry lastObject];
67 | if (_canTouch)
68 | [info.maskView addTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
69 | else
70 | [info.maskView removeTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
71 | }
72 |
73 |
74 | #pragma mark - 下面的增加了完成块
75 | /**
76 | 显示view
77 | @param _view 需要显示的view
78 | @param _aType 动画类型
79 | @param _fRect 最终位置
80 | @param completion 动画块
81 | */
82 | + (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect completion:(void(^)(BOOL finished))completion{
83 | //初始化页面数组
84 | if (displayViewAry == nil)
85 | displayViewAry = [[NSMutableArray alloc]init];
86 |
87 | UIView *topView = [UIView getTopView];
88 |
89 | //存储页面信息
90 | ViewInfo *info = [[ViewInfo alloc]init];
91 | info.displayView = _view;
92 | info.aType = _aType;
93 | info.displayRect = _fRect;
94 |
95 | //初始化遮罩页面
96 | UIControl *maskView = [[UIControl alloc]init];
97 | maskView.backgroundColor = [UIColor blackColor];
98 | maskView.alpha = 0;
99 | maskView.frame = topView.bounds;
100 | [maskView addTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
101 | //添加页面
102 | [topView addSubview:maskView];
103 | [topView bringSubviewToFront:maskView];
104 |
105 | info.maskView = maskView;
106 | [maskView release];
107 |
108 | if (completion)
109 | info.showBlock = completion;
110 |
111 | [displayViewAry addObject:info];
112 | [info release];
113 |
114 |
115 | //根据不同的动画类型显示
116 | switch (_aType) {
117 | case AnimateTypeOfTV:
118 | [UIView showTV];
119 | break;
120 | case AnimateTypeOfPopping:
121 | [UIView showPopping];
122 | default:
123 | break;
124 | }
125 | }
126 | /**
127 | 显示view
128 | @param _view 需要显示的view
129 | @param _aType 动画类型
130 | @param _fRect 最终位置
131 | */
132 | + (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect{
133 | [self showView:_view animateType:_aType finalRect:_fRect completion:nil];
134 | }
135 |
136 |
137 | #pragma mark - 消失view
138 |
139 | + (void)hideViewByCompletion:(void(^)(BOOL finished))completion{
140 | if ([displayViewAry count] > 0){
141 | ViewInfo *info = [displayViewAry lastObject];
142 | if (completion)
143 | info.hideBlock = completion;
144 | }
145 | [UIView maskViewTouch];
146 | }
147 | + (void)hideViewByType:(AnimateType)_aType completion:(void(^)(BOOL finished))completion{
148 | if ([displayViewAry count] > 0){
149 | ViewInfo *info = [displayViewAry lastObject];
150 | info.aType = _aType;
151 | if (completion)
152 | info.hideBlock = completion;
153 | }
154 | [UIView maskViewTouch];
155 | }
156 | //
157 | + (void)hideView{
158 | [UIView hideViewByCompletion:nil];
159 | }
160 | + (void)hideViewByType:(AnimateType)_aType{
161 | [UIView hideViewByType:_aType completion:nil];
162 | }
163 |
164 | #pragma mark - 触摸背景
165 | + (void)maskViewTouch{
166 | if ([displayViewAry count] > 0){
167 | ViewInfo *info = [displayViewAry lastObject];
168 |
169 | //根据不同类型隐藏
170 | switch (info.aType) {
171 | case AnimateTypeOfTV:
172 | [UIView hideTV];
173 | break;
174 | case AnimateTypeOfPopping:
175 | [UIView hidePopping];
176 | break;
177 | default:
178 | break;
179 | }
180 | }
181 | }
182 | #pragma mark - 移除遮罩和已显示页面
183 | + (void)removeMaskViewAndDisplay:(ViewInfo*)info{
184 | if (info.aType == AnimateTypeOfTV || info.aType == AnimateTypeOfPopping) //TV,Popping 类型需要还原
185 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
186 |
187 | [info.displayView removeFromSuperview];
188 | [info.maskView removeFromSuperview];
189 | [displayViewAry removeObject:info];
190 | }
191 |
192 | #pragma mark - 显示动画
193 |
194 | #pragma mark - TV 显示
195 | + (void)showTV{
196 | ViewInfo *info = [displayViewAry lastObject];
197 | UIView *topView = [UIView getTopView];
198 | info.displayView.frame = info.displayRect;
199 | [topView addSubview:info.displayView];
200 | [topView bringSubviewToFront:info.displayView];
201 |
202 | info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
203 |
204 | //开始动画
205 | [UIView animateWithDuration:kSecondAnimateTime animations:^{
206 | info.maskView.alpha = 0.1f;
207 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleMin);
208 | }completion:^(BOOL finish){
209 | [UIView animateWithDuration:kFirstAnimateTime animations:^{
210 | info.maskView.alpha = kMaskViewFinalAlpha;
211 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
212 | }completion:^(BOOL finish){
213 | //调用完成动画块
214 | if (info.showBlock)
215 | info.showBlock(finish);
216 | }];
217 | }];
218 | }
219 | #pragma mark - TV 消失
220 | + (void)hideTV{
221 |
222 | ViewInfo *info = [displayViewAry lastObject];
223 |
224 | [UIView animateWithDuration:kSecondAnimateTime animations:^{
225 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleMin);
226 | }completion:^(BOOL finish){
227 | [UIView animateWithDuration:kFirstAnimateTime animations:^{
228 | info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
229 | info.maskView.alpha = 0;
230 | }completion:^(BOOL finish){
231 | //调用完成动画块
232 | if (info.hideBlock)
233 | info.hideBlock(finish);
234 | [UIView removeMaskViewAndDisplay:info];
235 | }];
236 | }];
237 | }
238 |
239 | #pragma mark - Popping 显示
240 | + (void)showPopping{
241 | ViewInfo *info = [displayViewAry lastObject];
242 | UIView *topView = [UIView getTopView];
243 | info.displayView.frame = info.displayRect;
244 | [topView addSubview:info.displayView];
245 | [topView bringSubviewToFront:info.displayView];
246 |
247 | info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
248 |
249 | //开始动画
250 | [UIView animateWithDuration:kFirstAnimateTime animations:^{
251 | info.maskView.alpha = kMaskViewFinalAlpha;
252 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault+kScaleDelta, kScaleDefault+kScaleDelta);
253 | }completion:^(BOOL finish){
254 | [UIView animateWithDuration:kSecondAnimateTime animations:^{
255 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault-kScaleDelta, kScaleDefault-kScaleDelta);
256 | }completion:^(BOOL finish){
257 | [UIView animateWithDuration:kSecondAnimateTime animations:^{
258 | info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
259 | }completion:^(BOOL finish){
260 | //调用完成动画块
261 | if (info.showBlock)
262 | info.showBlock(finish);
263 | }];
264 | }];
265 | }];
266 | }
267 | #pragma mark - Popping 消失
268 | + (void)hidePopping{
269 | ViewInfo *info = [displayViewAry lastObject];
270 |
271 | [UIView animateWithDuration:kFirstAnimateTime animations:^{
272 | info.maskView.alpha = 0;
273 | info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
274 | }completion:^(BOOL finish){
275 | //调用完成动画块
276 | if (info.hideBlock)
277 | info.hideBlock(finish);
278 | [UIView removeMaskViewAndDisplay:info];
279 | }];
280 | }
281 |
282 |
283 |
284 | @end
285 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceRecorderVC/ChatVoiceRecorderVC/ChatRecorderView/.svn/text-base/ChatRecorderView.xib.svn-base:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1552
5 | 11E53
6 | 3084
7 | 1138.47
8 | 569.00
9 |
10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
11 | 2083
12 |
13 |
14 | IBProxyObject
15 | IBUIImageView
16 | IBUILabel
17 | IBUIView
18 |
19 |
20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
21 |
22 |
23 | PluginDependencyRecalculationVersion
24 |
25 |
26 |
27 |
28 | IBFilesOwner
29 | IBCocoaTouchFramework
30 |
31 |
32 | IBFirstResponder
33 | IBCocoaTouchFramework
34 |
35 |
36 |
37 | 292
38 |
39 |
40 |
41 | 274
42 | {160, 160}
43 |
44 |
45 | _NS:9
46 | NO
47 | IBCocoaTouchFramework
48 |
49 | NSImage
50 | recorder_mic_0.png
51 |
52 |
53 |
54 |
55 | 265
56 | {{122, 111}, {31, 40}}
57 |
58 | _NS:9
59 | NO
60 | IBCocoaTouchFramework
61 |
62 | NSImage
63 | recorder_trash_can0.png
64 |
65 |
66 |
67 |
68 | 290
69 | {{8, 15}, {145, 21}}
70 |
71 |
72 | _NS:9
73 | NO
74 | YES
75 | 7
76 | NO
77 | IBCocoaTouchFramework
78 |
79 |
80 | 3
81 | MQA
82 |
83 |
84 | 0
85 | 1
86 |
87 | 1
88 | 17
89 |
90 |
91 | Helvetica
92 | 17
93 | 16
94 |
95 | NO
96 |
97 |
98 | {160, 160}
99 |
100 |
101 | _NS:9
102 |
103 | 3
104 | MCAwAA
105 |
106 |
107 | IBUISimulatedFreeformSizeMetricsSentinel
108 | Freeform
109 |
110 | IBCocoaTouchFramework
111 |
112 |
113 |
114 |
115 |
116 |
117 | peakMeterIV
118 |
119 |
120 |
121 | 5
122 |
123 |
124 |
125 | trashCanIV
126 |
127 |
128 |
129 | 6
130 |
131 |
132 |
133 | countDownLabel
134 |
135 |
136 |
137 | 8
138 |
139 |
140 |
141 |
142 |
143 | 0
144 |
145 |
146 |
147 |
148 |
149 | -1
150 |
151 |
152 | File's Owner
153 |
154 |
155 | -2
156 |
157 |
158 |
159 |
160 | 2
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | 3
171 |
172 |
173 |
174 |
175 | 4
176 |
177 |
178 |
179 |
180 | 7
181 |
182 |
183 |
184 |
185 |
186 |
187 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
188 | UIResponder
189 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
190 | ChatRecorderView
191 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
192 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
193 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
194 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin
195 |
196 |
197 |
198 |
199 |
200 | 8
201 |
202 |
203 | 0
204 | IBCocoaTouchFramework
205 | YES
206 | 3
207 |
208 | {131, 132}
209 | {23, 30}
210 |
211 | 2083
212 |
213 |
214 |
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/amrFileCodec.mm:
--------------------------------------------------------------------------------
1 | //
2 | // amrFileCodec.cpp
3 | // amrDemoForiOS
4 | //
5 | // Created by Tang Xiaoping on 9/27/11.
6 | // Copyright 2011 test. All rights reserved.
7 | //
8 |
9 | #include "amrFileCodec.h"
10 | int amrEncodeMode[] = {4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200}; // amr 编码方式
11 | // 从WAVE文件中跳过WAVE文件头,直接到PCM音频数据
12 | void SkipToPCMAudioData(FILE* fpwave)
13 | {
14 | RIFFHEADER riff;
15 | FMTBLOCK fmt;
16 | XCHUNKHEADER chunk;
17 | WAVEFORMATX wfx;
18 | int bDataBlock = 0;
19 |
20 | // 1. 读RIFF头
21 | fread(&riff, 1, sizeof(RIFFHEADER), fpwave);
22 |
23 | // 2. 读FMT块 - 如果 fmt.nFmtSize>16 说明需要还有一个附属大小没有读
24 | fread(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
25 | if ( chunk.nChunkSize>16 )
26 | {
27 | fread(&wfx, 1, sizeof(WAVEFORMATX), fpwave);
28 | }
29 | else
30 | {
31 | memcpy(fmt.chFmtID, chunk.chChunkID, 4);
32 | fmt.nFmtSize = chunk.nChunkSize;
33 | fread(&fmt.wf, 1, sizeof(WAVEFORMAT), fpwave);
34 | }
35 |
36 | // 3.转到data块 - 有些还有fact块等。
37 | while(!bDataBlock)
38 | {
39 | fread(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
40 | if ( !memcmp(chunk.chChunkID, "data", 4) )
41 | {
42 | bDataBlock = 1;
43 | break;
44 | }
45 | // 因为这个不是data块,就跳过块数据
46 | fseek(fpwave, chunk.nChunkSize, SEEK_CUR);
47 | }
48 | }
49 |
50 | // 从WAVE文件读一个完整的PCM音频帧
51 | // 返回值: 0-错误 >0: 完整帧大小
52 | int ReadPCMFrame(short speech[], FILE* fpwave, int nChannels, int nBitsPerSample)
53 | {
54 | int nRead = 0;
55 | int x = 0, y=0;
56 | // unsigned short ush1=0, ush2=0, ush=0;
57 |
58 | // 原始PCM音频帧数据
59 | unsigned char pcmFrame_8b1[PCM_FRAME_SIZE];
60 | unsigned char pcmFrame_8b2[PCM_FRAME_SIZE<<1];
61 | unsigned short pcmFrame_16b1[PCM_FRAME_SIZE];
62 | unsigned short pcmFrame_16b2[PCM_FRAME_SIZE<<1];
63 |
64 | if (nBitsPerSample==8 && nChannels==1)
65 | {
66 | nRead = fread(pcmFrame_8b1, (nBitsPerSample/8), PCM_FRAME_SIZE*nChannels, fpwave);
67 | for(x=0; x> 1;
86 | //speech[y] = (short)((short)ush << 7);
87 | }
88 | }
89 | else
90 | if (nBitsPerSample==16 && nChannels==1)
91 | {
92 | nRead = fread(pcmFrame_16b1, (nBitsPerSample/8), PCM_FRAME_SIZE*nChannels, fpwave);
93 | for(x=0; x> 1;
106 | }
107 | }
108 |
109 | // 如果读到的数据不是一个完整的PCM帧, 就返回0
110 | if (nRead 8位 unsigned char
121 | // 16 --> 16位 unsigned short
122 | int EncodeWAVEFileToAMRFile(const char* pchWAVEFilename, const char* pchAMRFileName, int nChannels, int nBitsPerSample)
123 | {
124 | FILE* fpwave;
125 | FILE* fpamr;
126 |
127 | /* input speech vector */
128 | short speech[160];
129 |
130 | /* counters */
131 | int byte_counter, frames = 0, bytes = 0;
132 |
133 | /* pointer to encoder state structure */
134 | void *enstate;
135 |
136 | /* requested mode */
137 | enum Mode req_mode = MR122;
138 | int dtx = 0;
139 |
140 | /* bitstream filetype */
141 | unsigned char amrFrame[MAX_AMR_FRAME_SIZE];
142 |
143 | fpwave = fopen(pchWAVEFilename, "rb");
144 | if (fpwave == NULL)
145 | {
146 | return 0;
147 | }
148 |
149 | // 创建并初始化amr文件
150 | fpamr = fopen(pchAMRFileName, "wb");
151 | if (fpamr == NULL)
152 | {
153 | fclose(fpwave);
154 | return 0;
155 | }
156 | /* write magic number to indicate single channel AMR file storage format */
157 | bytes = fwrite(AMR_MAGIC_NUMBER, sizeof(char), strlen(AMR_MAGIC_NUMBER), fpamr);
158 |
159 | /* skip to pcm audio data*/
160 | SkipToPCMAudioData(fpwave);
161 |
162 | enstate = Encoder_Interface_init(dtx);
163 |
164 | while(1)
165 | {
166 | // read one pcm frame
167 | if (!ReadPCMFrame(speech, fpwave, nChannels, nBitsPerSample)) break;
168 |
169 | frames++;
170 |
171 | /* call encoder */
172 | byte_counter = Encoder_Interface_Encode(enstate, req_mode, speech, amrFrame, 0);
173 |
174 | bytes += byte_counter;
175 | fwrite(amrFrame, sizeof (unsigned char), byte_counter, fpamr );
176 | }
177 |
178 | Encoder_Interface_exit(enstate);
179 |
180 | fclose(fpamr);
181 | fclose(fpwave);
182 |
183 | return frames;
184 | }
185 |
186 |
187 |
188 |
189 | #pragma mark - Decode
190 | //decode
191 | void WriteWAVEFileHeader(FILE* fpwave, int nFrame)
192 | {
193 | char tag[10] = "";
194 |
195 | // 1. 写RIFF头
196 | RIFFHEADER riff;
197 | strcpy(tag, "RIFF");
198 | memcpy(riff.chRiffID, tag, 4);
199 | riff.nRiffSize = 4 // WAVE
200 | + sizeof(XCHUNKHEADER) // fmt
201 | + sizeof(WAVEFORMATX) // WAVEFORMATX
202 | + sizeof(XCHUNKHEADER) // DATA
203 | + nFrame*160*sizeof(short); //
204 | strcpy(tag, "WAVE");
205 | memcpy(riff.chRiffFormat, tag, 4);
206 | fwrite(&riff, 1, sizeof(RIFFHEADER), fpwave);
207 |
208 | // 2. 写FMT块
209 | XCHUNKHEADER chunk;
210 | WAVEFORMATX wfx;
211 | strcpy(tag, "fmt ");
212 | memcpy(chunk.chChunkID, tag, 4);
213 | chunk.nChunkSize = sizeof(WAVEFORMATX);
214 | fwrite(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
215 | memset(&wfx, 0, sizeof(WAVEFORMATX));
216 | wfx.nFormatTag = 1;
217 | wfx.nChannels = 1; // 单声道
218 | wfx.nSamplesPerSec = 8000; // 8khz
219 | wfx.nAvgBytesPerSec = 16000;
220 | wfx.nBlockAlign = 2;
221 | wfx.nBitsPerSample = 16; // 16位
222 | fwrite(&wfx, 1, sizeof(WAVEFORMATX), fpwave);
223 |
224 | // 3. 写data块头
225 | strcpy(tag, "data");
226 | memcpy(chunk.chChunkID, tag, 4);
227 | chunk.nChunkSize = nFrame*160*sizeof(short);
228 | fwrite(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
229 | }
230 |
231 | const int myround(const double x)
232 | {
233 | return((int)(x+0.5));
234 | }
235 |
236 | // 根据帧头计算当前帧大小
237 | int caclAMRFrameSize(unsigned char frameHeader)
238 | {
239 | int mode;
240 | int temp1 = 0;
241 | int temp2 = 0;
242 | int frameSize;
243 |
244 | temp1 = frameHeader;
245 |
246 | // 编码方式编号 = 帧头的3-6位
247 | temp1 &= 0x78; // 0111-1000
248 | temp1 >>= 3;
249 |
250 | mode = amrEncodeMode[temp1];
251 |
252 | // 计算amr音频数据帧大小
253 | // 原理: amr 一帧对应20ms,那么一秒有50帧的音频数据
254 | temp2 = myround((double)(((double)mode / (double)AMR_FRAME_COUNT_PER_SECOND) / (double)8));
255 |
256 | frameSize = myround((double)temp2 + 0.5);
257 | return frameSize;
258 | }
259 |
260 | // 读第一个帧 - (参考帧)
261 | // 返回值: 0-出错; 1-正确
262 | int ReadAMRFrameFirst(FILE* fpamr, unsigned char frameBuffer[], int* stdFrameSize, unsigned char* stdFrameHeader)
263 | {
264 | memset(frameBuffer, 0, sizeof(frameBuffer));
265 |
266 | // 先读帧头
267 | fread(stdFrameHeader, 1, sizeof(unsigned char), fpamr);
268 | if (feof(fpamr)) return 0;
269 |
270 | // 根据帧头计算帧大小
271 | *stdFrameSize = caclAMRFrameSize(*stdFrameHeader);
272 |
273 | // 读首帧
274 | frameBuffer[0] = *stdFrameHeader;
275 | fread(&(frameBuffer[1]), 1, (*stdFrameSize-1)*sizeof(unsigned char), fpamr);
276 | if (feof(fpamr)) return 0;
277 |
278 | return 1;
279 | }
280 |
281 | // 返回值: 0-出错; 1-正确
282 | int ReadAMRFrame(FILE* fpamr, unsigned char frameBuffer[], int stdFrameSize, unsigned char stdFrameHeader)
283 | {
284 | int bytes = 0;
285 | unsigned char frameHeader; // 帧头
286 |
287 | memset(frameBuffer, 0, sizeof(frameBuffer));
288 |
289 | // 读帧头
290 | // 如果是坏帧(不是标准帧头),则继续读下一个字节,直到读到标准帧头
291 | while(1)
292 | {
293 | bytes = fread(&frameHeader, 1, sizeof(unsigned char), fpamr);
294 | if (feof(fpamr)) return 0;
295 | if (frameHeader == stdFrameHeader) break;
296 | }
297 |
298 | // 读该帧的语音数据(帧头已经读过)
299 | frameBuffer[0] = frameHeader;
300 | bytes = fread(&(frameBuffer[1]), 1, (stdFrameSize-1)*sizeof(unsigned char), fpamr);
301 | if (feof(fpamr)) return 0;
302 |
303 | return 1;
304 | }
305 |
306 | // 将AMR文件解码成WAVE文件
307 | int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename)
308 | {
309 |
310 |
311 | FILE* fpamr = NULL;
312 | FILE* fpwave = NULL;
313 | char magic[8];
314 | void * destate;
315 | int nFrameCount = 0;
316 | int stdFrameSize;
317 | unsigned char stdFrameHeader;
318 |
319 | unsigned char amrFrame[MAX_AMR_FRAME_SIZE];
320 | short pcmFrame[PCM_FRAME_SIZE];
321 |
322 | // NSString * path = [[NSBundle mainBundle] pathForResource: @"test" ofType: @"amr"];
323 | // fpamr = fopen([path cStringUsingEncoding:NSASCIIStringEncoding], "rb");
324 | fpamr = fopen(pchAMRFileName, "rb");
325 |
326 | if ( fpamr==NULL ) return 0;
327 |
328 | // 检查amr文件头
329 | fread(magic, sizeof(char), strlen(AMR_MAGIC_NUMBER), fpamr);
330 | if (strncmp(magic, AMR_MAGIC_NUMBER, strlen(AMR_MAGIC_NUMBER)))
331 | {
332 | fclose(fpamr);
333 | return 0;
334 | }
335 |
336 | // 创建并初始化WAVE文件
337 | // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
338 | // NSString *documentPath = [paths objectAtIndex:0];
339 | // NSString *docFilePath = [documentPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%s", pchWAVEFilename]];
340 | // NSLog(@"documentPath=%@", documentPath);
341 | //
342 | // fpwave = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "wb");
343 | fpwave = fopen(pchWAVEFilename,"wb");
344 |
345 | WriteWAVEFileHeader(fpwave, nFrameCount);
346 |
347 | /* init decoder */
348 | destate = Decoder_Interface_init();
349 |
350 | // 读第一帧 - 作为参考帧
351 | memset(amrFrame, 0, sizeof(amrFrame));
352 | memset(pcmFrame, 0, sizeof(pcmFrame));
353 | ReadAMRFrameFirst(fpamr, amrFrame, &stdFrameSize, &stdFrameHeader);
354 |
355 | // 解码一个AMR音频帧成PCM数据
356 | Decoder_Interface_Decode(destate, amrFrame, pcmFrame, 0);
357 | nFrameCount++;
358 | fwrite(pcmFrame, sizeof(short), PCM_FRAME_SIZE, fpwave);
359 |
360 | // 逐帧解码AMR并写到WAVE文件里
361 | while(1)
362 | {
363 | memset(amrFrame, 0, sizeof(amrFrame));
364 | memset(pcmFrame, 0, sizeof(pcmFrame));
365 | if (!ReadAMRFrame(fpamr, amrFrame, stdFrameSize, stdFrameHeader)) break;
366 |
367 | // 解码一个AMR音频帧成PCM数据 (8k-16b-单声道)
368 | Decoder_Interface_Decode(destate, amrFrame, pcmFrame, 0);
369 | nFrameCount++;
370 | fwrite(pcmFrame, sizeof(short), PCM_FRAME_SIZE, fpwave);
371 | }
372 | NSLog(@"frame = %d", nFrameCount);
373 | Decoder_Interface_exit(destate);
374 |
375 | fclose(fpwave);
376 |
377 | // 重写WAVE文件头
378 | // fpwave = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "r+");
379 | fpwave = fopen(pchWAVEFilename, "r+");
380 | WriteWAVEFileHeader(fpwave, nFrameCount);
381 | fclose(fpwave);
382 |
383 | return nFrameCount;
384 | }
--------------------------------------------------------------------------------
/AmrConvertAndRecord/VoiceConvert/amrwapper/.svn/text-base/amrFileCodec.mm.svn-base:
--------------------------------------------------------------------------------
1 | //
2 | // amrFileCodec.cpp
3 | // amrDemoForiOS
4 | //
5 | // Created by Tang Xiaoping on 9/27/11.
6 | // Copyright 2011 test. All rights reserved.
7 | //
8 |
9 | #include "amrFileCodec.h"
10 | int amrEncodeMode[] = {4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200}; // amr 编码方式
11 | // 从WAVE文件中跳过WAVE文件头,直接到PCM音频数据
12 | void SkipToPCMAudioData(FILE* fpwave)
13 | {
14 | RIFFHEADER riff;
15 | FMTBLOCK fmt;
16 | XCHUNKHEADER chunk;
17 | WAVEFORMATX wfx;
18 | int bDataBlock = 0;
19 |
20 | // 1. 读RIFF头
21 | fread(&riff, 1, sizeof(RIFFHEADER), fpwave);
22 |
23 | // 2. 读FMT块 - 如果 fmt.nFmtSize>16 说明需要还有一个附属大小没有读
24 | fread(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
25 | if ( chunk.nChunkSize>16 )
26 | {
27 | fread(&wfx, 1, sizeof(WAVEFORMATX), fpwave);
28 | }
29 | else
30 | {
31 | memcpy(fmt.chFmtID, chunk.chChunkID, 4);
32 | fmt.nFmtSize = chunk.nChunkSize;
33 | fread(&fmt.wf, 1, sizeof(WAVEFORMAT), fpwave);
34 | }
35 |
36 | // 3.转到data块 - 有些还有fact块等。
37 | while(!bDataBlock)
38 | {
39 | fread(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
40 | if ( !memcmp(chunk.chChunkID, "data", 4) )
41 | {
42 | bDataBlock = 1;
43 | break;
44 | }
45 | // 因为这个不是data块,就跳过块数据
46 | fseek(fpwave, chunk.nChunkSize, SEEK_CUR);
47 | }
48 | }
49 |
50 | // 从WAVE文件读一个完整的PCM音频帧
51 | // 返回值: 0-错误 >0: 完整帧大小
52 | int ReadPCMFrame(short speech[], FILE* fpwave, int nChannels, int nBitsPerSample)
53 | {
54 | int nRead = 0;
55 | int x = 0, y=0;
56 | unsigned short ush1=0, ush2=0, ush=0;
57 |
58 | // 原始PCM音频帧数据
59 | unsigned char pcmFrame_8b1[PCM_FRAME_SIZE];
60 | unsigned char pcmFrame_8b2[PCM_FRAME_SIZE<<1];
61 | unsigned short pcmFrame_16b1[PCM_FRAME_SIZE];
62 | unsigned short pcmFrame_16b2[PCM_FRAME_SIZE<<1];
63 |
64 | if (nBitsPerSample==8 && nChannels==1)
65 | {
66 | nRead = fread(pcmFrame_8b1, (nBitsPerSample/8), PCM_FRAME_SIZE*nChannels, fpwave);
67 | for(x=0; x> 1;
86 | //speech[y] = (short)((short)ush << 7);
87 | }
88 | }
89 | else
90 | if (nBitsPerSample==16 && nChannels==1)
91 | {
92 | nRead = fread(pcmFrame_16b1, (nBitsPerSample/8), PCM_FRAME_SIZE*nChannels, fpwave);
93 | for(x=0; x> 1;
106 | }
107 | }
108 |
109 | // 如果读到的数据不是一个完整的PCM帧, 就返回0
110 | if (nRead 8位 unsigned char
121 | // 16 --> 16位 unsigned short
122 | int EncodeWAVEFileToAMRFile(const char* pchWAVEFilename, const char* pchAMRFileName, int nChannels, int nBitsPerSample)
123 | {
124 | FILE* fpwave;
125 | FILE* fpamr;
126 |
127 | /* input speech vector */
128 | short speech[160];
129 |
130 | /* counters */
131 | int byte_counter, frames = 0, bytes = 0;
132 |
133 | /* pointer to encoder state structure */
134 | void *enstate;
135 |
136 | /* requested mode */
137 | enum Mode req_mode = MR122;
138 | int dtx = 0;
139 |
140 | /* bitstream filetype */
141 | unsigned char amrFrame[MAX_AMR_FRAME_SIZE];
142 |
143 | fpwave = fopen(pchWAVEFilename, "rb");
144 | if (fpwave == NULL)
145 | {
146 | return 0;
147 | }
148 |
149 | // 创建并初始化amr文件
150 | fpamr = fopen(pchAMRFileName, "wb");
151 | if (fpamr == NULL)
152 | {
153 | fclose(fpwave);
154 | return 0;
155 | }
156 | /* write magic number to indicate single channel AMR file storage format */
157 | bytes = fwrite(AMR_MAGIC_NUMBER, sizeof(char), strlen(AMR_MAGIC_NUMBER), fpamr);
158 |
159 | /* skip to pcm audio data*/
160 | SkipToPCMAudioData(fpwave);
161 |
162 | enstate = Encoder_Interface_init(dtx);
163 |
164 | while(1)
165 | {
166 | // read one pcm frame
167 | if (!ReadPCMFrame(speech, fpwave, nChannels, nBitsPerSample)) break;
168 |
169 | frames++;
170 |
171 | /* call encoder */
172 | byte_counter = Encoder_Interface_Encode(enstate, req_mode, speech, amrFrame, 0);
173 |
174 | bytes += byte_counter;
175 | fwrite(amrFrame, sizeof (unsigned char), byte_counter, fpamr );
176 | }
177 |
178 | Encoder_Interface_exit(enstate);
179 |
180 | fclose(fpamr);
181 | fclose(fpwave);
182 |
183 | return frames;
184 | }
185 |
186 |
187 |
188 |
189 | #pragma mark - Decode
190 | //decode
191 | void WriteWAVEFileHeader(FILE* fpwave, int nFrame)
192 | {
193 | char tag[10] = "";
194 |
195 | // 1. 写RIFF头
196 | RIFFHEADER riff;
197 | strcpy(tag, "RIFF");
198 | memcpy(riff.chRiffID, tag, 4);
199 | riff.nRiffSize = 4 // WAVE
200 | + sizeof(XCHUNKHEADER) // fmt
201 | + sizeof(WAVEFORMATX) // WAVEFORMATX
202 | + sizeof(XCHUNKHEADER) // DATA
203 | + nFrame*160*sizeof(short); //
204 | strcpy(tag, "WAVE");
205 | memcpy(riff.chRiffFormat, tag, 4);
206 | fwrite(&riff, 1, sizeof(RIFFHEADER), fpwave);
207 |
208 | // 2. 写FMT块
209 | XCHUNKHEADER chunk;
210 | WAVEFORMATX wfx;
211 | strcpy(tag, "fmt ");
212 | memcpy(chunk.chChunkID, tag, 4);
213 | chunk.nChunkSize = sizeof(WAVEFORMATX);
214 | fwrite(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
215 | memset(&wfx, 0, sizeof(WAVEFORMATX));
216 | wfx.nFormatTag = 1;
217 | wfx.nChannels = 1; // 单声道
218 | wfx.nSamplesPerSec = 8000; // 8khz
219 | wfx.nAvgBytesPerSec = 16000;
220 | wfx.nBlockAlign = 2;
221 | wfx.nBitsPerSample = 16; // 16位
222 | fwrite(&wfx, 1, sizeof(WAVEFORMATX), fpwave);
223 |
224 | // 3. 写data块头
225 | strcpy(tag, "data");
226 | memcpy(chunk.chChunkID, tag, 4);
227 | chunk.nChunkSize = nFrame*160*sizeof(short);
228 | fwrite(&chunk, 1, sizeof(XCHUNKHEADER), fpwave);
229 | }
230 |
231 | const int myround(const double x)
232 | {
233 | return((int)(x+0.5));
234 | }
235 |
236 | // 根据帧头计算当前帧大小
237 | int caclAMRFrameSize(unsigned char frameHeader)
238 | {
239 | int mode;
240 | int temp1 = 0;
241 | int temp2 = 0;
242 | int frameSize;
243 |
244 | temp1 = frameHeader;
245 |
246 | // 编码方式编号 = 帧头的3-6位
247 | temp1 &= 0x78; // 0111-1000
248 | temp1 >>= 3;
249 |
250 | mode = amrEncodeMode[temp1];
251 |
252 | // 计算amr音频数据帧大小
253 | // 原理: amr 一帧对应20ms,那么一秒有50帧的音频数据
254 | temp2 = myround((double)(((double)mode / (double)AMR_FRAME_COUNT_PER_SECOND) / (double)8));
255 |
256 | frameSize = myround((double)temp2 + 0.5);
257 | return frameSize;
258 | }
259 |
260 | // 读第一个帧 - (参考帧)
261 | // 返回值: 0-出错; 1-正确
262 | int ReadAMRFrameFirst(FILE* fpamr, unsigned char frameBuffer[], int* stdFrameSize, unsigned char* stdFrameHeader)
263 | {
264 | memset(frameBuffer, 0, sizeof(frameBuffer));
265 |
266 | // 先读帧头
267 | fread(stdFrameHeader, 1, sizeof(unsigned char), fpamr);
268 | if (feof(fpamr)) return 0;
269 |
270 | // 根据帧头计算帧大小
271 | *stdFrameSize = caclAMRFrameSize(*stdFrameHeader);
272 |
273 | // 读首帧
274 | frameBuffer[0] = *stdFrameHeader;
275 | fread(&(frameBuffer[1]), 1, (*stdFrameSize-1)*sizeof(unsigned char), fpamr);
276 | if (feof(fpamr)) return 0;
277 |
278 | return 1;
279 | }
280 |
281 | // 返回值: 0-出错; 1-正确
282 | int ReadAMRFrame(FILE* fpamr, unsigned char frameBuffer[], int stdFrameSize, unsigned char stdFrameHeader)
283 | {
284 | int bytes = 0;
285 | unsigned char frameHeader; // 帧头
286 |
287 | memset(frameBuffer, 0, sizeof(frameBuffer));
288 |
289 | // 读帧头
290 | // 如果是坏帧(不是标准帧头),则继续读下一个字节,直到读到标准帧头
291 | while(1)
292 | {
293 | bytes = fread(&frameHeader, 1, sizeof(unsigned char), fpamr);
294 | if (feof(fpamr)) return 0;
295 | if (frameHeader == stdFrameHeader) break;
296 | }
297 |
298 | // 读该帧的语音数据(帧头已经读过)
299 | frameBuffer[0] = frameHeader;
300 | bytes = fread(&(frameBuffer[1]), 1, (stdFrameSize-1)*sizeof(unsigned char), fpamr);
301 | if (feof(fpamr)) return 0;
302 |
303 | return 1;
304 | }
305 |
306 | // 将AMR文件解码成WAVE文件
307 | int DecodeAMRFileToWAVEFile(const char* pchAMRFileName, const char* pchWAVEFilename)
308 | {
309 |
310 |
311 | FILE* fpamr = NULL;
312 | FILE* fpwave = NULL;
313 | char magic[8];
314 | void * destate;
315 | int nFrameCount = 0;
316 | int stdFrameSize;
317 | unsigned char stdFrameHeader;
318 |
319 | unsigned char amrFrame[MAX_AMR_FRAME_SIZE];
320 | short pcmFrame[PCM_FRAME_SIZE];
321 |
322 | // NSString * path = [[NSBundle mainBundle] pathForResource: @"test" ofType: @"amr"];
323 | // fpamr = fopen([path cStringUsingEncoding:NSASCIIStringEncoding], "rb");
324 | fpamr = fopen(pchAMRFileName, "rb");
325 |
326 | if ( fpamr==NULL ) return 0;
327 |
328 | // 检查amr文件头
329 | fread(magic, sizeof(char), strlen(AMR_MAGIC_NUMBER), fpamr);
330 | if (strncmp(magic, AMR_MAGIC_NUMBER, strlen(AMR_MAGIC_NUMBER)))
331 | {
332 | fclose(fpamr);
333 | return 0;
334 | }
335 |
336 | // 创建并初始化WAVE文件
337 | // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
338 | // NSString *documentPath = [paths objectAtIndex:0];
339 | // NSString *docFilePath = [documentPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%s", pchWAVEFilename]];
340 | // NSLog(@"documentPath=%@", documentPath);
341 | //
342 | // fpwave = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "wb");
343 | fpwave = fopen(pchWAVEFilename,"wb");
344 |
345 | WriteWAVEFileHeader(fpwave, nFrameCount);
346 |
347 | /* init decoder */
348 | destate = Decoder_Interface_init();
349 |
350 | // 读第一帧 - 作为参考帧
351 | memset(amrFrame, 0, sizeof(amrFrame));
352 | memset(pcmFrame, 0, sizeof(pcmFrame));
353 | ReadAMRFrameFirst(fpamr, amrFrame, &stdFrameSize, &stdFrameHeader);
354 |
355 | // 解码一个AMR音频帧成PCM数据
356 | Decoder_Interface_Decode(destate, amrFrame, pcmFrame, 0);
357 | nFrameCount++;
358 | fwrite(pcmFrame, sizeof(short), PCM_FRAME_SIZE, fpwave);
359 |
360 | // 逐帧解码AMR并写到WAVE文件里
361 | while(1)
362 | {
363 | memset(amrFrame, 0, sizeof(amrFrame));
364 | memset(pcmFrame, 0, sizeof(pcmFrame));
365 | if (!ReadAMRFrame(fpamr, amrFrame, stdFrameSize, stdFrameHeader)) break;
366 |
367 | // 解码一个AMR音频帧成PCM数据 (8k-16b-单声道)
368 | Decoder_Interface_Decode(destate, amrFrame, pcmFrame, 0);
369 | nFrameCount++;
370 | fwrite(pcmFrame, sizeof(short), PCM_FRAME_SIZE, fpwave);
371 | }
372 | NSLog(@"frame = %d", nFrameCount);
373 | Decoder_Interface_exit(destate);
374 |
375 | fclose(fpwave);
376 |
377 | // 重写WAVE文件头
378 | // fpwave = fopen([docFilePath cStringUsingEncoding:NSASCIIStringEncoding], "r+");
379 | fpwave = fopen(pchWAVEFilename, "r+");
380 | WriteWAVEFileHeader(fpwave, nFrameCount);
381 | fclose(fpwave);
382 |
383 | return nFrameCount;
384 | }
--------------------------------------------------------------------------------
/AmrConvertAndRecord.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 2E370EFF1706901200176863 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E370EFE1706901200176863 /* icon.png */; };
11 | 2E370F011706901700176863 /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2E370F001706901700176863 /* icon@2x.png */; };
12 | 2E9151F61705D45500245A79 /* CustomWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E9151F51705D45500245A79 /* CustomWindow.m */; };
13 | 2EDEC378170590E40028A6CF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC377170590E40028A6CF /* UIKit.framework */; };
14 | 2EDEC37A170590E40028A6CF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC379170590E40028A6CF /* Foundation.framework */; };
15 | 2EDEC37C170590E40028A6CF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC37B170590E40028A6CF /* CoreGraphics.framework */; };
16 | 2EDEC382170590E40028A6CF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC380170590E40028A6CF /* InfoPlist.strings */; };
17 | 2EDEC384170590E50028A6CF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC383170590E50028A6CF /* main.m */; };
18 | 2EDEC388170590E50028A6CF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC387170590E50028A6CF /* AppDelegate.m */; };
19 | 2EDEC38A170590E50028A6CF /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC389170590E50028A6CF /* Default.png */; };
20 | 2EDEC38C170590E50028A6CF /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC38B170590E50028A6CF /* Default@2x.png */; };
21 | 2EDEC38E170590E50028A6CF /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC38D170590E50028A6CF /* Default-568h@2x.png */; };
22 | 2EDEC391170590E50028A6CF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC390170590E50028A6CF /* ViewController.m */; };
23 | 2EDEC394170590E50028A6CF /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC392170590E50028A6CF /* ViewController.xib */; };
24 | 2EDEC39C170591340028A6CF /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC39A170591340028A6CF /* AudioToolbox.framework */; };
25 | 2EDEC39D170591340028A6CF /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC39B170591340028A6CF /* CoreAudio.framework */; };
26 | 2EDEC39F170591390028A6CF /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC39E170591390028A6CF /* AVFoundation.framework */; };
27 | 2EDEC3A3170598D90028A6CF /* UIView+Animation.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3A2170598D90028A6CF /* UIView+Animation.m */; };
28 | 2EDEC3BE1705A31C0028A6CF /* ChatRecorderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3B71705A31C0028A6CF /* ChatRecorderView.m */; };
29 | 2EDEC3C01705A31C0028A6CF /* ChatVoiceRecorderVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3BA1705A31C0028A6CF /* ChatVoiceRecorderVC.m */; };
30 | 2EDEC3C21705A31C0028A6CF /* VoiceRecorderBaseVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3BD1705A31C0028A6CF /* VoiceRecorderBaseVC.m */; };
31 | 2EDEC3D41705A3280028A6CF /* amrFileCodec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3C61705A3280028A6CF /* amrFileCodec.mm */; };
32 | 2EDEC3D51705A3280028A6CF /* wav.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3C81705A3280028A6CF /* wav.mm */; };
33 | 2EDEC3D61705A3280028A6CF /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC3CA1705A3280028A6CF /* libopencore-amrnb.a */; };
34 | 2EDEC3D71705A3280028A6CF /* libopencore-amrwb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EDEC3CB1705A3280028A6CF /* libopencore-amrwb.a */; };
35 | 2EDEC3D81705A3280028A6CF /* VoiceConverter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEC3D31705A3280028A6CF /* VoiceConverter.mm */; };
36 | 2EDEC3DF1705A41F0028A6CF /* recorder_trash_can0.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3D91705A41F0028A6CF /* recorder_trash_can0.png */; };
37 | 2EDEC3E01705A41F0028A6CF /* recorder_trash_can0@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3DA1705A41F0028A6CF /* recorder_trash_can0@2x.png */; };
38 | 2EDEC3E11705A41F0028A6CF /* recorder_trash_can1.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3DB1705A41F0028A6CF /* recorder_trash_can1.png */; };
39 | 2EDEC3E21705A41F0028A6CF /* recorder_trash_can1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3DC1705A41F0028A6CF /* recorder_trash_can1@2x.png */; };
40 | 2EDEC3E31705A41F0028A6CF /* recorder_trash_can2.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3DD1705A41F0028A6CF /* recorder_trash_can2.png */; };
41 | 2EDEC3E41705A41F0028A6CF /* recorder_trash_can2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2EDEC3DE1705A41F0028A6CF /* recorder_trash_can2@2x.png */; };
42 | FEF759B717A7BF1400736E7F /* chat_voice_03@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A417A7BF1400736E7F /* chat_voice_03@2x.png */; };
43 | FEF759B817A7BF1400736E7F /* RecordingBkg.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A517A7BF1400736E7F /* RecordingBkg.png */; };
44 | FEF759B917A7BF1400736E7F /* RecordingBkg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A617A7BF1400736E7F /* RecordingBkg@2x.png */; };
45 | FEF759BA17A7BF1400736E7F /* RecordingSignal001.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A717A7BF1400736E7F /* RecordingSignal001.png */; };
46 | FEF759BB17A7BF1400736E7F /* RecordingSignal001@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A817A7BF1400736E7F /* RecordingSignal001@2x.png */; };
47 | FEF759BC17A7BF1400736E7F /* RecordingSignal002.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759A917A7BF1400736E7F /* RecordingSignal002.png */; };
48 | FEF759BD17A7BF1400736E7F /* RecordingSignal002@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AA17A7BF1400736E7F /* RecordingSignal002@2x.png */; };
49 | FEF759BE17A7BF1400736E7F /* RecordingSignal003.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AB17A7BF1400736E7F /* RecordingSignal003.png */; };
50 | FEF759BF17A7BF1400736E7F /* RecordingSignal003@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AC17A7BF1400736E7F /* RecordingSignal003@2x.png */; };
51 | FEF759C017A7BF1400736E7F /* RecordingSignal004.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AD17A7BF1400736E7F /* RecordingSignal004.png */; };
52 | FEF759C117A7BF1400736E7F /* RecordingSignal004@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AE17A7BF1400736E7F /* RecordingSignal004@2x.png */; };
53 | FEF759C217A7BF1400736E7F /* RecordingSignal005.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759AF17A7BF1400736E7F /* RecordingSignal005.png */; };
54 | FEF759C317A7BF1400736E7F /* RecordingSignal005@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B017A7BF1400736E7F /* RecordingSignal005@2x.png */; };
55 | FEF759C417A7BF1400736E7F /* RecordingSignal006.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B117A7BF1400736E7F /* RecordingSignal006.png */; };
56 | FEF759C517A7BF1400736E7F /* RecordingSignal006@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B217A7BF1400736E7F /* RecordingSignal006@2x.png */; };
57 | FEF759C617A7BF1400736E7F /* RecordingSignal007.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B317A7BF1400736E7F /* RecordingSignal007.png */; };
58 | FEF759C717A7BF1400736E7F /* RecordingSignal007@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B417A7BF1400736E7F /* RecordingSignal007@2x.png */; };
59 | FEF759C817A7BF1400736E7F /* RecordingSignal008.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B517A7BF1400736E7F /* RecordingSignal008.png */; };
60 | FEF759C917A7BF1400736E7F /* RecordingSignal008@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FEF759B617A7BF1400736E7F /* RecordingSignal008@2x.png */; };
61 | /* End PBXBuildFile section */
62 |
63 | /* Begin PBXFileReference section */
64 | 2E370EFE1706901200176863 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = ../../icon.png; sourceTree = ""; };
65 | 2E370F001706901700176863 /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon@2x.png"; path = "../../icon@2x.png"; sourceTree = ""; };
66 | 2E9151F41705D45500245A79 /* CustomWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomWindow.h; sourceTree = ""; };
67 | 2E9151F51705D45500245A79 /* CustomWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomWindow.m; sourceTree = ""; };
68 | 2EDEC374170590E40028A6CF /* AmrConvertAndRecord.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AmrConvertAndRecord.app; sourceTree = BUILT_PRODUCTS_DIR; };
69 | 2EDEC377170590E40028A6CF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
70 | 2EDEC379170590E40028A6CF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
71 | 2EDEC37B170590E40028A6CF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
72 | 2EDEC37F170590E40028A6CF /* AmrConvertAndRecord-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AmrConvertAndRecord-Info.plist"; sourceTree = ""; };
73 | 2EDEC381170590E40028A6CF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
74 | 2EDEC383170590E50028A6CF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
75 | 2EDEC385170590E50028A6CF /* AmrConvertAndRecord-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AmrConvertAndRecord-Prefix.pch"; sourceTree = ""; };
76 | 2EDEC386170590E50028A6CF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
77 | 2EDEC387170590E50028A6CF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
78 | 2EDEC389170590E50028A6CF /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; };
79 | 2EDEC38B170590E50028A6CF /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; };
80 | 2EDEC38D170590E50028A6CF /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; };
81 | 2EDEC38F170590E50028A6CF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
82 | 2EDEC390170590E50028A6CF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
83 | 2EDEC393170590E50028A6CF /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = ""; };
84 | 2EDEC39A170591340028A6CF /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
85 | 2EDEC39B170591340028A6CF /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
86 | 2EDEC39E170591390028A6CF /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
87 | 2EDEC3A1170598D90028A6CF /* UIView+Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Animation.h"; sourceTree = ""; };
88 | 2EDEC3A2170598D90028A6CF /* UIView+Animation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Animation.m"; sourceTree = ""; };
89 | 2EDEC3B61705A31C0028A6CF /* ChatRecorderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatRecorderView.h; sourceTree = ""; };
90 | 2EDEC3B71705A31C0028A6CF /* ChatRecorderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatRecorderView.m; sourceTree = ""; };
91 | 2EDEC3B91705A31C0028A6CF /* ChatVoiceRecorderVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatVoiceRecorderVC.h; sourceTree = ""; };
92 | 2EDEC3BA1705A31C0028A6CF /* ChatVoiceRecorderVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatVoiceRecorderVC.m; sourceTree = ""; };
93 | 2EDEC3BC1705A31C0028A6CF /* VoiceRecorderBaseVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VoiceRecorderBaseVC.h; path = ../VoiceRecorderBaseVC.h; sourceTree = ""; };
94 | 2EDEC3BD1705A31C0028A6CF /* VoiceRecorderBaseVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VoiceRecorderBaseVC.m; path = ../VoiceRecorderBaseVC.m; sourceTree = ""; };
95 | 2EDEC3C51705A3280028A6CF /* amrFileCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amrFileCodec.h; sourceTree = ""; };
96 | 2EDEC3C61705A3280028A6CF /* amrFileCodec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = amrFileCodec.mm; sourceTree = ""; };
97 | 2EDEC3C71705A3280028A6CF /* wav.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wav.h; sourceTree = ""; };
98 | 2EDEC3C81705A3280028A6CF /* wav.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = wav.mm; sourceTree = ""; };
99 | 2EDEC3CA1705A3280028A6CF /* libopencore-amrnb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libopencore-amrnb.a"; sourceTree = ""; };
100 | 2EDEC3CB1705A3280028A6CF /* libopencore-amrwb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libopencore-amrwb.a"; sourceTree = ""; };
101 | 2EDEC3CD1705A3280028A6CF /* interf_dec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interf_dec.h; sourceTree = ""; };
102 | 2EDEC3CE1705A3280028A6CF /* interf_enc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interf_enc.h; sourceTree = ""; };
103 | 2EDEC3D01705A3280028A6CF /* dec_if.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dec_if.h; sourceTree = ""; };
104 | 2EDEC3D11705A3280028A6CF /* if_rom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = if_rom.h; sourceTree = ""; };
105 | 2EDEC3D21705A3280028A6CF /* VoiceConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VoiceConverter.h; sourceTree = ""; };
106 | 2EDEC3D31705A3280028A6CF /* VoiceConverter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VoiceConverter.mm; sourceTree = ""; };
107 | 2EDEC3D91705A41F0028A6CF /* recorder_trash_can0.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = recorder_trash_can0.png; sourceTree = ""; };
108 | 2EDEC3DA1705A41F0028A6CF /* recorder_trash_can0@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "recorder_trash_can0@2x.png"; sourceTree = ""; };
109 | 2EDEC3DB1705A41F0028A6CF /* recorder_trash_can1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = recorder_trash_can1.png; sourceTree = ""; };
110 | 2EDEC3DC1705A41F0028A6CF /* recorder_trash_can1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "recorder_trash_can1@2x.png"; sourceTree = ""; };
111 | 2EDEC3DD1705A41F0028A6CF /* recorder_trash_can2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = recorder_trash_can2.png; sourceTree = ""; };
112 | 2EDEC3DE1705A41F0028A6CF /* recorder_trash_can2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "recorder_trash_can2@2x.png"; sourceTree = ""; };
113 | FEF759A417A7BF1400736E7F /* chat_voice_03@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "chat_voice_03@2x.png"; sourceTree = ""; };
114 | FEF759A517A7BF1400736E7F /* RecordingBkg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingBkg.png; sourceTree = ""; };
115 | FEF759A617A7BF1400736E7F /* RecordingBkg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingBkg@2x.png"; sourceTree = ""; };
116 | FEF759A717A7BF1400736E7F /* RecordingSignal001.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal001.png; sourceTree = ""; };
117 | FEF759A817A7BF1400736E7F /* RecordingSignal001@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal001@2x.png"; sourceTree = ""; };
118 | FEF759A917A7BF1400736E7F /* RecordingSignal002.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal002.png; sourceTree = ""; };
119 | FEF759AA17A7BF1400736E7F /* RecordingSignal002@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal002@2x.png"; sourceTree = ""; };
120 | FEF759AB17A7BF1400736E7F /* RecordingSignal003.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal003.png; sourceTree = ""; };
121 | FEF759AC17A7BF1400736E7F /* RecordingSignal003@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal003@2x.png"; sourceTree = ""; };
122 | FEF759AD17A7BF1400736E7F /* RecordingSignal004.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal004.png; sourceTree = ""; };
123 | FEF759AE17A7BF1400736E7F /* RecordingSignal004@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal004@2x.png"; sourceTree = ""; };
124 | FEF759AF17A7BF1400736E7F /* RecordingSignal005.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal005.png; sourceTree = ""; };
125 | FEF759B017A7BF1400736E7F /* RecordingSignal005@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal005@2x.png"; sourceTree = ""; };
126 | FEF759B117A7BF1400736E7F /* RecordingSignal006.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal006.png; sourceTree = ""; };
127 | FEF759B217A7BF1400736E7F /* RecordingSignal006@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal006@2x.png"; sourceTree = ""; };
128 | FEF759B317A7BF1400736E7F /* RecordingSignal007.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal007.png; sourceTree = ""; };
129 | FEF759B417A7BF1400736E7F /* RecordingSignal007@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal007@2x.png"; sourceTree = ""; };
130 | FEF759B517A7BF1400736E7F /* RecordingSignal008.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = RecordingSignal008.png; sourceTree = ""; };
131 | FEF759B617A7BF1400736E7F /* RecordingSignal008@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "RecordingSignal008@2x.png"; sourceTree = ""; };
132 | /* End PBXFileReference section */
133 |
134 | /* Begin PBXFrameworksBuildPhase section */
135 | 2EDEC371170590E40028A6CF /* Frameworks */ = {
136 | isa = PBXFrameworksBuildPhase;
137 | buildActionMask = 2147483647;
138 | files = (
139 | 2EDEC39F170591390028A6CF /* AVFoundation.framework in Frameworks */,
140 | 2EDEC39C170591340028A6CF /* AudioToolbox.framework in Frameworks */,
141 | 2EDEC39D170591340028A6CF /* CoreAudio.framework in Frameworks */,
142 | 2EDEC378170590E40028A6CF /* UIKit.framework in Frameworks */,
143 | 2EDEC37A170590E40028A6CF /* Foundation.framework in Frameworks */,
144 | 2EDEC37C170590E40028A6CF /* CoreGraphics.framework in Frameworks */,
145 | 2EDEC3D61705A3280028A6CF /* libopencore-amrnb.a in Frameworks */,
146 | 2EDEC3D71705A3280028A6CF /* libopencore-amrwb.a in Frameworks */,
147 | );
148 | runOnlyForDeploymentPostprocessing = 0;
149 | };
150 | /* End PBXFrameworksBuildPhase section */
151 |
152 | /* Begin PBXGroup section */
153 | 2EDEC36B170590E40028A6CF = {
154 | isa = PBXGroup;
155 | children = (
156 | 2EDEC37D170590E40028A6CF /* AmrConvertAndRecord */,
157 | 2EDEC376170590E40028A6CF /* Frameworks */,
158 | 2EDEC375170590E40028A6CF /* Products */,
159 | );
160 | sourceTree = "";
161 | };
162 | 2EDEC375170590E40028A6CF /* Products */ = {
163 | isa = PBXGroup;
164 | children = (
165 | 2EDEC374170590E40028A6CF /* AmrConvertAndRecord.app */,
166 | );
167 | name = Products;
168 | sourceTree = "";
169 | };
170 | 2EDEC376170590E40028A6CF /* Frameworks */ = {
171 | isa = PBXGroup;
172 | children = (
173 | 2EDEC39E170591390028A6CF /* AVFoundation.framework */,
174 | 2EDEC39A170591340028A6CF /* AudioToolbox.framework */,
175 | 2EDEC39B170591340028A6CF /* CoreAudio.framework */,
176 | 2EDEC377170590E40028A6CF /* UIKit.framework */,
177 | 2EDEC379170590E40028A6CF /* Foundation.framework */,
178 | 2EDEC37B170590E40028A6CF /* CoreGraphics.framework */,
179 | );
180 | name = Frameworks;
181 | sourceTree = "";
182 | };
183 | 2EDEC37D170590E40028A6CF /* AmrConvertAndRecord */ = {
184 | isa = PBXGroup;
185 | children = (
186 | 2E9151F41705D45500245A79 /* CustomWindow.h */,
187 | 2E9151F51705D45500245A79 /* CustomWindow.m */,
188 | 2EDEC3A41705A1940028A6CF /* img */,
189 | 2EDEC3A0170598D90028A6CF /* UIViewAnimation */,
190 | 2EDEC3B31705A31C0028A6CF /* VoiceRecorderVC */,
191 | 2EDEC3C31705A3280028A6CF /* VoiceConvert */,
192 | 2EDEC386170590E50028A6CF /* AppDelegate.h */,
193 | 2EDEC387170590E50028A6CF /* AppDelegate.m */,
194 | 2EDEC38F170590E50028A6CF /* ViewController.h */,
195 | 2EDEC390170590E50028A6CF /* ViewController.m */,
196 | 2EDEC392170590E50028A6CF /* ViewController.xib */,
197 | 2EDEC37E170590E40028A6CF /* Supporting Files */,
198 | );
199 | path = AmrConvertAndRecord;
200 | sourceTree = "";
201 | };
202 | 2EDEC37E170590E40028A6CF /* Supporting Files */ = {
203 | isa = PBXGroup;
204 | children = (
205 | 2EDEC37F170590E40028A6CF /* AmrConvertAndRecord-Info.plist */,
206 | 2EDEC380170590E40028A6CF /* InfoPlist.strings */,
207 | 2EDEC383170590E50028A6CF /* main.m */,
208 | 2EDEC385170590E50028A6CF /* AmrConvertAndRecord-Prefix.pch */,
209 | 2EDEC389170590E50028A6CF /* Default.png */,
210 | 2EDEC38B170590E50028A6CF /* Default@2x.png */,
211 | 2EDEC38D170590E50028A6CF /* Default-568h@2x.png */,
212 | );
213 | name = "Supporting Files";
214 | sourceTree = "";
215 | };
216 | 2EDEC3A0170598D90028A6CF /* UIViewAnimation */ = {
217 | isa = PBXGroup;
218 | children = (
219 | 2EDEC3A1170598D90028A6CF /* UIView+Animation.h */,
220 | 2EDEC3A2170598D90028A6CF /* UIView+Animation.m */,
221 | );
222 | path = UIViewAnimation;
223 | sourceTree = "";
224 | };
225 | 2EDEC3A41705A1940028A6CF /* img */ = {
226 | isa = PBXGroup;
227 | children = (
228 | 2E370F001706901700176863 /* icon@2x.png */,
229 | 2E370EFE1706901200176863 /* icon.png */,
230 | 2EDEC3D91705A41F0028A6CF /* recorder_trash_can0.png */,
231 | 2EDEC3DA1705A41F0028A6CF /* recorder_trash_can0@2x.png */,
232 | 2EDEC3DB1705A41F0028A6CF /* recorder_trash_can1.png */,
233 | 2EDEC3DC1705A41F0028A6CF /* recorder_trash_can1@2x.png */,
234 | 2EDEC3DD1705A41F0028A6CF /* recorder_trash_can2.png */,
235 | 2EDEC3DE1705A41F0028A6CF /* recorder_trash_can2@2x.png */,
236 | FEF759A417A7BF1400736E7F /* chat_voice_03@2x.png */,
237 | FEF759A517A7BF1400736E7F /* RecordingBkg.png */,
238 | FEF759A617A7BF1400736E7F /* RecordingBkg@2x.png */,
239 | FEF759A717A7BF1400736E7F /* RecordingSignal001.png */,
240 | FEF759A817A7BF1400736E7F /* RecordingSignal001@2x.png */,
241 | FEF759A917A7BF1400736E7F /* RecordingSignal002.png */,
242 | FEF759AA17A7BF1400736E7F /* RecordingSignal002@2x.png */,
243 | FEF759AB17A7BF1400736E7F /* RecordingSignal003.png */,
244 | FEF759AC17A7BF1400736E7F /* RecordingSignal003@2x.png */,
245 | FEF759AD17A7BF1400736E7F /* RecordingSignal004.png */,
246 | FEF759AE17A7BF1400736E7F /* RecordingSignal004@2x.png */,
247 | FEF759AF17A7BF1400736E7F /* RecordingSignal005.png */,
248 | FEF759B017A7BF1400736E7F /* RecordingSignal005@2x.png */,
249 | FEF759B117A7BF1400736E7F /* RecordingSignal006.png */,
250 | FEF759B217A7BF1400736E7F /* RecordingSignal006@2x.png */,
251 | FEF759B317A7BF1400736E7F /* RecordingSignal007.png */,
252 | FEF759B417A7BF1400736E7F /* RecordingSignal007@2x.png */,
253 | FEF759B517A7BF1400736E7F /* RecordingSignal008.png */,
254 | FEF759B617A7BF1400736E7F /* RecordingSignal008@2x.png */,
255 | );
256 | path = img;
257 | sourceTree = "";
258 | };
259 | 2EDEC3B31705A31C0028A6CF /* VoiceRecorderVC */ = {
260 | isa = PBXGroup;
261 | children = (
262 | 2EDEC3B51705A31C0028A6CF /* ChatRecorderView */,
263 | 2EDEC3B41705A31C0028A6CF /* ChatVoiceRecorderVC */,
264 | );
265 | path = VoiceRecorderVC;
266 | sourceTree = "";
267 | };
268 | 2EDEC3B41705A31C0028A6CF /* ChatVoiceRecorderVC */ = {
269 | isa = PBXGroup;
270 | children = (
271 | 2EDEC3BC1705A31C0028A6CF /* VoiceRecorderBaseVC.h */,
272 | 2EDEC3BD1705A31C0028A6CF /* VoiceRecorderBaseVC.m */,
273 | 2EDEC3B91705A31C0028A6CF /* ChatVoiceRecorderVC.h */,
274 | 2EDEC3BA1705A31C0028A6CF /* ChatVoiceRecorderVC.m */,
275 | );
276 | path = ChatVoiceRecorderVC;
277 | sourceTree = "";
278 | };
279 | 2EDEC3B51705A31C0028A6CF /* ChatRecorderView */ = {
280 | isa = PBXGroup;
281 | children = (
282 | 2EDEC3B61705A31C0028A6CF /* ChatRecorderView.h */,
283 | 2EDEC3B71705A31C0028A6CF /* ChatRecorderView.m */,
284 | );
285 | name = ChatRecorderView;
286 | path = ChatVoiceRecorderVC/ChatRecorderView;
287 | sourceTree = "";
288 | };
289 | 2EDEC3C31705A3280028A6CF /* VoiceConvert */ = {
290 | isa = PBXGroup;
291 | children = (
292 | 2EDEC3C41705A3280028A6CF /* amrwapper */,
293 | 2EDEC3C91705A3280028A6CF /* lib */,
294 | 2EDEC3CC1705A3280028A6CF /* opencore-amrnb */,
295 | 2EDEC3CF1705A3280028A6CF /* opencore-amrwb */,
296 | 2EDEC3D21705A3280028A6CF /* VoiceConverter.h */,
297 | 2EDEC3D31705A3280028A6CF /* VoiceConverter.mm */,
298 | );
299 | path = VoiceConvert;
300 | sourceTree = "";
301 | };
302 | 2EDEC3C41705A3280028A6CF /* amrwapper */ = {
303 | isa = PBXGroup;
304 | children = (
305 | 2EDEC3C51705A3280028A6CF /* amrFileCodec.h */,
306 | 2EDEC3C61705A3280028A6CF /* amrFileCodec.mm */,
307 | 2EDEC3C71705A3280028A6CF /* wav.h */,
308 | 2EDEC3C81705A3280028A6CF /* wav.mm */,
309 | );
310 | path = amrwapper;
311 | sourceTree = "";
312 | };
313 | 2EDEC3C91705A3280028A6CF /* lib */ = {
314 | isa = PBXGroup;
315 | children = (
316 | 2EDEC3CA1705A3280028A6CF /* libopencore-amrnb.a */,
317 | 2EDEC3CB1705A3280028A6CF /* libopencore-amrwb.a */,
318 | );
319 | path = lib;
320 | sourceTree = "";
321 | };
322 | 2EDEC3CC1705A3280028A6CF /* opencore-amrnb */ = {
323 | isa = PBXGroup;
324 | children = (
325 | 2EDEC3CD1705A3280028A6CF /* interf_dec.h */,
326 | 2EDEC3CE1705A3280028A6CF /* interf_enc.h */,
327 | );
328 | path = "opencore-amrnb";
329 | sourceTree = "";
330 | };
331 | 2EDEC3CF1705A3280028A6CF /* opencore-amrwb */ = {
332 | isa = PBXGroup;
333 | children = (
334 | 2EDEC3D01705A3280028A6CF /* dec_if.h */,
335 | 2EDEC3D11705A3280028A6CF /* if_rom.h */,
336 | );
337 | path = "opencore-amrwb";
338 | sourceTree = "";
339 | };
340 | /* End PBXGroup section */
341 |
342 | /* Begin PBXNativeTarget section */
343 | 2EDEC373170590E40028A6CF /* AmrConvertAndRecord */ = {
344 | isa = PBXNativeTarget;
345 | buildConfigurationList = 2EDEC397170590E50028A6CF /* Build configuration list for PBXNativeTarget "AmrConvertAndRecord" */;
346 | buildPhases = (
347 | 2EDEC370170590E40028A6CF /* Sources */,
348 | 2EDEC371170590E40028A6CF /* Frameworks */,
349 | 2EDEC372170590E40028A6CF /* Resources */,
350 | );
351 | buildRules = (
352 | );
353 | dependencies = (
354 | );
355 | name = AmrConvertAndRecord;
356 | productName = AmrConvertAndRecord;
357 | productReference = 2EDEC374170590E40028A6CF /* AmrConvertAndRecord.app */;
358 | productType = "com.apple.product-type.application";
359 | };
360 | /* End PBXNativeTarget section */
361 |
362 | /* Begin PBXProject section */
363 | 2EDEC36C170590E40028A6CF /* Project object */ = {
364 | isa = PBXProject;
365 | attributes = {
366 | LastUpgradeCheck = 0460;
367 | ORGANIZATIONNAME = Jeans;
368 | };
369 | buildConfigurationList = 2EDEC36F170590E40028A6CF /* Build configuration list for PBXProject "AmrConvertAndRecord" */;
370 | compatibilityVersion = "Xcode 3.2";
371 | developmentRegion = English;
372 | hasScannedForEncodings = 0;
373 | knownRegions = (
374 | en,
375 | );
376 | mainGroup = 2EDEC36B170590E40028A6CF;
377 | productRefGroup = 2EDEC375170590E40028A6CF /* Products */;
378 | projectDirPath = "";
379 | projectRoot = "";
380 | targets = (
381 | 2EDEC373170590E40028A6CF /* AmrConvertAndRecord */,
382 | );
383 | };
384 | /* End PBXProject section */
385 |
386 | /* Begin PBXResourcesBuildPhase section */
387 | 2EDEC372170590E40028A6CF /* Resources */ = {
388 | isa = PBXResourcesBuildPhase;
389 | buildActionMask = 2147483647;
390 | files = (
391 | 2EDEC382170590E40028A6CF /* InfoPlist.strings in Resources */,
392 | 2EDEC38A170590E50028A6CF /* Default.png in Resources */,
393 | 2EDEC38C170590E50028A6CF /* Default@2x.png in Resources */,
394 | 2EDEC38E170590E50028A6CF /* Default-568h@2x.png in Resources */,
395 | 2EDEC394170590E50028A6CF /* ViewController.xib in Resources */,
396 | 2EDEC3DF1705A41F0028A6CF /* recorder_trash_can0.png in Resources */,
397 | 2EDEC3E01705A41F0028A6CF /* recorder_trash_can0@2x.png in Resources */,
398 | 2EDEC3E11705A41F0028A6CF /* recorder_trash_can1.png in Resources */,
399 | 2EDEC3E21705A41F0028A6CF /* recorder_trash_can1@2x.png in Resources */,
400 | 2EDEC3E31705A41F0028A6CF /* recorder_trash_can2.png in Resources */,
401 | 2EDEC3E41705A41F0028A6CF /* recorder_trash_can2@2x.png in Resources */,
402 | 2E370EFF1706901200176863 /* icon.png in Resources */,
403 | 2E370F011706901700176863 /* icon@2x.png in Resources */,
404 | FEF759B717A7BF1400736E7F /* chat_voice_03@2x.png in Resources */,
405 | FEF759B817A7BF1400736E7F /* RecordingBkg.png in Resources */,
406 | FEF759B917A7BF1400736E7F /* RecordingBkg@2x.png in Resources */,
407 | FEF759BA17A7BF1400736E7F /* RecordingSignal001.png in Resources */,
408 | FEF759BB17A7BF1400736E7F /* RecordingSignal001@2x.png in Resources */,
409 | FEF759BC17A7BF1400736E7F /* RecordingSignal002.png in Resources */,
410 | FEF759BD17A7BF1400736E7F /* RecordingSignal002@2x.png in Resources */,
411 | FEF759BE17A7BF1400736E7F /* RecordingSignal003.png in Resources */,
412 | FEF759BF17A7BF1400736E7F /* RecordingSignal003@2x.png in Resources */,
413 | FEF759C017A7BF1400736E7F /* RecordingSignal004.png in Resources */,
414 | FEF759C117A7BF1400736E7F /* RecordingSignal004@2x.png in Resources */,
415 | FEF759C217A7BF1400736E7F /* RecordingSignal005.png in Resources */,
416 | FEF759C317A7BF1400736E7F /* RecordingSignal005@2x.png in Resources */,
417 | FEF759C417A7BF1400736E7F /* RecordingSignal006.png in Resources */,
418 | FEF759C517A7BF1400736E7F /* RecordingSignal006@2x.png in Resources */,
419 | FEF759C617A7BF1400736E7F /* RecordingSignal007.png in Resources */,
420 | FEF759C717A7BF1400736E7F /* RecordingSignal007@2x.png in Resources */,
421 | FEF759C817A7BF1400736E7F /* RecordingSignal008.png in Resources */,
422 | FEF759C917A7BF1400736E7F /* RecordingSignal008@2x.png in Resources */,
423 | );
424 | runOnlyForDeploymentPostprocessing = 0;
425 | };
426 | /* End PBXResourcesBuildPhase section */
427 |
428 | /* Begin PBXSourcesBuildPhase section */
429 | 2EDEC370170590E40028A6CF /* Sources */ = {
430 | isa = PBXSourcesBuildPhase;
431 | buildActionMask = 2147483647;
432 | files = (
433 | 2EDEC384170590E50028A6CF /* main.m in Sources */,
434 | 2EDEC388170590E50028A6CF /* AppDelegate.m in Sources */,
435 | 2EDEC391170590E50028A6CF /* ViewController.m in Sources */,
436 | 2EDEC3A3170598D90028A6CF /* UIView+Animation.m in Sources */,
437 | 2EDEC3BE1705A31C0028A6CF /* ChatRecorderView.m in Sources */,
438 | 2EDEC3C01705A31C0028A6CF /* ChatVoiceRecorderVC.m in Sources */,
439 | 2EDEC3C21705A31C0028A6CF /* VoiceRecorderBaseVC.m in Sources */,
440 | 2EDEC3D41705A3280028A6CF /* amrFileCodec.mm in Sources */,
441 | 2EDEC3D51705A3280028A6CF /* wav.mm in Sources */,
442 | 2EDEC3D81705A3280028A6CF /* VoiceConverter.mm in Sources */,
443 | 2E9151F61705D45500245A79 /* CustomWindow.m in Sources */,
444 | );
445 | runOnlyForDeploymentPostprocessing = 0;
446 | };
447 | /* End PBXSourcesBuildPhase section */
448 |
449 | /* Begin PBXVariantGroup section */
450 | 2EDEC380170590E40028A6CF /* InfoPlist.strings */ = {
451 | isa = PBXVariantGroup;
452 | children = (
453 | 2EDEC381170590E40028A6CF /* en */,
454 | );
455 | name = InfoPlist.strings;
456 | sourceTree = "";
457 | };
458 | 2EDEC392170590E50028A6CF /* ViewController.xib */ = {
459 | isa = PBXVariantGroup;
460 | children = (
461 | 2EDEC393170590E50028A6CF /* en */,
462 | );
463 | name = ViewController.xib;
464 | sourceTree = "";
465 | };
466 | /* End PBXVariantGroup section */
467 |
468 | /* Begin XCBuildConfiguration section */
469 | 2EDEC395170590E50028A6CF /* Debug */ = {
470 | isa = XCBuildConfiguration;
471 | buildSettings = {
472 | ALWAYS_SEARCH_USER_PATHS = NO;
473 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
474 | CLANG_CXX_LIBRARY = "libc++";
475 | CLANG_WARN_CONSTANT_CONVERSION = YES;
476 | CLANG_WARN_EMPTY_BODY = YES;
477 | CLANG_WARN_ENUM_CONVERSION = YES;
478 | CLANG_WARN_INT_CONVERSION = YES;
479 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
480 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
481 | COPY_PHASE_STRIP = NO;
482 | GCC_C_LANGUAGE_STANDARD = gnu99;
483 | GCC_DYNAMIC_NO_PIC = NO;
484 | GCC_OPTIMIZATION_LEVEL = 0;
485 | GCC_PREPROCESSOR_DEFINITIONS = (
486 | "DEBUG=1",
487 | "$(inherited)",
488 | );
489 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
490 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
491 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
492 | GCC_WARN_UNUSED_VARIABLE = YES;
493 | IPHONEOS_DEPLOYMENT_TARGET = 6.1;
494 | ONLY_ACTIVE_ARCH = YES;
495 | SDKROOT = iphoneos;
496 | };
497 | name = Debug;
498 | };
499 | 2EDEC396170590E50028A6CF /* Release */ = {
500 | isa = XCBuildConfiguration;
501 | buildSettings = {
502 | ALWAYS_SEARCH_USER_PATHS = NO;
503 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
504 | CLANG_CXX_LIBRARY = "libc++";
505 | CLANG_WARN_CONSTANT_CONVERSION = YES;
506 | CLANG_WARN_EMPTY_BODY = YES;
507 | CLANG_WARN_ENUM_CONVERSION = YES;
508 | CLANG_WARN_INT_CONVERSION = YES;
509 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
510 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
511 | COPY_PHASE_STRIP = YES;
512 | GCC_C_LANGUAGE_STANDARD = gnu99;
513 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
514 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
515 | GCC_WARN_UNUSED_VARIABLE = YES;
516 | IPHONEOS_DEPLOYMENT_TARGET = 6.1;
517 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
518 | SDKROOT = iphoneos;
519 | VALIDATE_PRODUCT = YES;
520 | };
521 | name = Release;
522 | };
523 | 2EDEC398170590E50028A6CF /* Debug */ = {
524 | isa = XCBuildConfiguration;
525 | buildSettings = {
526 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Xu Zhiwen (L479Y675FH)";
527 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
528 | GCC_PREFIX_HEADER = "AmrConvertAndRecord/AmrConvertAndRecord-Prefix.pch";
529 | INFOPLIST_FILE = "AmrConvertAndRecord/AmrConvertAndRecord-Info.plist";
530 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
531 | LIBRARY_SEARCH_PATHS = (
532 | "$(inherited)",
533 | "\"$(SRCROOT)/AmrConvertAndRecord/VoiceConvert/lib\"",
534 | );
535 | PRODUCT_NAME = "$(TARGET_NAME)";
536 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = "1809DAB3-7405-477E-85FB-F31DCB13082F";
537 | WRAPPER_EXTENSION = app;
538 | };
539 | name = Debug;
540 | };
541 | 2EDEC399170590E50028A6CF /* Release */ = {
542 | isa = XCBuildConfiguration;
543 | buildSettings = {
544 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
545 | GCC_PREFIX_HEADER = "AmrConvertAndRecord/AmrConvertAndRecord-Prefix.pch";
546 | INFOPLIST_FILE = "AmrConvertAndRecord/AmrConvertAndRecord-Info.plist";
547 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
548 | LIBRARY_SEARCH_PATHS = (
549 | "$(inherited)",
550 | "\"$(SRCROOT)/AmrConvertAndRecord/VoiceConvert/lib\"",
551 | );
552 | PRODUCT_NAME = "$(TARGET_NAME)";
553 | WRAPPER_EXTENSION = app;
554 | };
555 | name = Release;
556 | };
557 | /* End XCBuildConfiguration section */
558 |
559 | /* Begin XCConfigurationList section */
560 | 2EDEC36F170590E40028A6CF /* Build configuration list for PBXProject "AmrConvertAndRecord" */ = {
561 | isa = XCConfigurationList;
562 | buildConfigurations = (
563 | 2EDEC395170590E50028A6CF /* Debug */,
564 | 2EDEC396170590E50028A6CF /* Release */,
565 | );
566 | defaultConfigurationIsVisible = 0;
567 | defaultConfigurationName = Release;
568 | };
569 | 2EDEC397170590E50028A6CF /* Build configuration list for PBXNativeTarget "AmrConvertAndRecord" */ = {
570 | isa = XCConfigurationList;
571 | buildConfigurations = (
572 | 2EDEC398170590E50028A6CF /* Debug */,
573 | 2EDEC399170590E50028A6CF /* Release */,
574 | );
575 | defaultConfigurationIsVisible = 0;
576 | defaultConfigurationName = Release;
577 | };
578 | /* End XCConfigurationList section */
579 | };
580 | rootObject = 2EDEC36C170590E40028A6CF /* Project object */;
581 | }
582 |
--------------------------------------------------------------------------------