Developer World
Spresense SDK Library v2.0.1-3834d32
audio_outputmix_api.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/audio/audio_outputmix_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 __MODULES_INCLUDE_AUDIO_AUDIO_OUTPUTMIX_API_H
37 #define __MODULES_INCLUDE_AUDIO_AUDIO_OUTPUTMIX_API_H
38 
53 /****************************************************************************
54  * Included Files
55  ****************************************************************************/
56 
58 
60 #include "memutils/message/MsgPacket.h"
61 
62 /****************************************************************************
63  * Pre-processor Definitions
64  ****************************************************************************/
65 
66 #define AS_FEATURE_OUTPUTMIX_ENABLE
67 
70 #define LENGTH_INIT_OUTPUTMIXER 4
71 
74 #define LENGTH_INITMPP 5
75 
78 #define LENGTH_SUB_SETMPP_COMMON 4
79 
82 #define LENGTH_SUB_SETMPP_XLOUD 4
83 
86 #define AS_POSTPROC_FILE_PATH_LEN (AS_AUDIO_DSP_PATH_LEN)
87 
88 #define PF_COMMAND_PACKET_SIZE_MAX (32)
89 
90 /****************************************************************************
91  * Public Types
92  ****************************************************************************/
94 {
98 
102 };
103 
105 {
109 
113 
117 
118  OutputMixDeviceNum
119 };
120 
123 {
126  MainOnly = 0,
127 
131 
135 
136  OutputMixerTypeNum
137 };
138 
142 {
146 
150 };
151 
154 {
158 
162 
166 
170 
174 
178 
179  OutputMixDoneCmdTypeNum
180 };
181 
184 typedef enum
185 {
189 
193 
198 
202 {
206 
210 
211  AsPostprocTypeInvalid = 0xff,
212 };
213 
216 typedef struct
217 {
220  uint8_t mixer;
221 
224  uint8_t mng;
225 
231  uint8_t render_path1_filter_dsp;
232 
234 
237 typedef struct
238 {
244  MemMgrLite::PoolId render_path1_filter_pcm;
245 
251  MemMgrLite::PoolId render_path1_filter_dsp;
252 
254 
255 typedef struct
256 {
262  uint8_t render_path1_filter_pcm;
263 
269  uint8_t render_path1_filter_dsp;
270 
272 
275 typedef struct
276 {
280 
284 
286 
287 typedef struct
288 {
292 
296 
298 
302 {
305  int handle;
306 
310 
313  bool result;
314 
317  uint32_t ecode;
318 };
319 
320 typedef void (*OutputMixerCallback)(MsgQueId requester_dtq, MsgType msgtype, AsOutputMixDoneParam *param);
321 typedef void (*OutputMixerErrorCallback)(uint8_t handle);
322 
323 typedef struct
324 {
330  uint8_t output_device;
331 
337  uint8_t mixer_type;
338 
344  uint8_t post_enable;
345 
348  OutputMixerCallback cb;
349 
352  OutputMixerErrorCallback error_cb;
353 
355 
358 typedef struct
359 {
362  uint8_t postproc_type;
363 
367 
369 
372 typedef struct
373 {
374  uint8_t reserve;
375 
377 
380 typedef struct
381 {
384  uint8_t handle;
385 
388  PcmProcDoneCallback callback;
389 
393 
395 
398 typedef struct
399 {
402  int8_t direction;
403 
406  uint32_t times;
407 
409 
412 typedef struct
413 {
416  uint8_t cmd_type;
417 
420  uint8_t *addr;
421 
424  uint32_t size;
425 
427 
429 
432 typedef struct
433 {
434  uint8_t handle;
435 
436  union
437  {
438  AsActivateOutputMixer act_param;
439  AsInitOutputMixer init_param;
440  AsDeactivateOutputMixer deact_param;
441  AsFrameTermFineControl fterm_param;
442  AsInitPostProc initpp_param;
443  AsSetPostProc setpp_param;
444  };
446 
447 /****************************************************************************
448  * Public Data
449  ****************************************************************************/
450 
451 /****************************************************************************
452  * Inline Functions
453  ****************************************************************************/
454 
455 /****************************************************************************
456  * Public Function Prototypes
457  ****************************************************************************/
458 
470  AudioAttentionCb attcb);
471 
473  AudioAttentionCb attcb);
474 
475 __attribute__((deprecated(
476  "\n \
477  \n Deprecated create API is used. \
478  \n Use \"AS_CreateOutputMixer(AsCreateOutputMixParam_t * \
479  \n AudioAttentionCb)\". \
480  \n \
481  \n")))
483 
485 
495 bool AS_ActivateOutputMixer(uint8_t handle, FAR AsActivateOutputMixer *actparam);
496 
506 bool AS_InitOutputMixer(uint8_t handle, FAR AsInitOutputMixer *initparam);
507 
517 bool AS_SendDataOutputMixer(FAR AsSendDataOutputMixer *sendparam);
518 
529 
539 bool AS_InitPostprocOutputMixer(uint8_t handle, FAR AsInitPostProc *initppparam);
540 
550 bool AS_SetPostprocOutputMixer(uint8_t handle, FAR AsSetPostProc *setppparam);
551 
561 bool AS_DeactivateOutputMixer(uint8_t handle, FAR AsDeactivateOutputMixer *deactparam);
562 
570 bool AS_DeleteOutputMix(void);
571 
580 
581 #endif /* __MODULES_INCLUDE_AUDIO_AUDIO_OUTPUTMIX_API_H */
582 
bool AS_FrameTermFineControlOutputMixer(uint8_t handle, FAR AsFrameTermFineControl *ftermparam)
Set clock recovery parameters.
OutputMixer No.1.
Definition: audio_outputmix_api.h:101
int8_t direction
[in] Recovery direction (advance or delay)
Definition: audio_outputmix_api.h:402
Definition: audio_common_defs.h:698
Definition: audio_outputmix_api.h:398
Definition: audio_outputmix_api.h:237
Definition: audio_outputmix_api.h:205
Speaker out.
Definition: audio_outputmix_api.h:108
Deactivation done.
Definition: audio_outputmix_api.h:165
AsOutputMixPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_outputmix_api.h:295
AsPcmDataParam pcm
[in] PCM data parameter
Definition: audio_outputmix_api.h:392
A2DP out.
Definition: audio_outputmix_api.h:116
Definition: audio_outputmix_api.h:323
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:806
Definition: audio_outputmix_api.h:209
Init Postproc command done.
Definition: audio_outputmix_api.h:173
Activation done.
Definition: audio_outputmix_api.h:157
bool AS_ActivateOutputMixer(uint8_t handle, FAR AsActivateOutputMixer *actparam)
Activate audio output mixer.
uint8_t render_path0_filter_dsp
[in] Memory pool id of dsp command data Effective only when use postfilter
Definition: audio_outputmix_api.h:268
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_outputmix_api.h:224
bool AS_SendDataOutputMixer(FAR AsSendDataOutputMixer *sendparam)
Send audio data via outputmixer.
AsClkRecoveryDirection
Definition: audio_outputmix_api.h:184
Main.
Definition: audio_outputmix_api.h:126
bool AS_CreateOutputMixer(FAR AsCreateOutputMixParam_t *param, AudioAttentionCb attcb)
Create audio output mixer.
uint8_t cmd_type
Definition: audio_outputmix_api.h:416
Memory Handler API.
Adjust to the - direction.
Definition: audio_outputmix_api.h:196
MemMgrLite::PoolId render_path0_filter_pcm
[in] Memory pool id of pcm data Effective only when use postfilter
Definition: audio_outputmix_api.h:243
uint8_t * addr
Definition: audio_outputmix_api.h:420
CXD5602 Audio Common Definitions.
I2S out.
Definition: audio_outputmix_api.h:112
#define AS_POSTPROC_FILE_PATH_LEN
Length of Recognizer dsp file name and path.
Definition: audio_outputmix_api.h:86
uint8_t mixer
[in] Message queue id of output mixer
Definition: audio_outputmix_api.h:220
bool AS_InitOutputMixer(uint8_t handle, FAR AsInitOutputMixer *initparam)
Init audio output mixer.
Definition: MemMgrTypes.h:88
Definition: audio_outputmix_api.h:149
__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.
Definition: audio_outputmix_api.h:216
AsOutputMixDoneCmdType done_type
Definition: audio_outputmix_api.h:309
AsOutputMixMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_outputmix_api.h:279
Set Postproc command done.
Definition: audio_outputmix_api.h:177
OutputMixer No.0.
Definition: audio_outputmix_api.h:97
Definition: audio_outputmix_api.h:372
Definition: audio_outputmix_api.h:301
int handle
Definition: audio_outputmix_api.h:305
Definition: audio_outputmix_api.h:432
AsOutputMixerType
Definition: audio_outputmix_api.h:122
bool AS_InitPostprocOutputMixer(uint8_t handle, FAR AsInitPostProc *initppparam)
Init Postproces DSP.
uint8_t post_enable
[in] Enable postfilter
Definition: audio_outputmix_api.h:344
Definition: audio_outputmix_api.h:275
bool AS_SetPostprocOutputMixer(uint8_t handle, FAR AsSetPostProc *setppparam)
Set parameters Postproces DSP.
uint8_t render_path0_filter_pcm
[in] Memory pool id of pcm data Effective only when use postfilter
Definition: audio_outputmix_api.h:261
Definition: audio_outputmix_api.h:255
uint8_t handle
[in] Handle of OutputMixer
Definition: audio_outputmix_api.h:384
Main & SoundEffet.
Definition: audio_outputmix_api.h:134
uint8_t mixer_type
[in] Mixer typ
Definition: audio_outputmix_api.h:337
Definition: audio_outputmix_api.h:145
uint8_t postproc_type
[in] Set postproc type. Use AsPostprocType enum type
Definition: audio_outputmix_api.h:362
uint32_t times
[in] Recovery term
Definition: audio_outputmix_api.h:406
uint8_t render_path0_filter_dsp
[in] Message queue id of dsp Effective only when use postfilter
Definition: audio_outputmix_api.h:230
bool result
Definition: audio_outputmix_api.h:313
AsOutputMixMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_outputmix_api.h:291
Adjust to the + direction.
Definition: audio_outputmix_api.h:188
Init done.
Definition: audio_outputmix_api.h:161
uint32_t size
Definition: audio_outputmix_api.h:424
AsOutputMixDevice
Definition: audio_outputmix_api.h:104
AsOutputMixerHandle
Definition: audio_outputmix_api.h:93
bool AS_DeactivateOutputMixer(uint8_t handle, FAR AsDeactivateOutputMixer *deactparam)
Deactivate audio output mixer.
Set Clock recovery done.
Definition: audio_outputmix_api.h:169
bool AS_DeleteOutputMix(void)
Delete output mixer.
No adjust.
Definition: audio_outputmix_api.h:192
AsPostprocType
Definition: audio_outputmix_api.h:201
AsOutputMixPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_outputmix_api.h:283
MemMgrLite::PoolId render_path0_filter_dsp
[in] Memory pool id of dsp command data Effective only when use postfilter
Definition: audio_outputmix_api.h:250
Definition: audio_outputmix_api.h:412
SoundEffet.
Definition: audio_outputmix_api.h:130
bool AS_checkAvailabilityOutputMixer(void)
Check availability of OutputMixer.
uint8_t output_device
[in] Output device type
Definition: audio_outputmix_api.h:330
Definition: audio_outputmix_api.h:380
AsOutputMixDoneCmdType
Definition: audio_outputmix_api.h:153
uint32_t ecode
Definition: audio_outputmix_api.h:317
Definition: audio_outputmix_api.h:287
Definition: audio_outputmix_api.h:358
AsOutputMixerPostFilter
Definition: audio_outputmix_api.h:141