Package: android.hardware.soundtrigger@2.1

ISoundTriggerHw

interface ISoundTriggerHw extends @2.0::ISoundTriggerHw

SoundTrigger HAL interface.Used for hardware recognition of hotwords.

Properties

SoundModel

struct SoundModel {@ header; memory data}

Base sound model descriptor.This struct is the header of a larger block passed to loadSoundModel_2_1() and contains the binary data of the sound model.

Details
Members
header
Sound model header.Any data contained in the 'header.data' field is ignored
data
Opaque data transparent to Android framework

PhraseSoundModel

struct PhraseSoundModel {SoundModel common; vec phrases}

Specialized sound model for key phrase detection.Proprietary representation of key phrases in binary data must match information indicated by phrases field.

Details
Members
common
Common part of sound model descriptor
phrases
List of descriptors for key phrases supported by this sound model

RecognitionConfig

struct RecognitionConfig {@ header; memory data}

Configuration for sound trigger capture session passed to startRecognition_2_1() method.

Details
Members
header
Configuration header.Any data contained in the 'header.data' field is ignored
data
Opaque capture configuration data transparent to the framework

Methods

loadSoundModel_2_1

loadSoundModel_2_1 (SoundModel soundModel, ISoundTriggerHwCallback callback, CallbackCookie cookie)
generates (int32_t retval, SoundModelHandle modelHandle)

Load a sound model.Once loaded, recognition of this model can be started and stopped.Only one active recognition per model at a time.The SoundTrigger service must handle concurrent recognition requests by different users/applications on the same model.The implementation returns a unique handle used by other functions(unloadSoundModel(), startRecognition*(), etc...

Must have the exact same semantics as loadSoundModel from ISoundTriggerHw@2.0 except that the SoundModel uses shared memory instead of data.

Details
Parameters
soundModel
A SoundModel structure describing the sound model to load.
callback
The callback interface on which the soundmodelCallback*() method must be called upon completion.
cookie
The value of the cookie argument passed to the completion callback.This unique context information is assigned and used only by the framework.
Generates
retval
Operation completion status:0 in case of success, -EINVAL in case of invalid sound model(e.g 0 data size), -ENOSYS in case of invalid operation(e.g max number of models exceeded), -ENOMEM in case of memory allocation failure, -ENODEV in case of initialization error.
modelHandle
A unique handle assigned by the HAL for use by the framework when controlling activity for this sound model.
Annotations
callflow
next= { "startRecognition_2_1" , "unloadSoundModel" }

loadPhraseSoundModel_2_1

loadPhraseSoundModel_2_1 (PhraseSoundModel soundModel, ISoundTriggerHwCallback callback, CallbackCookie cookie)
generates (int32_t retval, SoundModelHandle modelHandle)

Load a key phrase sound model.Once loaded, recognition of this model can be started and stopped.Only one active recognition per model at a time.The SoundTrigger service must handle concurrent recognition requests by different users/applications on the same model.The implementation returns a unique handle used by other functions(unloadSoundModel(), startRecognition*(), etc...

Must have the exact same semantics as loadPhraseSoundModel from ISoundTriggerHw@2.0 except that the PhraseSoundModel uses shared memory instead of data.

Details
Parameters
soundModel
A PhraseSoundModel structure describing the sound model to load.
callback
The callback interface on which the soundmodelCallback*() method must be called upon completion.
cookie
The value of the cookie argument passed to the completion callback.This unique context information is assigned and used only by the framework.
Generates
retval
Operation completion status:0 in case of success, -EINVAL in case of invalid sound model(e.g 0 data size), -ENOSYS in case of invalid operation(e.g max number of models exceeded), -ENOMEM in case of memory allocation failure, -ENODEV in case of initialization error.
modelHandle
A unique handle assigned by the HAL for use by the framework when controlling activity for this sound model.
Annotations
callflow
next= { "startRecognition_2_1" , "unloadSoundModel" }

startRecognition_2_1

startRecognition_2_1 (SoundModelHandle modelHandle, RecognitionConfig config, ISoundTriggerHwCallback callback, CallbackCookie cookie)
generates (int32_t retval)

Start recognition on a given model.Only one recognition active at a time per model.Once recognition succeeds of fails, the callback is called.

Must have the exact same semantics as startRecognition from ISoundTriggerHw@2.0 except that the RecognitionConfig uses shared memory instead of data.

Details
Parameters
modelHandle
the handle of the sound model to use for recognition
config
A RecognitionConfig structure containing attributes of the recognition to perform
callback
The callback interface on which the recognitionCallback() method must be called upon recognition.
cookie
The value of the cookie argument passed to the recognition callback.This unique context information is assigned and used only by the framework.
Generates
retval
Operation completion status:0 in case of success, -EINVAL in case of invalid recognition attributes, -ENOSYS in case of invalid model handle, -ENOMEM in case of memory allocation failure, -ENODEV in case of initialization error.
Annotations
callflow
next= { "stopRecognition" , "stopAllRecognitions" }