snowboydetect.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # This file was automatically generated by SWIG (http://www.swig.org).
  2. # Version 3.0.12
  3. #
  4. # Do not make changes to this file unless you know what you are doing--modify
  5. # the SWIG interface file instead.
  6. from sys import version_info as _swig_python_version_info
  7. if _swig_python_version_info >= (2, 7, 0):
  8. def swig_import_helper():
  9. import importlib
  10. pkg = __name__.rpartition('.')[0]
  11. mname = '.'.join((pkg, '_snowboydetect')).lstrip('.')
  12. try:
  13. return importlib.import_module(mname)
  14. except ImportError:
  15. return importlib.import_module('_snowboydetect')
  16. _snowboydetect = swig_import_helper()
  17. del swig_import_helper
  18. elif _swig_python_version_info >= (2, 6, 0):
  19. def swig_import_helper():
  20. from os.path import dirname
  21. import imp
  22. fp = None
  23. try:
  24. fp, pathname, description = imp.find_module('_snowboydetect', [dirname(__file__)])
  25. except ImportError:
  26. import _snowboydetect
  27. return _snowboydetect
  28. try:
  29. _mod = imp.load_module('_snowboydetect', fp, pathname, description)
  30. finally:
  31. if fp is not None:
  32. fp.close()
  33. return _mod
  34. _snowboydetect = swig_import_helper()
  35. del swig_import_helper
  36. else:
  37. import _snowboydetect
  38. del _swig_python_version_info
  39. try:
  40. _swig_property = property
  41. except NameError:
  42. pass # Python < 2.2 doesn't have 'property'.
  43. try:
  44. import builtins as __builtin__
  45. except ImportError:
  46. import __builtin__
  47. def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
  48. if (name == "thisown"):
  49. return self.this.own(value)
  50. if (name == "this"):
  51. if type(value).__name__ == 'SwigPyObject':
  52. self.__dict__[name] = value
  53. return
  54. method = class_type.__swig_setmethods__.get(name, None)
  55. if method:
  56. return method(self, value)
  57. if (not static):
  58. if _newclass:
  59. object.__setattr__(self, name, value)
  60. else:
  61. self.__dict__[name] = value
  62. else:
  63. raise AttributeError("You cannot add attributes to %s" % self)
  64. def _swig_setattr(self, class_type, name, value):
  65. return _swig_setattr_nondynamic(self, class_type, name, value, 0)
  66. def _swig_getattr(self, class_type, name):
  67. if (name == "thisown"):
  68. return self.this.own()
  69. method = class_type.__swig_getmethods__.get(name, None)
  70. if method:
  71. return method(self)
  72. raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
  73. def _swig_repr(self):
  74. try:
  75. strthis = "proxy of " + self.this.__repr__()
  76. except __builtin__.Exception:
  77. strthis = ""
  78. return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
  79. try:
  80. _object = object
  81. _newclass = 1
  82. except __builtin__.Exception:
  83. class _object:
  84. pass
  85. _newclass = 0
  86. class SnowboyDetect(_object):
  87. __swig_setmethods__ = {}
  88. __setattr__ = lambda self, name, value: _swig_setattr(self, SnowboyDetect, name, value)
  89. __swig_getmethods__ = {}
  90. __getattr__ = lambda self, name: _swig_getattr(self, SnowboyDetect, name)
  91. __repr__ = _swig_repr
  92. def __init__(self, resource_filename, model_str):
  93. this = _snowboydetect.new_SnowboyDetect(resource_filename, model_str)
  94. try:
  95. self.this.append(this)
  96. except __builtin__.Exception:
  97. self.this = this
  98. def Reset(self):
  99. return _snowboydetect.SnowboyDetect_Reset(self)
  100. def RunDetection(self, *args):
  101. return _snowboydetect.SnowboyDetect_RunDetection(self, *args)
  102. def SetSensitivity(self, sensitivity_str):
  103. return _snowboydetect.SnowboyDetect_SetSensitivity(self, sensitivity_str)
  104. def SetHighSensitivity(self, high_sensitivity_str):
  105. return _snowboydetect.SnowboyDetect_SetHighSensitivity(self, high_sensitivity_str)
  106. def GetSensitivity(self):
  107. return _snowboydetect.SnowboyDetect_GetSensitivity(self)
  108. def SetAudioGain(self, audio_gain):
  109. return _snowboydetect.SnowboyDetect_SetAudioGain(self, audio_gain)
  110. def UpdateModel(self):
  111. return _snowboydetect.SnowboyDetect_UpdateModel(self)
  112. def NumHotwords(self):
  113. return _snowboydetect.SnowboyDetect_NumHotwords(self)
  114. def ApplyFrontend(self, apply_frontend):
  115. return _snowboydetect.SnowboyDetect_ApplyFrontend(self, apply_frontend)
  116. def SampleRate(self):
  117. return _snowboydetect.SnowboyDetect_SampleRate(self)
  118. def NumChannels(self):
  119. return _snowboydetect.SnowboyDetect_NumChannels(self)
  120. def BitsPerSample(self):
  121. return _snowboydetect.SnowboyDetect_BitsPerSample(self)
  122. __swig_destroy__ = _snowboydetect.delete_SnowboyDetect
  123. __del__ = lambda self: None
  124. SnowboyDetect_swigregister = _snowboydetect.SnowboyDetect_swigregister
  125. SnowboyDetect_swigregister(SnowboyDetect)
  126. class SnowboyVad(_object):
  127. __swig_setmethods__ = {}
  128. __setattr__ = lambda self, name, value: _swig_setattr(self, SnowboyVad, name, value)
  129. __swig_getmethods__ = {}
  130. __getattr__ = lambda self, name: _swig_getattr(self, SnowboyVad, name)
  131. __repr__ = _swig_repr
  132. def __init__(self, resource_filename):
  133. this = _snowboydetect.new_SnowboyVad(resource_filename)
  134. try:
  135. self.this.append(this)
  136. except __builtin__.Exception:
  137. self.this = this
  138. def Reset(self):
  139. return _snowboydetect.SnowboyVad_Reset(self)
  140. def RunVad(self, *args):
  141. return _snowboydetect.SnowboyVad_RunVad(self, *args)
  142. def SetAudioGain(self, audio_gain):
  143. return _snowboydetect.SnowboyVad_SetAudioGain(self, audio_gain)
  144. def ApplyFrontend(self, apply_frontend):
  145. return _snowboydetect.SnowboyVad_ApplyFrontend(self, apply_frontend)
  146. def SampleRate(self):
  147. return _snowboydetect.SnowboyVad_SampleRate(self)
  148. def NumChannels(self):
  149. return _snowboydetect.SnowboyVad_NumChannels(self)
  150. def BitsPerSample(self):
  151. return _snowboydetect.SnowboyVad_BitsPerSample(self)
  152. __swig_destroy__ = _snowboydetect.delete_SnowboyVad
  153. __del__ = lambda self: None
  154. SnowboyVad_swigregister = _snowboydetect.SnowboyVad_swigregister
  155. SnowboyVad_swigregister(SnowboyVad)
  156. # This file is compatible with both classic and new-style classes.