NLSVoiceRecorder.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // NlsVoiceRecorder.h
  3. // NlsClientSDK
  4. //
  5. // Created by Shawn Chain on 13-11-22.
  6. // Copyright (c) 2015年 Alibaba iDST. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. /**
  10. *@discuss NlsVoiceRecorder 各种回调接口
  11. */
  12. @protocol NlsVoiceRecorderDelegate <NSObject>
  13. /**
  14. * @discuss Recorder启动回调,在主线程中调用
  15. */
  16. -(void) recorderDidStart;
  17. /**
  18. * @discuss Recorde停止回调,在主线程中调用
  19. */
  20. -(void) recorderDidStop;
  21. /**
  22. * @discuss Recorder收录到数据,通常涉及VAD及压缩等操作,为了避免阻塞主线,因此将在在AudioQueue的线程中调用,注意线程安全!!!
  23. */
  24. -(void) voiceRecorded:(NSData*) frame;
  25. /**
  26. *@discussion 录音机无法打开或其他错误的时候会回调
  27. */
  28. -(void) voiceDidFail:(NSError*)error;
  29. @end
  30. /**
  31. *@discuss 封装了AudioQueue C API的录音机程序
  32. */
  33. @interface NlsVoiceRecorder : NSObject
  34. @property(nonatomic,assign) id<NlsVoiceRecorderDelegate> delegate;
  35. @property(nonatomic,readonly) NSUInteger currentVoiceVolume;
  36. /**
  37. * 开始录音
  38. */
  39. -(void)start;
  40. /**
  41. * 停止录音
  42. */
  43. -(void)stop:(BOOL)shouldNotify;
  44. /**
  45. * 是否在录音
  46. */
  47. -(BOOL)isStarted;
  48. @end