snowboydetect.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # This file was automatically generated by SWIG (http://www.swig.org).
  2. # Version 3.0.8
  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 core.ConfigurationManager import SettingLoader
  7. from sys import version_info
  8. settings = SettingLoader.get_settings()
  9. module_file_path = "%s/_snowboydetect" % settings.machine
  10. if version_info >= (2, 6, 0):
  11. def swig_import_helper():
  12. from os.path import dirname
  13. import imp
  14. fp = None
  15. try:
  16. fp, pathname, description = imp.find_module(module_file_path, [dirname(__file__)])
  17. except ImportError:
  18. import _snowboydetect
  19. return _snowboydetect
  20. if fp is not None:
  21. try:
  22. _mod = imp.load_module('_snowboydetect', fp, pathname, description)
  23. finally:
  24. fp.close()
  25. return _mod
  26. _snowboydetect = swig_import_helper()
  27. del swig_import_helper
  28. else:
  29. import _snowboydetect
  30. del version_info
  31. try:
  32. _swig_property = property
  33. except NameError:
  34. pass # Python < 2.2 doesn't have 'property'.
  35. def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
  36. if (name == "thisown"):
  37. return self.this.own(value)
  38. if (name == "this"):
  39. if type(value).__name__ == 'SwigPyObject':
  40. self.__dict__[name] = value
  41. return
  42. method = class_type.__swig_setmethods__.get(name, None)
  43. if method:
  44. return method(self, value)
  45. if (not static):
  46. if _newclass:
  47. object.__setattr__(self, name, value)
  48. else:
  49. self.__dict__[name] = value
  50. else:
  51. raise AttributeError("You cannot add attributes to %s" % self)
  52. def _swig_setattr(self, class_type, name, value):
  53. return _swig_setattr_nondynamic(self, class_type, name, value, 0)
  54. def _swig_getattr_nondynamic(self, class_type, name, static=1):
  55. if (name == "thisown"):
  56. return self.this.own()
  57. method = class_type.__swig_getmethods__.get(name, None)
  58. if method:
  59. return method(self)
  60. if (not static):
  61. return object.__getattr__(self, name)
  62. else:
  63. raise AttributeError(name)
  64. def _swig_getattr(self, class_type, name):
  65. return _swig_getattr_nondynamic(self, class_type, name, 0)
  66. def _swig_repr(self):
  67. try:
  68. strthis = "proxy of " + self.this.__repr__()
  69. except Exception:
  70. strthis = ""
  71. return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
  72. try:
  73. _object = object
  74. _newclass = 1
  75. except AttributeError:
  76. class _object:
  77. pass
  78. _newclass = 0
  79. class SnowboyDetect(_object):
  80. __swig_setmethods__ = {}
  81. __setattr__ = lambda self, name, value: _swig_setattr(self, SnowboyDetect, name, value)
  82. __swig_getmethods__ = {}
  83. __getattr__ = lambda self, name: _swig_getattr(self, SnowboyDetect, name)
  84. __repr__ = _swig_repr
  85. def __init__(self, resource_filename, model_str):
  86. this = _snowboydetect.new_SnowboyDetect(resource_filename, model_str)
  87. try:
  88. self.this.append(this)
  89. except Exception:
  90. self.this = this
  91. def Reset(self):
  92. return _snowboydetect.SnowboyDetect_Reset(self)
  93. def RunDetection(self, *args):
  94. return _snowboydetect.SnowboyDetect_RunDetection(self, *args)
  95. def SetSensitivity(self, sensitivity_str):
  96. return _snowboydetect.SnowboyDetect_SetSensitivity(self, sensitivity_str)
  97. def GetSensitivity(self):
  98. return _snowboydetect.SnowboyDetect_GetSensitivity(self)
  99. def SetAudioGain(self, audio_gain):
  100. return _snowboydetect.SnowboyDetect_SetAudioGain(self, audio_gain)
  101. def UpdateModel(self):
  102. return _snowboydetect.SnowboyDetect_UpdateModel(self)
  103. def NumHotwords(self):
  104. return _snowboydetect.SnowboyDetect_NumHotwords(self)
  105. def SampleRate(self):
  106. return _snowboydetect.SnowboyDetect_SampleRate(self)
  107. def NumChannels(self):
  108. return _snowboydetect.SnowboyDetect_NumChannels(self)
  109. def BitsPerSample(self):
  110. return _snowboydetect.SnowboyDetect_BitsPerSample(self)
  111. __swig_destroy__ = _snowboydetect.delete_SnowboyDetect
  112. __del__ = lambda self: None
  113. SnowboyDetect_swigregister = _snowboydetect.SnowboyDetect_swigregister
  114. SnowboyDetect_swigregister(SnowboyDetect)
  115. # This file is compatible with both classic and new-style classes.