DKVoiceCommonHelper.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // DKVoiceCommonHelper.h
  3. // MessageDisplayExample
  4. //
  5. // Created by Aevitx on 14-5-27.
  6. // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <AVFoundation/AVFoundation.h>
  10. #define AUDIO_LOCAL_FILE @"localfile"
  11. typedef void(^DidDeleteAudioFileBlock)();
  12. @interface DKVoiceCommonHelper : NSObject
  13. /**
  14. * 根据文件名字(不包含后缀),删除文件
  15. *
  16. * @param fileName 文件名字(不包含后缀)
  17. * @param block 删除成功后的回调
  18. */
  19. + (void)removeRecordedFileWithOnlyName:(NSString*)fileName block:(DidDeleteAudioFileBlock)block;
  20. /**
  21. * 删除/documents/Audio下的文件
  22. *
  23. * @param exception 有包含些字符串就不删除(为空表示全部删除)
  24. * @param block 删除成功后的回调
  25. */
  26. + (void)removeAudioFile:(NSString*)exception block:(DidDeleteAudioFileBlock)block;
  27. /**
  28. * 根据当前时间生成字符串
  29. *
  30. * @return 当前时间字符串
  31. */
  32. + (NSString*)getCurrentTimeString;
  33. /**
  34. * 获取缓存路径
  35. *
  36. * @return 缓存路径
  37. */
  38. + (NSString*)getCacheDirectory;
  39. /**
  40. * 判断文件是否存在
  41. *
  42. * @param _path 文件路径
  43. *
  44. * @return 存在返回YES
  45. */
  46. + (BOOL)fileExistsAtPath:(NSString*)_path;
  47. /**
  48. * 删除文件
  49. *
  50. * @param _path 文件路径
  51. *
  52. * @return 成功返回YES
  53. */
  54. + (BOOL)deleteFileAtPath:(NSString*)_path;
  55. /**
  56. * 生成文件路径
  57. *
  58. * @param _fileName 文件名
  59. * @param _type 文件类型
  60. * @return 文件路径
  61. */
  62. + (NSString*)getPathByFileName:(NSString *)_fileName;
  63. + (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type;
  64. /**
  65. * 获取录音设置
  66. *
  67. * @return 录音设置
  68. */
  69. + (NSDictionary*)getAudioRecorderSettingDict;
  70. @end