diff --git a/flutter/sherpa_onnx/lib/src/audio_tagging.dart b/flutter/sherpa_onnx/lib/src/audio_tagging.dart index 6c650b30c..3e3dbed2f 100644 --- a/flutter/sherpa_onnx/lib/src/audio_tagging.dart +++ b/flutter/sherpa_onnx/lib/src/audio_tagging.dart @@ -62,6 +62,8 @@ class AudioEvent { } class AudioTagging { + AudioTagging.fromPtr({required this.ptr, required this.config}); + AudioTagging._({required this.ptr, required this.config}); // The user has to invoke AudioTagging.free() to avoid memory leak. diff --git a/flutter/sherpa_onnx/lib/src/keyword_spotter.dart b/flutter/sherpa_onnx/lib/src/keyword_spotter.dart index c09867995..6e2c669ae 100644 --- a/flutter/sherpa_onnx/lib/src/keyword_spotter.dart +++ b/flutter/sherpa_onnx/lib/src/keyword_spotter.dart @@ -53,6 +53,8 @@ class KeywordResult { } class KeywordSpotter { + KeywordSpotter.fromPtr({required this.ptr, required this.config}); + KeywordSpotter._({required this.ptr, required this.config}); /// The user is responsible to call the OnlineRecognizer.free() diff --git a/flutter/sherpa_onnx/lib/src/offline_recognizer.dart b/flutter/sherpa_onnx/lib/src/offline_recognizer.dart index 2f6f167d4..01bceccce 100644 --- a/flutter/sherpa_onnx/lib/src/offline_recognizer.dart +++ b/flutter/sherpa_onnx/lib/src/offline_recognizer.dart @@ -227,6 +227,8 @@ class OfflineRecognizerResult { } class OfflineRecognizer { + OfflineRecognizer.fromPtr({required this.ptr, required this.config}); + OfflineRecognizer._({required this.ptr, required this.config}); void free() { diff --git a/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart b/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart index 5981e3c04..fe046a166 100644 --- a/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart +++ b/flutter/sherpa_onnx/lib/src/offline_speaker_diarization.dart @@ -94,6 +94,9 @@ class OfflineSpeakerDiarizationConfig { } class OfflineSpeakerDiarization { + OfflineSpeakerDiarization.fromPtr( + {required this.ptr, required this.config, required this.sampleRate}); + OfflineSpeakerDiarization._( {required this.ptr, required this.config, required this.sampleRate}); diff --git a/flutter/sherpa_onnx/lib/src/online_recognizer.dart b/flutter/sherpa_onnx/lib/src/online_recognizer.dart index 18d5a6000..69ed93894 100644 --- a/flutter/sherpa_onnx/lib/src/online_recognizer.dart +++ b/flutter/sherpa_onnx/lib/src/online_recognizer.dart @@ -162,6 +162,8 @@ class OnlineRecognizerResult { } class OnlineRecognizer { + OnlineRecognizer.fromPtr({required this.ptr, required this.config}); + OnlineRecognizer._({required this.ptr, required this.config}); /// The user is responsible to call the OnlineRecognizer.free() diff --git a/flutter/sherpa_onnx/lib/src/punctuation.dart b/flutter/sherpa_onnx/lib/src/punctuation.dart index b4197fa46..dd38a2445 100644 --- a/flutter/sherpa_onnx/lib/src/punctuation.dart +++ b/flutter/sherpa_onnx/lib/src/punctuation.dart @@ -36,6 +36,8 @@ class OfflinePunctuationConfig { } class OfflinePunctuation { + OfflinePunctuation.fromPtr({required this.ptr, required this.config}); + OfflinePunctuation._({required this.ptr, required this.config}); // The user has to invoke OfflinePunctuation.free() to avoid memory leak. diff --git a/flutter/sherpa_onnx/lib/src/speaker_identification.dart b/flutter/sherpa_onnx/lib/src/speaker_identification.dart index 5c2e10744..8b27dbc69 100644 --- a/flutter/sherpa_onnx/lib/src/speaker_identification.dart +++ b/flutter/sherpa_onnx/lib/src/speaker_identification.dart @@ -25,6 +25,8 @@ class SpeakerEmbeddingExtractorConfig { } class SpeakerEmbeddingExtractor { + SpeakerEmbeddingExtractor.fromPtr({required this.ptr, required this.dim}); + SpeakerEmbeddingExtractor._({required this.ptr, required this.dim}); /// The user is responsible to call the SpeakerEmbeddingExtractor.free() @@ -101,6 +103,8 @@ class SpeakerEmbeddingExtractor { } class SpeakerEmbeddingManager { + SpeakerEmbeddingManager.fromPtr({required this.ptr, required this.dim}); + SpeakerEmbeddingManager._({required this.ptr, required this.dim}); // The user has to use SpeakerEmbeddingManager.free() to avoid memory leak diff --git a/flutter/sherpa_onnx/lib/src/tts.dart b/flutter/sherpa_onnx/lib/src/tts.dart index f779188b7..2f550e273 100644 --- a/flutter/sherpa_onnx/lib/src/tts.dart +++ b/flutter/sherpa_onnx/lib/src/tts.dart @@ -82,6 +82,8 @@ class GeneratedAudio { } class OfflineTts { + OfflineTts.fromPtr({required this.ptr, required this.config}); + OfflineTts._({required this.ptr, required this.config}); /// The user is responsible to call the OfflineTts.free() diff --git a/flutter/sherpa_onnx/lib/src/vad.dart b/flutter/sherpa_onnx/lib/src/vad.dart index 10fac5a45..7db0e55e0 100644 --- a/flutter/sherpa_onnx/lib/src/vad.dart +++ b/flutter/sherpa_onnx/lib/src/vad.dart @@ -54,6 +54,8 @@ class SpeechSegment { } class CircularBuffer { + CircularBuffer.fromPtr({required this.ptr}); + CircularBuffer._({required this.ptr}); /// The user has to invoke CircularBuffer.free() on the returned instance @@ -115,6 +117,8 @@ class CircularBuffer { } class VoiceActivityDetector { + VoiceActivityDetector.fromPtr({required this.ptr, required this.config}); + VoiceActivityDetector._({required this.ptr, required this.config}); // The user has to invoke VoiceActivityDetector.free() to avoid memory leak.