snowboydetect.py 4.3 KB

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