@mentra/bluetooth-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/README.md +278 -0
  2. package/android/build.gradle +167 -0
  3. package/android/lc3Lib/CMakeLists.txt +6 -0
  4. package/android/lc3Lib/build.gradle +109 -0
  5. package/android/lc3Lib/proguard-rules.pro +33 -0
  6. package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
  7. package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
  8. package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
  9. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
  10. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
  11. package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
  12. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
  13. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
  14. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
  15. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
  16. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
  17. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
  18. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
  19. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
  20. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
  21. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
  22. package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
  23. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
  24. package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
  25. package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
  26. package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
  27. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
  28. package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
  29. package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
  30. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
  31. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
  32. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
  33. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
  34. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
  35. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
  36. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
  37. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
  38. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
  39. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
  40. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
  41. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
  42. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
  43. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
  44. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
  45. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
  46. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
  47. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
  48. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
  49. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
  50. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
  51. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
  52. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
  53. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
  54. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
  55. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
  56. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
  57. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
  58. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
  59. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
  60. package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
  61. package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
  62. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
  63. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
  64. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
  65. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
  66. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
  67. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
  68. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
  69. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
  70. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
  71. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
  72. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
  73. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
  74. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
  75. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
  76. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
  77. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
  78. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
  79. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
  80. package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
  81. package/android/lc3Lib/src/main/java/com/mentra/lc3Lib/Lc3Cpp.java +38 -0
  82. package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
  83. package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
  84. package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
  85. package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
  86. package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
  87. package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
  88. package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
  89. package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
  90. package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
  91. package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
  92. package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
  93. package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
  94. package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
  95. package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
  96. package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
  97. package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
  98. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
  99. package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
  100. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
  101. package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
  102. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
  103. package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
  104. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
  105. package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
  106. package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
  107. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
  108. package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
  109. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
  110. package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
  111. package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
  112. package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
  113. package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
  114. package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
  115. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
  116. package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
  117. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
  118. package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
  119. package/android/settings.gradle +1 -0
  120. package/android/src/main/AndroidManifest.xml +40 -0
  121. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +528 -0
  122. package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +610 -0
  123. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +1616 -0
  124. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +314 -0
  125. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +1710 -0
  126. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +554 -0
  127. package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +68 -0
  128. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +158 -0
  129. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +934 -0
  130. package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +175 -0
  131. package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +1109 -0
  132. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +3974 -0
  133. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +3551 -0
  134. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +1327 -0
  135. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +6959 -0
  136. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1655 -0
  137. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +53675 -0
  138. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +202 -0
  139. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +224 -0
  140. package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +340 -0
  141. package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +465 -0
  142. package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +221 -0
  143. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AES.java +106 -0
  144. package/android/src/main/java/com/mentra/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
  145. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
  146. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +179 -0
  147. package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +44 -0
  148. package/android/src/main/java/com/mentra/bluetoothsdk/utils/G1Text.kt +436 -0
  149. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
  150. package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleUploadService.java +76 -0
  151. package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +791 -0
  152. package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +186 -0
  153. package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +589 -0
  154. package/android/src/main/java/com/mentra/bluetoothsdk/utils/PhoneAudioMonitor.kt +303 -0
  155. package/android/src/main/java/com/mentra/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
  156. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
  157. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
  158. package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
  159. package/android/src/main/res/values/strings.xml +4 -0
  160. package/app.plugin.js +1 -0
  161. package/build/BluetoothSdk.types.d.ts +498 -0
  162. package/build/BluetoothSdk.types.d.ts.map +1 -0
  163. package/build/BluetoothSdk.types.js +23 -0
  164. package/build/BluetoothSdk.types.js.map +1 -0
  165. package/build/BluetoothSdkModule.d.ts +71 -0
  166. package/build/BluetoothSdkModule.d.ts.map +1 -0
  167. package/build/BluetoothSdkModule.js +106 -0
  168. package/build/BluetoothSdkModule.js.map +1 -0
  169. package/build/index.d.ts +3 -0
  170. package/build/index.d.ts.map +1 -0
  171. package/build/index.js +5 -0
  172. package/build/index.js.map +1 -0
  173. package/expo-module.config.json +9 -0
  174. package/ios/BluetoothSdkModule.swift +665 -0
  175. package/ios/MentraBluetoothSDK.podspec +77 -0
  176. package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
  177. package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
  178. package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
  179. package/ios/Packages/CoreObjC/attdet.c +92 -0
  180. package/ios/Packages/CoreObjC/attdet.h +44 -0
  181. package/ios/Packages/CoreObjC/bits.c +375 -0
  182. package/ios/Packages/CoreObjC/bits.h +315 -0
  183. package/ios/Packages/CoreObjC/bwdet.c +129 -0
  184. package/ios/Packages/CoreObjC/bwdet.h +69 -0
  185. package/ios/Packages/CoreObjC/common.h +151 -0
  186. package/ios/Packages/CoreObjC/energy.c +70 -0
  187. package/ios/Packages/CoreObjC/energy.h +43 -0
  188. package/ios/Packages/CoreObjC/fastmath.h +158 -0
  189. package/ios/Packages/CoreObjC/lc3.c +704 -0
  190. package/ios/Packages/CoreObjC/lc3.h +313 -0
  191. package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
  192. package/ios/Packages/CoreObjC/lc3_private.h +163 -0
  193. package/ios/Packages/CoreObjC/ltpf.c +905 -0
  194. package/ios/Packages/CoreObjC/ltpf.h +111 -0
  195. package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
  196. package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
  197. package/ios/Packages/CoreObjC/makefile.mk +35 -0
  198. package/ios/Packages/CoreObjC/mdct.c +469 -0
  199. package/ios/Packages/CoreObjC/mdct.h +57 -0
  200. package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
  201. package/ios/Packages/CoreObjC/meson.build +61 -0
  202. package/ios/Packages/CoreObjC/plc.c +61 -0
  203. package/ios/Packages/CoreObjC/plc.h +57 -0
  204. package/ios/Packages/CoreObjC/rnnoise.h +114 -0
  205. package/ios/Packages/CoreObjC/sns.c +880 -0
  206. package/ios/Packages/CoreObjC/sns.h +103 -0
  207. package/ios/Packages/CoreObjC/spec.c +907 -0
  208. package/ios/Packages/CoreObjC/spec.h +119 -0
  209. package/ios/Packages/CoreObjC/tables.c +3457 -0
  210. package/ios/Packages/CoreObjC/tables.h +94 -0
  211. package/ios/Packages/CoreObjC/tns.c +457 -0
  212. package/ios/Packages/CoreObjC/tns.h +99 -0
  213. package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
  214. package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
  215. package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +1659 -0
  216. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +162 -0
  217. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +1852 -0
  218. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +674 -0
  219. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +44 -0
  220. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
  221. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/sherpa-onnx.a +0 -0
  222. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
  223. package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/sherpa-onnx.a +0 -0
  224. package/ios/Packages/VAD/Common/VAD/VADQuality.swift +41 -0
  225. package/ios/Packages/VAD/Common/VAD/VADState.swift +26 -0
  226. package/ios/Packages/VAD/Common/VAD/VADStrategy.swift +29 -0
  227. package/ios/Packages/VAD/Common/VAD/VADType.swift +14 -0
  228. package/ios/Packages/VAD/Data/Configuration.swift +68 -0
  229. package/ios/Packages/VAD/Data/FrameSize.swift +39 -0
  230. package/ios/Packages/VAD/Data/Record.swift +13 -0
  231. package/ios/Packages/VAD/Data/Result.swift +22 -0
  232. package/ios/Packages/VAD/Data/SampleRate.swift +48 -0
  233. package/ios/Packages/VAD/Silero/Model/silero_vad.onnx +0 -0
  234. package/ios/Packages/VAD/Silero/SileroVAD.swift +284 -0
  235. package/ios/Packages/VAD/Silero/SileroVADStrategy.swift +64 -0
  236. package/ios/Packages/libbz2/module.modulemap +5 -0
  237. package/ios/Packages/libbz2/shim.h +1 -0
  238. package/ios/Source/Bridge.swift +353 -0
  239. package/ios/Source/Bridging-Header.h +16 -0
  240. package/ios/Source/DeviceManager.swift +1478 -0
  241. package/ios/Source/DeviceStore.swift +295 -0
  242. package/ios/Source/MentraBluetoothSDK.swift +2439 -0
  243. package/ios/Source/ObservableStore.swift +88 -0
  244. package/ios/Source/PrivacyInfo.xcprivacy +23 -0
  245. package/ios/Source/controllers/ControllerManager.swift +187 -0
  246. package/ios/Source/controllers/R1.swift +827 -0
  247. package/ios/Source/services/PhoneMic.swift +662 -0
  248. package/ios/Source/sgcs/Frame.swift +651 -0
  249. package/ios/Source/sgcs/G1.swift +2505 -0
  250. package/ios/Source/sgcs/G2.swift +3730 -0
  251. package/ios/Source/sgcs/Mach1.swift +543 -0
  252. package/ios/Source/sgcs/MentraLive.swift +4708 -0
  253. package/ios/Source/sgcs/MentraNex.swift +2479 -0
  254. package/ios/Source/sgcs/SGCManager.swift +243 -0
  255. package/ios/Source/sgcs/Simulated.swift +270 -0
  256. package/ios/Source/sgcs/mentraos_ble.pb.swift +3811 -0
  257. package/ios/Source/stt/STTTools.swift +154 -0
  258. package/ios/Source/stt/SherpaOnnxTranscriber.swift +401 -0
  259. package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
  260. package/ios/Source/utils/Constants.swift +74 -0
  261. package/ios/Source/utils/Enums.swift +95 -0
  262. package/ios/Source/utils/G1Text.swift +2067 -0
  263. package/ios/Source/utils/JSCExperiment.swift +241 -0
  264. package/ios/Source/utils/MemoryMonitor.swift +44 -0
  265. package/ios/Source/utils/MessageChunker.swift +164 -0
  266. package/ios/Source/utils/Models.swift +135 -0
  267. package/ios/Source/utils/PhoneAudioMonitor.swift +226 -0
  268. package/ios/Source/utils/TarBz2Extractor.swift +206 -0
  269. package/package.json +78 -0
  270. package/plugin/build/index.d.ts +6 -0
  271. package/plugin/build/index.js +12 -0
  272. package/plugin/build/withAndroid.d.ts +4 -0
  273. package/plugin/build/withAndroid.js +80 -0
  274. package/plugin/build/withIos.d.ts +4 -0
  275. package/plugin/build/withIos.js +64 -0
  276. package/src/BluetoothSdk.types.ts +581 -0
  277. package/src/BluetoothSdkModule.ts +259 -0
  278. package/src/index.ts +4 -0
@@ -0,0 +1,157 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: LPC low level routines
14
+ last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ /* Some of these routines (autocorrelator, LPC coefficient estimator)
19
+ are derived from code written by Jutta Degener and Carsten Bormann;
20
+ thus we include their copyright below. The entirety of this file
21
+ is freely redistributable on the condition that both of these
22
+ copyright notices are preserved without modification. */
23
+
24
+ /* Preserved Copyright: *********************************************/
25
+
26
+ /* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
27
+ Technische Universita"t Berlin
28
+
29
+ Any use of this software is permitted provided that this notice is not
30
+ removed and that neither the authors nor the Technische Universita"t
31
+ Berlin are deemed to have made any representations as to the
32
+ suitability of this software for any purpose nor are held responsible
33
+ for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR
34
+ THIS SOFTWARE.
35
+
36
+ As a matter of courtesy, the authors request to be informed about uses
37
+ this software has found, about bugs in this software, and about any
38
+ improvements that may be of general interest.
39
+
40
+ Berlin, 28.11.1994
41
+ Jutta Degener
42
+ Carsten Bormann
43
+
44
+ *********************************************************************/
45
+
46
+ #include <stdlib.h>
47
+ #include <string.h>
48
+ #include <math.h>
49
+ #include "stack_alloc.h"
50
+ #include "lpc.h"
51
+
52
+ /* Autocorrelation LPC coeff generation algorithm invented by
53
+ N. Levinson in 1947, modified by J. Durbin in 1959. */
54
+
55
+ /* Input : n elements of time doamin data
56
+ Output: m lpc coefficients, excitation energy */
57
+
58
+ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m,int stride){
59
+ double *aut=alloca(sizeof(*aut)*(m+1));
60
+ double *lpc=alloca(sizeof(*lpc)*(m));
61
+ double error;
62
+ double epsilon;
63
+ int i,j;
64
+
65
+ /* autocorrelation, p+1 lag coefficients */
66
+ j=m+1;
67
+ while(j--){
68
+ double d=0; /* double needed for accumulator depth */
69
+ for(i=j;i<n;i++)d+=(double)data[i*stride]*data[(i-j)*stride];
70
+ aut[j]=d;
71
+ }
72
+
73
+ /* Generate lpc coefficients from autocorr values */
74
+
75
+ /* set our noise floor to about -100dB */
76
+ error=aut[0] * (1. + 1e-10);
77
+ epsilon=1e-9*aut[0]+1e-10;
78
+
79
+ for(i=0;i<m;i++){
80
+ double r= -aut[i+1];
81
+
82
+ if(error<epsilon){
83
+ memset(lpc+i,0,(m-i)*sizeof(*lpc));
84
+ goto done;
85
+ }
86
+
87
+ /* Sum up this iteration's reflection coefficient; note that in
88
+ Vorbis we don't save it. If anyone wants to recycle this code
89
+ and needs reflection coefficients, save the results of 'r' from
90
+ each iteration. */
91
+
92
+ for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
93
+ r/=error;
94
+
95
+ /* Update LPC coefficients and total error */
96
+
97
+ lpc[i]=r;
98
+ for(j=0;j<i/2;j++){
99
+ double tmp=lpc[j];
100
+
101
+ lpc[j]+=r*lpc[i-1-j];
102
+ lpc[i-1-j]+=r*tmp;
103
+ }
104
+ if(i&1)lpc[j]+=lpc[j]*r;
105
+
106
+ error*=1.-r*r;
107
+
108
+ }
109
+
110
+ done:
111
+
112
+ /* slightly damp the filter */
113
+ {
114
+ double g = .99;
115
+ double damp = g;
116
+ for(j=0;j<m;j++){
117
+ lpc[j]*=damp;
118
+ damp*=g;
119
+ }
120
+ }
121
+
122
+ for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
123
+
124
+ /* we need the error value to know how big an impulse to hit the
125
+ filter with later */
126
+
127
+ return error;
128
+ }
129
+
130
+ void vorbis_lpc_predict(float *coeff,float *prime,int m,
131
+ float *data,long n,int stride){
132
+
133
+ /* in: coeff[0...m-1] LPC coefficients
134
+ prime[0...m-1] initial values (allocated size of n+m-1)
135
+ out: data[0...n-1] data samples */
136
+
137
+ long i,j,o,p;
138
+ float y;
139
+ float *work=alloca(sizeof(*work)*(m+n));
140
+
141
+ if(!prime)
142
+ for(i=0;i<m;i++)
143
+ work[i]=0.f;
144
+ else
145
+ for(i=0;i<m;i++)
146
+ work[i]=prime[i*stride];
147
+
148
+ for(i=0;i<n;i++){
149
+ y=0;
150
+ o=i;
151
+ p=m;
152
+ for(j=0;j<m;j++)
153
+ y-=work[o++]*coeff[--p];
154
+
155
+ data[i*stride]=work[o]=y;
156
+ }
157
+ }
@@ -0,0 +1,27 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: LPC low level routines
14
+ last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ #ifndef _V_LPC_H_
19
+ #define _V_LPC_H_
20
+
21
+ /* simple linear scale LPC code */
22
+ extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m,int stride);
23
+
24
+ extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
25
+ float *data,long n,int stride);
26
+
27
+ #endif
@@ -0,0 +1,286 @@
1
+ /* Copyright (C)2012 Xiph.Org Foundation
2
+ File: opus_header.c
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+
8
+ - Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ - Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
19
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #ifdef HAVE_CONFIG_H
29
+ # include "config.h"
30
+ #endif
31
+
32
+ #include "opus_header.h"
33
+ #include <string.h>
34
+ #include <stdio.h>
35
+
36
+ /* Header contents:
37
+ - "OpusHead" (64 bits)
38
+ - version number (8 bits)
39
+ - Channels C (8 bits)
40
+ - Pre-skip (16 bits)
41
+ - Sampling rate (32 bits)
42
+ - Gain in dB (16 bits, S7.8)
43
+ - Mapping (8 bits, 0=single stream (mono/stereo) 1=Vorbis mapping,
44
+ 2..254: reserved, 255: multistream with no mapping)
45
+
46
+ - if (mapping != 0)
47
+ - N = totel number of streams (8 bits)
48
+ - M = number of paired streams (8 bits)
49
+ - C times channel origin
50
+ - if (C<2*M)
51
+ - stream = byte/2
52
+ - if (byte&0x1 == 0)
53
+ - left
54
+ else
55
+ - right
56
+ - else
57
+ - stream = byte-M
58
+ */
59
+
60
+ typedef struct {
61
+ unsigned char *data;
62
+ int maxlen;
63
+ int pos;
64
+ } Packet;
65
+
66
+ typedef struct {
67
+ const unsigned char *data;
68
+ int maxlen;
69
+ int pos;
70
+ } ROPacket;
71
+
72
+ static int write_uint32(Packet *p, ogg_uint32_t val)
73
+ {
74
+ if (p->pos>p->maxlen-4)
75
+ return 0;
76
+ p->data[p->pos ] = (val ) & 0xFF;
77
+ p->data[p->pos+1] = (val>> 8) & 0xFF;
78
+ p->data[p->pos+2] = (val>>16) & 0xFF;
79
+ p->data[p->pos+3] = (val>>24) & 0xFF;
80
+ p->pos += 4;
81
+ return 1;
82
+ }
83
+
84
+ static int write_uint16(Packet *p, ogg_uint16_t val)
85
+ {
86
+ if (p->pos>p->maxlen-2)
87
+ return 0;
88
+ p->data[p->pos ] = (val ) & 0xFF;
89
+ p->data[p->pos+1] = (val>> 8) & 0xFF;
90
+ p->pos += 2;
91
+ return 1;
92
+ }
93
+
94
+ static int write_chars(Packet *p, const unsigned char *str, int nb_chars)
95
+ {
96
+ int i;
97
+ if (p->pos>p->maxlen-nb_chars)
98
+ return 0;
99
+ for (i=0;i<nb_chars;i++)
100
+ p->data[p->pos++] = str[i];
101
+ return 1;
102
+ }
103
+
104
+ static int read_uint32(ROPacket *p, ogg_uint32_t *val)
105
+ {
106
+ if (p->pos>p->maxlen-4)
107
+ return 0;
108
+ *val = (ogg_uint32_t)p->data[p->pos ];
109
+ *val |= (ogg_uint32_t)p->data[p->pos+1]<< 8;
110
+ *val |= (ogg_uint32_t)p->data[p->pos+2]<<16;
111
+ *val |= (ogg_uint32_t)p->data[p->pos+3]<<24;
112
+ p->pos += 4;
113
+ return 1;
114
+ }
115
+
116
+ static int read_uint16(ROPacket *p, ogg_uint16_t *val)
117
+ {
118
+ if (p->pos>p->maxlen-2)
119
+ return 0;
120
+ *val = (ogg_uint16_t)p->data[p->pos ];
121
+ *val |= (ogg_uint16_t)p->data[p->pos+1]<<8;
122
+ p->pos += 2;
123
+ return 1;
124
+ }
125
+
126
+ static int read_chars(ROPacket *p, unsigned char *str, int nb_chars)
127
+ {
128
+ int i;
129
+ if (p->pos>p->maxlen-nb_chars)
130
+ return 0;
131
+ for (i=0;i<nb_chars;i++)
132
+ str[i] = p->data[p->pos++];
133
+ return 1;
134
+ }
135
+
136
+ int opus_header_parse(const unsigned char *packet, int len, OpusHeader *h)
137
+ {
138
+ int i;
139
+ char str[9];
140
+ ROPacket p;
141
+ unsigned char ch;
142
+ ogg_uint16_t shortval;
143
+
144
+ p.data = packet;
145
+ p.maxlen = len;
146
+ p.pos = 0;
147
+ str[8] = 0;
148
+ if (len<19)return 0;
149
+ read_chars(&p, (unsigned char*)str, 8);
150
+ if (memcmp(str, "OpusHead", 8)!=0)
151
+ return 0;
152
+
153
+ if (!read_chars(&p, &ch, 1))
154
+ return 0;
155
+ h->version = ch;
156
+ if((h->version&240) != 0) /* Only major version 0 supported. */
157
+ return 0;
158
+
159
+ if (!read_chars(&p, &ch, 1))
160
+ return 0;
161
+ h->channels = ch;
162
+ if (h->channels == 0)
163
+ return 0;
164
+
165
+ if (!read_uint16(&p, &shortval))
166
+ return 0;
167
+ h->preskip = shortval;
168
+
169
+ if (!read_uint32(&p, &h->input_sample_rate))
170
+ return 0;
171
+
172
+ if (!read_uint16(&p, &shortval))
173
+ return 0;
174
+ h->gain = (short)shortval;
175
+
176
+ if (!read_chars(&p, &ch, 1))
177
+ return 0;
178
+ h->channel_mapping = ch;
179
+
180
+ if (h->channel_mapping != 0)
181
+ {
182
+ if (!read_chars(&p, &ch, 1))
183
+ return 0;
184
+
185
+ if (ch<1)
186
+ return 0;
187
+ h->nb_streams = ch;
188
+
189
+ if (!read_chars(&p, &ch, 1))
190
+ return 0;
191
+
192
+ if (ch>h->nb_streams || (ch+h->nb_streams)>255)
193
+ return 0;
194
+ h->nb_coupled = ch;
195
+
196
+ /* Multi-stream support */
197
+ for (i=0;i<h->channels;i++)
198
+ {
199
+ if (!read_chars(&p, &h->stream_map[i], 1))
200
+ return 0;
201
+ if (h->stream_map[i]>(h->nb_streams+h->nb_coupled) && h->stream_map[i]!=255)
202
+ return 0;
203
+ }
204
+ } else {
205
+ if(h->channels>2)
206
+ return 0;
207
+ h->nb_streams = 1;
208
+ h->nb_coupled = h->channels>1;
209
+ h->stream_map[0]=0;
210
+ h->stream_map[1]=1;
211
+ }
212
+ /*For version 0/1 we know there won't be any more data
213
+ so reject any that have data past the end.*/
214
+ if ((h->version==0 || h->version==1) && p.pos != len)
215
+ return 0;
216
+ return 1;
217
+ }
218
+
219
+ int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len)
220
+ {
221
+ int i;
222
+ Packet p;
223
+ unsigned char ch;
224
+
225
+ p.data = packet;
226
+ p.maxlen = len;
227
+ p.pos = 0;
228
+ if (len<19)return 0;
229
+ if (!write_chars(&p, (const unsigned char*)"OpusHead", 8))
230
+ return 0;
231
+ /* Version is 1 */
232
+ ch = 1;
233
+ if (!write_chars(&p, &ch, 1))
234
+ return 0;
235
+
236
+ ch = h->channels;
237
+ if (!write_chars(&p, &ch, 1))
238
+ return 0;
239
+
240
+ if (!write_uint16(&p, h->preskip))
241
+ return 0;
242
+
243
+ if (!write_uint32(&p, h->input_sample_rate))
244
+ return 0;
245
+
246
+ if (!write_uint16(&p, h->gain))
247
+ return 0;
248
+
249
+ ch = h->channel_mapping;
250
+ if (!write_chars(&p, &ch, 1))
251
+ return 0;
252
+
253
+ if (h->channel_mapping != 0)
254
+ {
255
+ ch = h->nb_streams;
256
+ if (!write_chars(&p, &ch, 1))
257
+ return 0;
258
+
259
+ ch = h->nb_coupled;
260
+ if (!write_chars(&p, &ch, 1))
261
+ return 0;
262
+
263
+ /* Multi-stream support */
264
+ for (i=0;i<h->channels;i++)
265
+ {
266
+ if (!write_chars(&p, &h->stream_map[i], 1))
267
+ return 0;
268
+ }
269
+ }
270
+
271
+ return p.pos;
272
+ }
273
+
274
+ /* This is just here because it's a convenient file linked by both opusenc and
275
+ opusdec (to guarantee this maps stays in sync). */
276
+ const int wav_permute_matrix[8][8] =
277
+ {
278
+ {0}, /* 1.0 mono */
279
+ {0,1}, /* 2.0 stereo */
280
+ {0,2,1}, /* 3.0 channel ('wide') stereo */
281
+ {0,1,2,3}, /* 4.0 discrete quadraphonic */
282
+ {0,2,1,3,4}, /* 5.0 surround */
283
+ {0,2,1,4,5,3}, /* 5.1 surround */
284
+ {0,2,1,5,6,4,3}, /* 6.1 surround */
285
+ {0,2,1,6,7,4,5,3} /* 7.1 surround (classic theater 8-track) */
286
+ };
@@ -0,0 +1,59 @@
1
+ /* Copyright (C)2012 Xiph.Org Foundation
2
+ File: opus_header.h
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+
8
+ - Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ - Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
19
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #ifndef OPUS_HEADER_H
29
+ #define OPUS_HEADER_H
30
+
31
+ #include "../../../../src/main/cpp/libogg/ogg.h"
32
+
33
+ #ifdef __cplusplus
34
+ extern "C" {
35
+ #endif
36
+
37
+ typedef struct {
38
+ int version;
39
+ int channels; /* Number of channels: 1..255 */
40
+ int preskip;
41
+ ogg_uint32_t input_sample_rate;
42
+ int gain; /* in dB S7.8 should be zero whenever possible */
43
+ int channel_mapping;
44
+ /* The rest is only used if channel_mapping != 0 */
45
+ int nb_streams;
46
+ int nb_coupled;
47
+ unsigned char stream_map[255];
48
+ } OpusHeader;
49
+
50
+ int opus_header_parse(const unsigned char *header, int len, OpusHeader *h);
51
+ int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len);
52
+
53
+ extern const int wav_permute_matrix[8][8];
54
+
55
+ #ifdef __cplusplus
56
+ }
57
+ #endif
58
+
59
+ #endif