Developer World
Spresense SDK Library v1.4.2-3df2e9d
audio_effector_api.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/audio/audio_effector_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_EFFECTOR_API_H
37 #define __SONY_APPS_INCLUDE_AUDIOUTIL_AUDIO_EFFECTOR_API_H
38 
44 /* API Documents creater with Doxgen */
45 
55 /****************************************************************************
56  * Included Files
57  ****************************************************************************/
58 
59 #include <stdint.h>
60 #include <stdbool.h>
61 
62 /****************************************************************************
63  * Pre-processor Definitions
64  ****************************************************************************/
65 
66 #define AS_FEATURE_EFFECTOR_ENABLE
67 
73 #define SUB_SETMPP_COMMON 0x00
74 
77 #define SUB_SETMPP_XLOUD 0x01
78 
86 #define LENGTH_STARTBB 3
87 
90 #define LENGTH_STOPBB 3
91 
96 #define CHECK_XLOUD_VOLUME_RANGE(vol) \
97  (bool)(((0 <= (vol)) && ((vol) <= 59)) ? true : false)
98 
99 /****************************************************************************
100  * Public Types
101  ****************************************************************************/
102 
103 /* enum for baseband */
104 
105 /* StartBB */
106 
109 typedef enum
110 {
116 
122 
127 
130 typedef enum
131 {
137 
143 
147 
153 } AsInputDevice;
154 
157 typedef enum
158 {
162  AS_SP_OUTPUT_DATA_NUM
164 
167 typedef enum
168 {
172 
176  AS_I2S_OUTPUT_DATA_NUM
178 
183 typedef enum
184 {
188 
193 
194 /* InitMFE */
195 
198 typedef enum
199 {
203 
207  AS_MFE_MODE_NUM
208 } AsMfeModeId;
209 
212 typedef enum
213 {
217 
221  AS_MFE_INC_ECHOCANCEL_NUM
223 
226 typedef enum
227 {
231 
237  AS_MFE_ENBL_ECHOCANCEL_NUM
239 
240 /* InitMPP */
241 
244 typedef enum
245 {
249  AS_MPP_MODE_NUM
250 } AsMppModeId;
251 
254 typedef enum
255 {
259 
263  AS_MPP_COEF_NUM
265 
268 typedef enum
269 {
273 
277 
281  AS_MPP_XLOUD_MODE_NUM
283 
286  typedef enum
287 {
291 
295  AS_MPP_EAX_NUM
297 
298 /* SetBaseBandStatus */
299 
302 typedef enum
303 {
307 
311  AS_SET_BBSTS_WITH_MFE_NUM
313 
316 typedef enum
317 {
321 
325  AS_SET_BBSTS_WITH_VCMD_NUM
327 
330 typedef enum
331 {
335 
341  AS_SET_BBSTS_WITH_MPP_NUM
343 
346 typedef struct
347 {
353  uint16_t input_fs;
354 
361 
368 
375 
382 
385  uint8_t reserved2;
386 
392  uint8_t mfe_mode;
393 
396  uint32_t config_table;
397 } InitMFEParam;
398 
401 typedef struct
402 {
408  uint8_t output_device;
409 
412  uint8_t reserved1;
413 
419  uint16_t input_device;
420 
428 
431  uint8_t reserved2;
432 
439 
445  uint8_t SP_output_data;
446 } StartBBParam;
447 
450 typedef struct
451 {
454  uint8_t stop_device;
455 
458  uint8_t reserved1;
459 
462  uint16_t reserved2;
463 
466  uint8_t reserved3;
467 
470  uint8_t reserved4;
471 
474  uint8_t reserved5;
475 
478  uint8_t reserved6;
479 } StopBBParam;
480 
483 typedef struct
484 {
487  uint8_t reserved1;
488 
494  uint8_t with_MPP;
495 
502 
508  uint8_t with_MFE;
509 
515  uint16_t input_device;
516 
519  uint8_t reserved2;
520 
526  uint8_t output_device;
527 
530  char dsp_path[AS_AUDIO_DSP_PATH_LEN];
531 
533 
536 typedef struct
537 {
540  uint8_t effector;
541 
544  uint8_t mng;
545 
548  uint8_t recognizer;
549 
552  uint8_t dsp;
554 
557 typedef struct
558 {
561  uint8_t mic_in;
562 
565  uint8_t i2s_in;
566 
569  uint8_t sphp_out;
570 
573  uint8_t i2s_out;
574 
577  uint8_t mfe_out;
579 
582 typedef struct
583 {
587 
592 
593 /****************************************************************************
594  * Public Data
595  ****************************************************************************/
596 
597 /****************************************************************************
598  * Inline Functions
599  ****************************************************************************/
600 
601 /****************************************************************************
602  * Public Function Prototypes
603  ****************************************************************************/
604 
615  AudioAttentionCb attcb);
616 
617 __attribute__((deprecated(
618  "\n \
619  \n Deprecated create API is used. \
620  \n Use \"AS_CreateEffector(AsCreateEffectorParam_t * \
621  \n AudioAttentionCb)\". \
622  \n \
623  \n")))
625 
632 bool AS_DeleteEffector(void);
633 
634 #endif /* __SONY_APPS_INCLUDE_AUDIOUTIL_AUDIO_EFFECTOR_API_H */
635 
Definition: audio_effector_api.h:450
AsEffectorPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_effector_api.h:590
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_effector_api.h:552
uint8_t mfe_out
[in] Memory pool id of mfe output data
Definition: audio_effector_api.h:577
I2S 2ch.
Definition: audio_effector_api.h:115
MIC0 and MIC3.
Definition: audio_effector_api.h:191
AsEffectorMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_effector_api.h:586
no MPP function
Definition: audio_effector_api.h:334
uint8_t reserved2
[in] reserved
Definition: audio_effector_api.h:385
Voice Speaking mode.
Definition: audio_effector_api.h:206
for Headphone
Definition: audio_effector_api.h:262
uint8_t enable_echocancel
[in] Select EchoCancel function,
Definition: audio_effector_api.h:374
uint8_t reserved1
[in] reserved
Definition: audio_effector_api.h:458
uint8_t output_device
[in] Select Output Device
Definition: audio_effector_api.h:526
AsMppXloudModeId
Definition: audio_effector_api.h:268
Voice Command active.
Definition: audio_effector_api.h:324
uint8_t reserved1
[in] reserved
Definition: audio_effector_api.h:412
SP/HP 2ch.
Definition: audio_effector_api.h:121
for Speaker
Definition: audio_effector_api.h:258
uint8_t with_MFE
[in] Select MFE function
Definition: audio_effector_api.h:508
uint8_t reserved6
[in] reserved
Definition: audio_effector_api.h:478
AsSetBBStsWithVoiceCommand
Definition: audio_effector_api.h:316
MFE output (MIC in)
Definition: audio_effector_api.h:171
uint8_t reserved3
[in] reserved
Definition: audio_effector_api.h:466
uint8_t reserved2
[in] reserved
Definition: audio_effector_api.h:431
Definition: audio_effector_api.h:557
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:721
uint8_t stop_device
[in] T.B.D.
Definition: audio_effector_api.h:454
uint8_t mic_channel_num
[in] Select MFE MIC numbers
Definition: audio_effector_api.h:367
AsMppModeId
Definition: audio_effector_api.h:244
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_effector_api.h:544
uint8_t I2S_output_data
[in] Select I2S output data
Definition: audio_effector_api.h:438
uint8_t include_echocancel
[in] Select EchoCancel configuration,
Definition: audio_effector_api.h:381
uint8_t recognizer
[in] Message queue id of voice recognizer
Definition: audio_effector_api.h:548
Analog Mic 4ch, I2S 2ch.
Definition: audio_effector_api.h:152
Speaking mode.
Definition: audio_effector_api.h:276
Definition: audio_effector_api.h:536
#define AS_AUDIO_DSP_PATH_LEN
Definition: audio_common_defs.h:604
uint16_t input_device
[in] Select Input Device
Definition: audio_effector_api.h:419
uint8_t ref_channel_num
[in] Select MFE SP numbers
Definition: audio_effector_api.h:360
AsSetBBStsWithMpp
Definition: audio_effector_api.h:330
uint8_t mfe_mode
[in] Select MFE mode
Definition: audio_effector_api.h:392
AsOutputDevice
Definition: audio_effector_api.h:109
uint16_t input_fs
[in] Select MFE sampling frequency
Definition: audio_effector_api.h:353
Incluce echochancel function.
Definition: audio_effector_api.h:220
uint8_t i2s_in
[in] Memory pool id of i2s input data
Definition: audio_effector_api.h:565
Definition: audio_effector_api.h:401
I2S 2ch, SP/HP 2ch.
Definition: audio_effector_api.h:125
AsSelectOutputMic
Definition: audio_effector_api.h:183
uint32_t config_table
[in] Configuration table address
Definition: audio_effector_api.h:396
uint8_t with_Voice_Command
[in] Select Voice Command function
Definition: audio_effector_api.h:501
bool AS_CreateEffector(FAR AsCreateEffectorParam_t *param, AudioAttentionCb attcb)
Activate sound effector feature.
Definition: audio_effector_api.h:483
AsMfeEnableEchoCancel
Definition: audio_effector_api.h:226
uint8_t mic_in
[in] Memory pool id of mic input data
Definition: audio_effector_api.h:561
Disable.
Definition: audio_effector_api.h:280
AsMppCoefModeId
Definition: audio_effector_api.h:254
Off.
Definition: audio_effector_api.h:290
MFE active.
Definition: audio_effector_api.h:310
AsMppEaxModeId
Definition: audio_effector_api.h:286
AsInputDevice
Definition: audio_effector_api.h:130
uint8_t reserved4
[in] reserved
Definition: audio_effector_api.h:470
uint8_t effector
[in] Message queue id of sound effector
Definition: audio_effector_api.h:540
uint16_t input_device
[in] Select Input Device
Definition: audio_effector_api.h:515
__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.
uint8_t reserved5
[in] reserved
Definition: audio_effector_api.h:474
Normal mode.
Definition: audio_effector_api.h:272
MIC through.
Definition: audio_effector_api.h:175
Analog Mic 1ch, I2S 2ch.
Definition: audio_effector_api.h:146
On.
Definition: audio_effector_api.h:294
uint8_t output_device
[in] Select Output Device
Definition: audio_effector_api.h:408
uint8_t reserved1
[in] reserved
Definition: audio_effector_api.h:487
I2S 2ch.
Definition: audio_effector_api.h:136
Analog Mic 1ch.
Definition: audio_effector_api.h:142
Voice Recognition mode (default)
Definition: audio_effector_api.h:202
no Voice Command function
Definition: audio_effector_api.h:320
AsSpOutputData
Definition: audio_effector_api.h:157
Not include echochancel function.
Definition: audio_effector_api.h:216
EchoCancel ON.
Definition: audio_effector_api.h:236
AsMfeIncludeEchoCancel
Definition: audio_effector_api.h:212
no MFE function
Definition: audio_effector_api.h:306
uint16_t reserved2
[in] reserved
Definition: audio_effector_api.h:462
AsSetBBStsWithMfe
Definition: audio_effector_api.h:302
bool AS_DeleteEffector(void)
Deactivate sound effector feature.
MPP active.
Definition: audio_effector_api.h:340
Definition: audio_effector_api.h:346
MPP output (I2S in)
Definition: audio_effector_api.h:161
uint8_t select_output_mic
[in] Select output MIC channels
Definition: audio_effector_api.h:427
uint8_t with_MPP
[in] Select MPP function
Definition: audio_effector_api.h:494
Definition: audio_effector_api.h:582
uint8_t sphp_out
[in] Memory pool id of speaker/headphone output data
Definition: audio_effector_api.h:569
xLOUD only
Definition: audio_effector_api.h:248
uint8_t i2s_out
[in] Memory pool id of i2s output data
Definition: audio_effector_api.h:573
AsI2sOutputData
Definition: audio_effector_api.h:167
uint8_t reserved2
[in] reserved
Definition: audio_effector_api.h:519
MIC1 and MIC2.
Definition: audio_effector_api.h:187
AsMfeModeId
Definition: audio_effector_api.h:198
EchoCancel OFF.
Definition: audio_effector_api.h:230
uint8_t SP_output_data
[in] Select SP/HP output data
Definition: audio_effector_api.h:445