IFlyISVRecognizer.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //
  2. // IFlyISVRecognizer.h
  3. // ISV
  4. //
  5. // Created by wangdan on 14-9-6.
  6. // Copyright (c) 2014年 IFlyTEK. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "IFlyISVDelegate.h"
  10. /**
  11. * 声纹接口类
  12. */
  13. @interface IFlyISVRecognizer : NSObject
  14. {
  15. }
  16. /*!
  17. * The delegate of FlyISVRecognizer responsing to IFlyISVDelegate.
  18. */
  19. @property (assign) id<IFlyISVDelegate> delegate;
  20. /*!
  21. * FlyISVRecognizer is a kind of Singleton calss.The function can be used as below:<br>
  22. * IFLyISVRecognizer *recognizer=[IFlyISVRecognizer creteRecognizer: self];
  23. */
  24. +(instancetype) sharedInstance;
  25. /*!
  26. * Genrerate a serial number password<br>
  27. * Princeple:<br>
  28. * 1.Number serial has no 1 in itself;<br>
  29. * 2.The nuber serial has no same number("98765432"is right while "99876543" is wrong)
  30. *
  31. * @param length the serial number's length,length of "98765432" is 8,generally length is 8 and other value is forbidden
  32. */
  33. -(NSString*) generatePassword:(int)length;
  34. /*!
  35. * Used to get password from server
  36. *
  37. * @param pwdt when pwdt is 1,the function will return chinese text;while pwdt is 2, the funciton will return number serial
  38. */
  39. -(NSArray*) getPasswordList:(int)pwdt;
  40. /*!
  41. * Used to judge if the engine is running in listenning
  42. *
  43. * @return YES: the engine is listenning;<br>No : the engine is not listenning
  44. */
  45. -(BOOL) isListening;
  46. /*!
  47. * Used to query or delete the voiceprint model in server
  48. *
  49. * @param cmd "del": delete model;<br>"que": query model;
  50. * @param authid: user id ,can be @"tianxia" or other;
  51. * @param pwdt voiceprint type<br>
  52. * 1: fixed txt voiceprint code ,like @"我的地盘我做主";<br>
  53. * 2: free voiceprint code , user can speek anything,but 5 times trainning the speech shall be same;<br>
  54. * 3: number serial voiceprint code ,like @"98765432" and so on.
  55. * @param ptxt voiceprint txt,only fixed voiceprint and number serial have this,in free voiceprint model this param shall be set nil.
  56. * @param vid another voiceprint type model,user can use this to query or delete model in server can be @"jakillasdfasdjjjlajlsdfhdfdsadff",totally 32 bits;<br>
  57. * NOTES:<br>
  58. * when vid is not nil,then the server will judge the vid first; while the vid is nil, server can still query or delete the voiceprint model by other params.
  59. */
  60. -(BOOL) sendRequest:(NSString*)cmd authid:(NSString *)auth_id pwdt:(int)pwdt ptxt:(NSString *)ptxt vid:(NSString *)vid err:(int *)err;
  61. /*!
  62. * Set the voiceprint params
  63. *
  64. * | key | value |
  65. * |:---------------:|:-------------------------------------------------:|
  66. * | sst | @"train" or @"verify" |
  67. * | auth_id | @"tianxia" or other |
  68. * | sub | @"ivp" |
  69. * | ptxt | |
  70. * | rgn | @"5" |
  71. * | pwdt | @"1",or @"2", or @"3" |
  72. * | auf | @"audio/L16;rate=16000" or @"audio/L16;rate=8000" |
  73. * | vad_enable | @"1" or @"0" |
  74. * | vad_timeout | @"3000" |
  75. * | vad_speech_tail | @"100" |
  76. *
  77. * @param value 参数值
  78. * @param key 参数类型
  79. *
  80. * @return 设置成功返回YES,失败返回NO
  81. */
  82. -(BOOL) setParameter:(NSString *)value forKey:(NSString *)key;
  83. /*!
  84. * Get the voiceprint params used the same as function of setParameter
  85. */
  86. -(NSString*) getParameter:(NSString *)key;
  87. /*!
  88. * Start recording
  89. */
  90. -(void) startListening;
  91. /*!
  92. * Stop recording
  93. */
  94. -(void) stopListening;
  95. /*!
  96. * Cancel recording,like function stopListening
  97. */
  98. -(void) cancel; /* cancel recognization */
  99. @end