yujinqiu
Committed by GitHub

Expose VAD isDetected api to Swift (#356)

... ... @@ -488,6 +488,11 @@ int32_t SherpaOnnxVoiceActivityDetectorEmpty(
return p->impl->Empty();
}
int32_t SherpaOnnxVoiceActivityDetectorDetected(
SherpaOnnxVoiceActivityDetector *p) {
return p->impl->IsSpeechDetected();
}
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
SherpaOnnxVoiceActivityDetector *p) {
p->impl->Pop();
... ...
... ... @@ -570,6 +570,11 @@ SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorAcceptWaveform(
SHERPA_ONNX_API int32_t
SherpaOnnxVoiceActivityDetectorEmpty(SherpaOnnxVoiceActivityDetector *p);
// Return 1 if there is voice detected.
// Return 0 if voice is silent.
SHERPA_ONNX_API int32_t
SherpaOnnxVoiceActivityDetectorDetected(SherpaOnnxVoiceActivityDetector *p);
// Return the first speech segment.
// It throws if SherpaOnnxVoiceActivityDetectorEmpty() returns 1.
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
... ...
... ... @@ -548,7 +548,11 @@ class SherpaOnnxVoiceActivityDetectorWrapper {
}
func isEmpty() -> Bool {
return SherpaOnnxVoiceActivityDetectorEmpty(vad) == 1 ? true : false
return SherpaOnnxVoiceActivityDetectorEmpty(vad) == 1
}
func isDetected() -> Bool {
return SherpaOnnxVoiceActivityDetectorDetected(vad) == 1
}
func pop() {
... ...