1 /*
2  * Copyright (C) 2019 The Android Open Source Project
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 package android.media.soundtrigger_middleware;
17 
18 import android.media.audio.common.AudioConfig;
19 import android.media.soundtrigger_middleware.RecognitionStatus;
20 import android.media.soundtrigger_middleware.SoundModelType;
21 
22 /**
23  * An event that gets sent to indicate a recognition (or aborting of the recognition process).
24  * {@hide}
25  */
26 parcelable RecognitionEvent {
27     /** Recognition status. */
28     RecognitionStatus status;
29     /** Event type, same as sound model type. */
30     SoundModelType type;
31     /** Is it possible to capture audio from this utterance buffered by the implementation. */
32     boolean captureAvailable;
33     /* Audio session ID. framework use. */
34     int captureSession;
35     /**
36      * Delay in ms between end of model detection and start of audio available for capture.
37      * A negative value is possible (e.g. if key phrase is also available for Capture.
38      */
39     int captureDelayMs;
40     /** Duration in ms of audio captured before the start of the trigger. 0 if none. */
41     int capturePreambleMs;
42     /** If true, the 'data' field below contains the capture of the trigger sound. */
43     boolean triggerInData;
44     /**
45      * Audio format of either the trigger in event data or to use for capture of the rest of the
46      * utterance. May be null when no audio is available for this event type.
47      */
48     @nullable AudioConfig audioConfig;
49     /** Additional data. */
50     byte[] data;
51 }
52