Developer World
Spresense SDK Library v1.4.2-3df2e9d
audio_recognizer_api.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/audio/audio_recognizer_api.h
3  *
4  * Copyright 2018 Sony Semiconductor Solutions Corporation
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * 3. Neither the name of Sony Semiconductor Solutions Corporation nor
17  * the names of its contributors may be used to endorse or promote
18  * products derived from this software without specific prior written
19  * permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************/
35 
36 #ifndef __SONY_APPS_INCLUDE_AUDIOUTIL_AUDIO_RECOGNIZER_API_H
37 #define __SONY_APPS_INCLUDE_AUDIOUTIL_AUDIO_RECOGNIZER_API_H
38 
53 /****************************************************************************
54  * Included Files
55  ****************************************************************************/
56 
57 #include <stdint.h>
58 #include <stdbool.h>
59 
60 /****************************************************************************
61  * Pre-processor Definitions
62  ****************************************************************************/
63 
64 #define AS_FEATURE_RECOGNIZER_ENABLE
65 
71 #define LENGTH_INIT_RECOGNIZER 3
72 
75 #define LENGTH_START_RECOGNIZER 2
76 
79 #define LENGTH_STOP_RECOGNIZER 2
80 
83 #define LENGTH_INIT_RECOGNIZER_DSP 4
84 
87 #define LENGTH_SET_RECOGNIZER_DSP 4
88 
93 #define AS_RECOGNIZER_FILE_PATH_LEN (AS_AUDIO_DSP_PATH_LEN)
94 
95 /****************************************************************************
96  * Public Types
97  ****************************************************************************/
100 typedef enum
101 {
105 
109 
113 
117 
121 
125 
129 
133 
135 
136 typedef enum
137 {
141 
145 
147 
148 typedef enum
149 {
153 
157 
159 
162 typedef struct
163 {
164  uint32_t result_code;
165 
166  uint32_t command_id;
167 
168  AsRecognizerEvent event;
169 
171 
174 typedef struct
175 {
176  RecognizerResultHeader header;
177 
179 
182 typedef void (*RecognizerCallback)(RecognizerResult *result);
183 
184 typedef struct
185 {
189 
191 
195 
197 {
201 
202  struct __st_tunnel
203  {
204  uint8_t msgqid;
205  uint32_t msgtype;
206  } msg;
207 };
208 
209 typedef struct
210 {
216  uint8_t type;
217 
222 
228  uint8_t notify_path;
229 
230  AsNotifyDest dest;
231 
233 
236 typedef struct
237 {
238  uint32_t reserve;
239 
241 
244 typedef struct
245 {
246  uint32_t reserve;
247 
249 
252 typedef struct
253 {
254  uint32_t reserve;
255 
257 
260 typedef struct
261 {
264  uint8_t *packet_addr;
265 
268  uint32_t packet_size;
269 
271 
274 typedef struct
275 {
278  uint32_t command_id;
279 
281 
282 typedef struct
283 {
284  /* Command Header */
285 
287 
288  /* Command Parameters */
289 
290  union
291  {
292  /* Activate Paramters */
293 
294  AsActivateRecognizerParam act_param;
295 
296  /* Init Paramters */
297 
298  AsInitRecognizerParam init_param;
299 
300  /* Start Paramters */
301 
302  AsStartRecognizerParam start_param;
303 
304  /* Stop Paramters */
305 
306  AsStopRecognizerParam stop_param;
307 
308  /* Init Rcgproc Paramters */
309 
310  AsInitRecognizerProcParam initrcgproc_param;
311 
312  /* Set Rcgproc Paramters */
313 
314  AsSetRecognizerProcParam setrcgproc_param;
315 
316  /* Deactivate Paramters */
317 
318  AsDeactivateRecognizerParam deact_param;
319  };
320 
322 
325 typedef struct
326 {
329  uint8_t recognizer;
330 
333  uint8_t mng;
334 
337  uint8_t dsp;
338 
340 
343 typedef struct
344 {
348 
352 
354 
357 typedef struct
358 {
362 
366 
368 
369 /****************************************************************************
370  * Public Data
371  ****************************************************************************/
372 
373 /****************************************************************************
374  * Inline Functions
375  ****************************************************************************/
376 
377 /****************************************************************************
378  * Public Function Prototypes
379  ****************************************************************************/
380 
392  AudioAttentionCb attcb);
393 
394 __attribute__((deprecated(
395  "\n \
396  \n Deprecated create API is used. \
397  \n Use \"AS_CreateRecognizer(AsCreateRecognizerParam_t * \
398  \n AudioAttentionCb)\". \
399  \n \
400  \n")))
402 
410 bool AS_DeleteRecognizer(void);
411 
420 
421 #endif /* AUDIO_RECOGNIZER_API_H */
422 
void(* RecognizerCallback)(RecognizerResult *result)
Definition: audio_recognizer_api.h:182
Set RecognizerProc.
Definition: audio_recognizer_api.h:132
Definition: audio_recognizer_api.h:209
Init RecognizerProc.
Definition: audio_recognizer_api.h:128
uint8_t notify_path
[in] Select Data path from MicFrontend
Definition: audio_recognizer_api.h:228
uint8_t * packet_addr
[in] Command packet address
Definition: audio_recognizer_api.h:264
uint32_t command_id
[in] Command ID
Definition: audio_recognizer_api.h:278
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_recognizer_api.h:333
Definition: audio_recognizer_api.h:325
Definition: audio_recognizer_api.h:260
uint8_t type
[in] Set recognizer type
Definition: audio_recognizer_api.h:216
#define AS_RECOGNIZER_FILE_PATH_LEN
Length of Recognizer dsp file name and path.
Definition: audio_recognizer_api.h:93
bool AS_checkAvailabilityRecognizer(void)
Check availability of Recognizer.
Activate.
Definition: audio_recognizer_api.h:104
Definition: audio_recognizer_api.h:184
uint8_t recognizer
[in] Message queue id of voice recognizer
Definition: audio_recognizer_api.h:329
AsRecognizerType
Definition: audio_recognizer_api.h:136
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:721
AsRecognizerNotifyPath
Definition: audio_recognizer_api.h:148
Definition: audio_recognizer_api.h:343
Definition: audio_recognizer_api.h:244
bool AS_DeleteRecognizer(void)
Deactivate voice recognizer.
Recognition result is notify by callback.
Definition: audio_recognizer_api.h:152
Definition: audio_recognizer_api.h:202
RecognizerNotifyCallback cb
[in] Recognition result notify callback
Definition: audio_recognizer_api.h:200
MemMgrLite::PoolId out
[in] Memory pool id of wuwsr input data
Definition: audio_recognizer_api.h:347
Init.
Definition: audio_recognizer_api.h:112
Definition: audio_recognizer_api.h:282
Definition: MemMgrTypes.h:88
Recognition result is notify by message.
Definition: audio_recognizer_api.h:156
__attribute__((deprecated("\eprecated attention callback type is used. \ \lease use \udioAttentionCb\as callback type. \ \))) int AS_CreateAudioManager(AudioSubSystemIDs ids
Activate AudioSubSystem[Deprecated] This API is to make it compatible with old application. Will delete most application seems to migrate to new API.
Start.
Definition: audio_recognizer_api.h:116
Exec.
Definition: audio_recognizer_api.h:120
bool AS_CreateRecognizer(FAR AsCreateRecognizerParam_t *param, AudioAttentionCb attcb)
Activate voice recognizer.
AsRecognizerEvent
Definition: audio_recognizer_api.h:100
Definition: audio_recognizer_api.h:174
uint32_t packet_size
[in] Command packet size
Definition: audio_recognizer_api.h:268
Definition: audio_recognizer_api.h:274
MemMgrLite::PoolId dsp
[in] Message queue id of DSP
Definition: audio_recognizer_api.h:351
AsRecognizerMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recognizer_api.h:361
Definition: audio_recognizer_api.h:236
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_recognizer_api.h:337
Invalid type.
Definition: audio_recognizer_api.h:144
Definition: audio_common_defs.h:649
Stop.
Definition: audio_recognizer_api.h:124
Definition: audio_recognizer_api.h:252
Definition: audio_recognizer_api.h:357
Definition: audio_recognizer_api.h:196
Recognizer type is UserCustom.
Definition: audio_recognizer_api.h:140
void(* RecognizerNotifyCallback)(AsRecognitionInfo info)
Definition: audio_recognizer_api.h:194
RecognizerCallback cb
[in] Event callback
Definition: audio_recognizer_api.h:188
AsRecognizerPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recognizer_api.h:365
Deactivate.
Definition: audio_recognizer_api.h:108
Definition: audio_recognizer_api.h:162