RCMAACPlayer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // RCAACPlayer.h
  3. // VclustersGemini
  4. //
  5. // Created by APPLE on 2020/5/23.
  6. // Copyright © 2020 APPLE. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <AudioToolbox/AudioToolbox.h>
  10. #import <AVFoundation/AVFoundation.h>
  11. #define kNumberBuffers 3
  12. @interface RCMAACPlayer : NSObject {
  13. // AudioStreamBasicDescription mDataFormat;
  14. // AudioQueueRef mQueue;
  15. // AudioQueueBufferRef mBuffers[kNumberBuffers];
  16. // BOOL isUseingAudioQueueBuffer[kNumberBuffers];
  17. //
  18. // UInt32 bufferByteSize; UInt32 mNumPacketsToRead;
  19. // bool mIsRunning;
  20. // NSCondition *mAACAudioLock;
  21. //
  22. // unsigned char dataNoVol[88];
  23. }
  24. /**
  25. * @brief 初始化AAC音频播放器
  26. *
  27. * @param formatID 音频格式暂定为kAudioFormatMPEG4AAC
  28. *
  29. */
  30. - (instancetype)initWithAudioFormatID:(AudioFormatID)formatID;
  31. /**
  32. * @brief 填充音频数据
  33. *
  34. * @param samples 音频数据
  35. *
  36. * @param length 音频数据长度
  37. *
  38. */
  39. - (void)playAudioData:(void *)samples length:(int)length;
  40. /**
  41. * @brief 开始播放
  42. *
  43. */
  44. - (BOOL)start;
  45. /**
  46. * @brief 结束播放
  47. *
  48. */
  49. - (BOOL)stop;
  50. @end