w-rui
Committed by GitHub

Add constructor fromPtr() for all flutter class with factory ctor. (#1667)

Co-authored-by: wangrui <wangrui@oecore.com>
... ... @@ -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.
... ...
... ... @@ -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()
... ...
... ... @@ -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() {
... ...
... ... @@ -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});
... ...
... ... @@ -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()
... ...
... ... @@ -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.
... ...
... ... @@ -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
... ...
... ... @@ -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()
... ...
... ... @@ -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.
... ...