public class HotwordDetect
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
RESOURCE_CONTORL_MODE_AUTO_RELEASE |
static int |
RESOURCE_CONTROL_MODE_ALWAYS_ON |
Modifier and Type | Method and Description |
---|---|
static HotwordDetect |
create(android.media.AudioRecord audioRecord,
android.content.Context context,
IHotwordDetectListener listener)
Create a HotwordDetect instance by a specified AudioRecord object reference.
|
static HotwordDetect |
create(android.content.Context context,
IHotwordDetectListener listener)
Create a HotwordDetect instance.
|
android.media.AudioRecord |
getAudioRecord()
Get current or the given AudioRecord object reference
|
void |
release()
Release resources.
|
void |
setAudioRecord(android.media.AudioRecord audioRecord)
Set or change a specified AudioRecord object reference.
|
void |
setResourceControlMode(int mode)
Set the resource contorl mode for the AudioRecord resource handling.
|
void |
startDetection()
Start hotword detection.
|
void |
stopDetection()
Stop hotword detection.
|
public static final int RESOURCE_CONTROL_MODE_ALWAYS_ON
public static final int RESOURCE_CONTORL_MODE_AUTO_RELEASE
public static HotwordDetect create(android.content.Context context, IHotwordDetectListener listener) throws java.lang.Exception
context
- - Android Context.listener
- - The specified callback listener.java.lang.Exception
public static HotwordDetect create(android.media.AudioRecord audioRecord, android.content.Context context, IHotwordDetectListener listener) throws java.io.IOException
audioRecord
- - Reference of the specified AudioRecord.context
- - Android Context.listener
- - The specified callback listener.java.io.IOException
public void setAudioRecord(android.media.AudioRecord audioRecord)
audioRecord
- - Reference of the specified AudioRecord.public android.media.AudioRecord getAudioRecord()
public void startDetection() throws java.lang.Exception
java.lang.Exception
- There is something wrong.public void stopDetection()
public void setResourceControlMode(int mode)
mode
- - RESOURCE_CONTROL_MODE_ALWAYS_ON for manual release.
RESOURCE_CONTORL_MODE_AUTO_RELEASE for release automatically.public void release()