Developer World
Spresense SDK Library v3.2.0-ebc0364
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 ****************************************************************************/
100typedef enum
101{
105
109
113
117
121
125
129
133
135
136typedef enum
137{
141
145
147
148typedef enum
149{
153
157
159
162typedef struct
163{
164 uint32_t result_code;
165
166 uint32_t command_id;
167
168 AsRecognizerEvent event;
169
171
174typedef struct
175{
177
179
182typedef void (*RecognizerCallback)(RecognizerResult *result);
183
184typedef struct
185{
189
191
195
197{
201
203 {
204 uint8_t msgqid;
205 uint32_t msgtype;
206 } msg;
207};
208
209typedef struct
210{
216 uint8_t type;
217
222
228 uint8_t notify_path;
229
230 AsNotifyDest dest;
231
233
236typedef struct
237{
238 uint32_t reserve;
239
241
244typedef struct
245{
246 uint32_t reserve;
247
249
252typedef struct
253{
254 uint32_t reserve;
255
257
260typedef struct
261{
264 uint8_t *packet_addr;
265
268 uint32_t packet_size;
269
271
274typedef struct
275{
278 uint32_t command_id;
279
281
282typedef struct
283{
284 /* Command Header */
285
287
288 /* Command Parameters */
289
290 union
291 {
292 /* Activate Paramters */
293
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
325typedef struct
326{
329 uint8_t recognizer;
330
333 uint8_t mng;
334
337 uint8_t dsp;
338
340
343typedef struct
344{
348
352
354
357typedef 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
411
420
421#endif /* AUDIO_RECOGNIZER_API_H */
__attribute__((deprecated("\nDeprecated attention callback type is used. \ \nPlease use \"AudioAttentionCb\" as callback type. \ \n"))) int AS_CreateAudioManager(AudioSubSystemIDs ids
Activate AudioSubSystem[Deprecated] This API is to make it compatible with old application....
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:810
bool AS_CreateRecognizer(FAR AsCreateRecognizerParam_t *param, AudioAttentionCb attcb)
Activate voice recognizer.
void(* RecognizerNotifyCallback)(AsRecognitionInfo info)
Definition: audio_recognizer_api.h:194
bool AS_checkAvailabilityRecognizer(void)
Check availability of Recognizer.
bool AS_DeleteRecognizer(void)
Deactivate voice recognizer.
AsRecognizerNotifyPath
Definition: audio_recognizer_api.h:149
AsRecognizerType
Definition: audio_recognizer_api.h:137
void(* RecognizerCallback)(RecognizerResult *result)
Definition: audio_recognizer_api.h:182
AsRecognizerEvent
Definition: audio_recognizer_api.h:101
#define AS_RECOGNIZER_FILE_PATH_LEN
Length of Recognizer dsp file name and path.
Definition: audio_recognizer_api.h:93
@ AsNotifyPathMessage
Recognition result is notify by message.
Definition: audio_recognizer_api.h:156
@ AsNotifyPathCallback
Recognition result is notify by callback.
Definition: audio_recognizer_api.h:152
@ AsRecognizerTypeInvalid
Invalid type.
Definition: audio_recognizer_api.h:144
@ AsRecognizerTypeUserCustom
Recognizer type is UserCustom.
Definition: audio_recognizer_api.h:140
@ AsRecognizerEventExec
Exec.
Definition: audio_recognizer_api.h:120
@ AsRecognizerEventInitRecognizerProc
Init RecognizerProc.
Definition: audio_recognizer_api.h:128
@ AsRecognizerEventAct
Activate.
Definition: audio_recognizer_api.h:104
@ AsRecognizerEventDeact
Deactivate.
Definition: audio_recognizer_api.h:108
@ AsRecognizerEventStop
Stop.
Definition: audio_recognizer_api.h:124
@ AsRecognizerEventInit
Init.
Definition: audio_recognizer_api.h:112
@ AsRecognizerEventSetRecognizerProc
Set RecognizerProc.
Definition: audio_recognizer_api.h:132
@ AsRecognizerEventStart
Start.
Definition: audio_recognizer_api.h:116
Definition: audio_recognizer_api.h:185
RecognizerCallback cb
[in] Event callback
Definition: audio_recognizer_api.h:188
Definition: audio_recognizer_api.h:358
AsRecognizerMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recognizer_api.h:361
AsRecognizerPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recognizer_api.h:365
Definition: audio_recognizer_api.h:253
Definition: audio_recognizer_api.h:210
uint8_t type
[in] Set recognizer type
Definition: audio_recognizer_api.h:216
uint8_t notify_path
[in] Select Data path from MicFrontend
Definition: audio_recognizer_api.h:228
Definition: audio_recognizer_api.h:261
uint32_t packet_size
[in] Command packet size
Definition: audio_recognizer_api.h:268
uint8_t * packet_addr
[in] Command packet address
Definition: audio_recognizer_api.h:264
Definition: audio_recognizer_api.h:203
Definition: audio_common_defs.h:739
Definition: audio_recognizer_api.h:326
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_recognizer_api.h:333
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_recognizer_api.h:337
uint8_t recognizer
[in] Message queue id of sound recognizer
Definition: audio_recognizer_api.h:329
Definition: audio_recognizer_api.h:344
MemMgrLite::PoolId dsp
[in] Memory pool id of DSP communication Message
Definition: audio_recognizer_api.h:351
MemMgrLite::PoolId out
[in] Memory pool id of recognition result data
Definition: audio_recognizer_api.h:347
Definition: audio_recognizer_api.h:237
Definition: audio_recognizer_api.h:245
Definition: MemMgrTypes.h:88
Definition: audio_recognizer_api.h:275
uint32_t command_id
[in] Command ID
Definition: audio_recognizer_api.h:278
Definition: audio_recognizer_api.h:283
Definition: audio_recognizer_api.h:163
Definition: audio_recognizer_api.h:175
Definition: audio_recognizer_api.h:197
RecognizerNotifyCallback cb
[in] Recognition result notify callback
Definition: audio_recognizer_api.h:200