-
Notifications
You must be signed in to change notification settings - Fork 18
/
VoiceActiveCheck.h
46 lines (38 loc) · 1015 Bytes
/
VoiceActiveCheck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// VoiceActiveCheck.hpp
// VADTEST
//
// Created by zhangyu on 2017/10/11.
// Copyright © 2017年 Michong. All rights reserved.
//
#ifndef VoiceActiveCheck_hpp
#define VoiceActiveCheck_hpp
#include <stdio.h>
#include <memory>
#include <stdlib.h>
namespace webrtc {
class VoiceActiveCheck {
public:
VoiceActiveCheck(int sample_rate_hz);
~VoiceActiveCheck();
bool isActiveVoice(int16_t *buf);
enum Likelihood {
kLowestLikelihood,
kVeryLowLikelihood,
kLowLikelihood,
kModerateLikelihood,
kHighLikelihood
};
void set_likelihood(Likelihood likelihood);
Likelihood likelihood();
void reset();
private:
class Vad;
int frame_size_ms_ = 10;
size_t frame_size_samples_ = 0;
int sample_rate_hz_ = 0;
Vad *vad_ = nullptr;
Likelihood likelihood_ = kLowestLikelihood;
};
}
#endif /* VoiceActiveCheck_hpp */