UniMRCP  1.7.0
mpf_activity_detector.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MPF_ACTIVITY_DETECTOR_H
18 #define MPF_ACTIVITY_DETECTOR_H
19 
20 /**
21  * @file mpf_activity_detector.h
22  * @brief MPF Voice Activity Detector
23  */
24 
25 #include "mpf_frame.h"
26 #include "mpf_codec_descriptor.h"
27 
29 
30 /** Opaque (voice) activity detector */
32 
33 /** Events of activity detector */
34 typedef enum {
35  MPF_DETECTOR_EVENT_NONE, /**< no event occurred */
36  MPF_DETECTOR_EVENT_ACTIVITY, /**< voice activity (transition to activity from inactivity state) */
37  MPF_DETECTOR_EVENT_INACTIVITY, /**< voice inactivity (transition to inactivity from activity state) */
38  MPF_DETECTOR_EVENT_NOINPUT /**< noinput event occurred */
40 
41 
42 /** Create activity detector */
44 
45 /** Reset activity detector */
47 
48 /** Set threshold of voice activity (silence) level */
49 MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold);
50 
51 /** Set noinput timeout */
52 MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout);
53 
54 /** Set timeout required to trigger speech (transition from inactive to active state) */
55 MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout);
56 
57 /** Set timeout required to trigger silence (transition from active to inactive state) */
58 MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout);
59 
60 /** Process current frame, return detected event if any */
62 
63 
65 
66 #endif /* MPF_ACTIVITY_DETECTOR_H */
mpf_detector_event_e
Definition: mpf_activity_detector.h:34
void mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout)
mpf_activity_detector_t * mpf_activity_detector_create(apr_pool_t *pool)
#define APT_END_EXTERN_C
Definition: apt.h:38
void mpf_activity_detector_reset(mpf_activity_detector_t *detector)
Definition: mpf_frame.h:50
typedefAPT_BEGIN_EXTERN_C struct mpf_activity_detector_t mpf_activity_detector_t
Definition: mpf_activity_detector.h:31
#define MPF_DECLARE(type)
Definition: mpf.h:40
Definition: mpf_activity_detector.h:35
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
void mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout)
Definition: mpf_activity_detector.h:36
MPF Audio/Video/Named-event Frame.
void mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout)
Definition: mpf_activity_detector.h:38
MPF Codec Descriptor.
void mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold)
Definition: mpf_activity_detector.h:37
mpf_detector_event_e mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame)