update kotlin api for better release native object and add user-friendly apis. (#1275)

This commit is contained in:
Robin Zhong
2024-08-22 19:18:11 +08:00
committed by GitHub
parent 5a2aa110b8
commit d8001d6edc
8 changed files with 100 additions and 15 deletions

View File

@@ -13,6 +13,14 @@ class OfflineStream(var ptr: Long) {
fun release() = finalize()
fun use(block: (OfflineStream) -> Unit) {
try {
block(this)
} finally {
release()
}
}
private external fun acceptWaveform(ptr: Long, samples: FloatArray, sampleRate: Int)
private external fun delete(ptr: Long)