Skip to content

Commit

Permalink
fix(Android): fix android implement
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Oct 21, 2024
1 parent fabab7f commit 3aab944
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions android/src/main/java/com/barkrn/BarkContext.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.barkrn

class BarkContext {
private var context: Long = 0
private var context: Long = 0L

class BarkResult(success: Boolean, load_time: Int, eval_time: Int) {
val success: Boolean
val load_time: Int
val eval_time: Int
}
class BarkResult(success: Boolean, load_time: Int, eval_time: Int)

external fun nativeInitContext(model_path: String, params: Map<String, Any>): Long
external fun nativeGenerate(context: Long, text: String, out_path: String, threads: Int): BarkResult
Expand All @@ -25,9 +21,9 @@ class BarkContext {
}

fun release() {
if (context != 0) {
if (context != 0L) {
nativeReleaseContext(context)
context = 0
context = 0L
}
}
}
2 changes: 1 addition & 1 deletion android/src/oldarch/BarkRnSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abstract class BarkRnSpec internal constructor(context: ReactApplicationContext)
ReactContextBaseJavaModule(context) {

abstract fun init_context(model_path: String, params: ReadableMap, promise: Promise)
abstract fun generate(id: Int, text: String, threads: Int, audio_path: String, promise: Promise)
abstract fun generate(id: Int, text: String, out_path: String, threads: Int, promise: Promise)
abstract fun release_context(id: Int, promise: Promise)
abstract fun release_all_contexts(promise: Promise)
}

0 comments on commit 3aab944

Please sign in to comment.