sipxmedialib  Version 3.3
MpVadSimple.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2008 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // $$
10 
11 // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>
12 
13 #ifndef _MpVadSimple_h_
14 #define _MpVadSimple_h_
15 
16 #include <mp/MpVadBase.h>
17 
24 class MpVadSimple : public MpVadBase
25 {
26 /* //////////////////////////// PUBLIC //////////////////////////////////// */
27 public:
28  static const char *name;
29 
30 /* ============================ CREATORS ================================== */
32 
33 
35  MpVadSimple();
36 
38  OsStatus init(int samplesPerSec);
39 
41  ~MpVadSimple();
42 
44 
45 /* ============================ MANIPULATORS ============================== */
47 
48 
50  MpSpeechType processFrame(uint32_t packetTimeStamp,
51  const MpAudioSample* pBuf,
52  unsigned inSamplesNum,
53  const MpSpeechParams &speechParams,
54  UtlBoolean calcEnergyOnly = FALSE);
55 
57  OsStatus setParam(const char* paramName, void* value);
58 
60  void setMinimumEnergy(int minEnergy);
61 
63  void reset();
64 
66 
67 /* ============================ ACCESSORS ================================= */
69 
70  int getEnergy() const;
72 
74 
75 /* ============================ INQUIRY =================================== */
77 
78 
80 
81 /* //////////////////////////// PROTECTED ///////////////////////////////// */
82 protected:
83 
84 /* //////////////////////////// PRIVATE /////////////////////////////////// */
85 private:
89 
91 };
92 
93 #endif // _MpVadSimple_h_
int mLastFrameSize
Definition: MpVadSimple.h:86
Definition: MpVadBase.h:40
Definition: MpTypes.h:74
int mSamplesPerSecond
Definition: MpVadSimple.h:88
~MpVadSimple()
Destructor.
Definition: MpVadSimple.cpp:56
OsStatus setParam(const char *paramName, void *value)
Set algorithm parameter.
Definition: MpVadSimple.cpp:106
OsStatus init(int samplesPerSec)
Initialize VAD with given sample rate.
Definition: MpVadSimple.cpp:45
int mLastEnergy
Definition: MpVadSimple.h:87
int16_t MpAudioSample
Definition: MpTypes.h:44
MpSpeechType
Type of audio data.
Definition: MpTypes.h:65
void setMinimumEnergy(int minEnergy)
Set threshold energy.
Definition: MpVadSimple.cpp:63
Definition: MpVadSimple.h:24
int getEnergy() const
Return weighted energy of current frame.
Definition: MpVadSimple.cpp:68
int mMinEnergy
Definition: MpVadSimple.h:90
MpVadSimple()
Constructor.
Definition: MpVadSimple.cpp:37
MpSpeechType processFrame(uint32_t packetTimeStamp, const MpAudioSample *pBuf, unsigned inSamplesNum, const MpSpeechParams &speechParams, UtlBoolean calcEnergyOnly=FALSE)
Detect speech presence.
Definition: MpVadSimple.cpp:76
static const char * name
Name of this VAD algorithm for use in MpVadBase::createVad().
Definition: MpVadSimple.h:28
#define FALSE
Definition: PlgDefsV1.h:37
void reset()
Prepare to process other unrelated audio stream.
Definition: MpVadSimple.cpp:116