Expose VAD isDetected api to Swift (#356)
This commit is contained in:
@@ -488,6 +488,11 @@ int32_t SherpaOnnxVoiceActivityDetectorEmpty(
|
|||||||
return p->impl->Empty();
|
return p->impl->Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t SherpaOnnxVoiceActivityDetectorDetected(
|
||||||
|
SherpaOnnxVoiceActivityDetector *p) {
|
||||||
|
return p->impl->IsSpeechDetected();
|
||||||
|
}
|
||||||
|
|
||||||
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
|
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
|
||||||
SherpaOnnxVoiceActivityDetector *p) {
|
SherpaOnnxVoiceActivityDetector *p) {
|
||||||
p->impl->Pop();
|
p->impl->Pop();
|
||||||
|
|||||||
@@ -570,6 +570,11 @@ SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorAcceptWaveform(
|
|||||||
SHERPA_ONNX_API int32_t
|
SHERPA_ONNX_API int32_t
|
||||||
SherpaOnnxVoiceActivityDetectorEmpty(SherpaOnnxVoiceActivityDetector *p);
|
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.
|
// Return the first speech segment.
|
||||||
// It throws if SherpaOnnxVoiceActivityDetectorEmpty() returns 1.
|
// It throws if SherpaOnnxVoiceActivityDetectorEmpty() returns 1.
|
||||||
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
|
SHERPA_ONNX_API void SherpaOnnxVoiceActivityDetectorPop(
|
||||||
|
|||||||
@@ -548,7 +548,11 @@ class SherpaOnnxVoiceActivityDetectorWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isEmpty() -> Bool {
|
func isEmpty() -> Bool {
|
||||||
return SherpaOnnxVoiceActivityDetectorEmpty(vad) == 1 ? true : false
|
return SherpaOnnxVoiceActivityDetectorEmpty(vad) == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func isDetected() -> Bool {
|
||||||
|
return SherpaOnnxVoiceActivityDetectorDetected(vad) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func pop() {
|
func pop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user