whisper.rn 0.5.0-rc.5 → 0.5.0-rc.6

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.
@@ -110,6 +110,7 @@ build_library("rnwhisper" "generic" "")
110
110
 
111
111
  if (${ANDROID_ABI} STREQUAL "arm64-v8a")
112
112
  build_library("rnwhisper_v8fp16_va_2" "arm" "-march=armv8.2-a+fp16")
113
+ build_library("rnwhisper_v8_va_2" "arm" "-march=armv8.2-a")
113
114
  elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a")
114
115
  build_library("rnwhisper_vfpv4" "arm" "-mfpu=neon-vfpv4")
115
116
  elseif (${ANDROID_ABI} STREQUAL "x86_64")
@@ -64,6 +64,10 @@ public class RNWhisper implements LifecycleEventListener {
64
64
  }
65
65
 
66
66
  public void installJSIBindings(Promise promise) {
67
+ if (!WhisperContext.isNativeLibraryLoaded()) {
68
+ promise.reject("Native library not loaded");
69
+ return;
70
+ }
67
71
 
68
72
  AsyncTask task = new AsyncTask<Void, Void, Void>() {
69
73
  private Exception exception;
@@ -96,6 +100,11 @@ public class RNWhisper implements LifecycleEventListener {
96
100
  }
97
101
 
98
102
  public void toggleNativeLog(boolean enabled, Promise promise) {
103
+ if (!WhisperContext.isNativeLibraryLoaded()) {
104
+ promise.reject("Native library not loaded");
105
+ return;
106
+ }
107
+
99
108
  new AsyncTask<Void, Void, Boolean>() {
100
109
  private Exception exception;
101
110
 
@@ -477,6 +477,10 @@ public class WhisperContext {
477
477
  Log.d(NAME, "Loading librnwhisper_v8fp16_va_2.so");
478
478
  System.loadLibrary("rnwhisper_v8fp16_va_2");
479
479
  loadedLibrary = "rnwhisper_v8fp16_va_2";
480
+ } else {
481
+ Log.d(NAME, "Loading librnwhisper_v8_va_2.so");
482
+ System.loadLibrary("rnwhisper_v8_va_2");
483
+ loadedLibrary = "rnwhisper_v8_va_2";
480
484
  }
481
485
  } else if (WhisperContext.isArmeabiV7a()) {
482
486
  Log.d(NAME, "Loading librnwhisper_vfpv4.so");
@@ -491,6 +495,10 @@ public class WhisperContext {
491
495
  }
492
496
  }
493
497
 
498
+ public static boolean isNativeLibraryLoaded() {
499
+ return loadedLibrary != "";
500
+ }
501
+
494
502
  public static boolean isArm64V8a() {
495
503
  return Build.SUPPORTED_ABIS[0].equals("arm64-v8a");
496
504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whisper.rn",
3
- "version": "0.5.0-rc.5",
3
+ "version": "0.5.0-rc.6",
4
4
  "description": "React Native binding of whisper.cpp",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",