Developer World
Spresense SDK Library v1.4.0-aa7f53a
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_INITMPP 5
71 
74 #define LENGTH_SUB_SETMPP_COMMON 4
75 
78 #define LENGTH_SUB_SETMPP_XLOUD 4
79 
80 #define PF_COMMAND_PACKET_SIZE_MAX (32)
81 
82 /****************************************************************************
83  * Public Types
84  ****************************************************************************/
86 {
90 
94 };
95 
97 {
101 
105 
109 
110  OutputMixDeviceNum
111 };
112 
115 {
118  MainOnly = 0,
119 
123 
127 
128  OutputMixerTypeNum
129 };
130 
134 {
138 
142 };
143 
146 {
150 
154 
158 
162 
166 
167  OutputMixDoneCmdTypeNum
168 };
169 
172 typedef struct
173 {
176  uint8_t mixer;
177 
180  uint8_t mng;
181 
187  uint8_t render_path1_filter_dsp;
188 
190 
193 typedef struct
194 {
200  MemMgrLite::PoolId render_path1_filter_pcm;
201 
207  MemMgrLite::PoolId render_path1_filter_dsp;
208 
210 
211 typedef struct
212 {
218  uint8_t render_path1_filter_pcm;
219 
225  uint8_t render_path1_filter_dsp;
226 
228 
231 typedef struct
232 {
236 
240 
242 
243 typedef struct
244 {
248 
252 
254 
258 {
261  int handle;
262 
266 
269  bool result;
270 };
271 
272 typedef void (*OutputMixerCallback)(MsgQueId requester_dtq, MsgType msgtype, AsOutputMixDoneParam *param);
273 typedef void (*OutputMixerErrorCallback)(uint8_t handle);
274 
275 typedef struct
276 {
282  uint8_t output_device;
283 
289  uint8_t mixer_type;
290 
296  uint8_t post_enable;
297 
300  OutputMixerCallback cb;
301 
304  OutputMixerErrorCallback error_cb;
305 
307 
310 typedef struct
311 {
312  uint8_t reserve;
313 
315 
318 typedef struct
319 {
322  uint8_t handle;
323 
326  PcmProcDoneCallback callback;
327 
331 
333 
336 typedef struct
337 {
340  int8_t direction;
341 
344  uint32_t times;
345 
347 
350 typedef struct
351 {
354  uint8_t cmd_type;
355 
358  uint8_t *addr;
359 
362  uint32_t size;
363 
365 
367 
370 typedef struct
371 {
372  uint8_t handle;
373 
374  union
375  {
376  AsActivateOutputMixer act_param;
377  AsDeactivateOutputMixer deact_param;
378  AsFrameTermFineControl fterm_param;
379  AsInitPostProc initpp_param;
380  AsSetPostProc setpp_param;
381  };
383 
384 /****************************************************************************
385  * Public Data
386  ****************************************************************************/
387 
388 /****************************************************************************
389  * Inline Functions
390  ****************************************************************************/
391 
392 /****************************************************************************
393  * Public Function Prototypes
394  ****************************************************************************/
395 
407  AudioAttentionCb attcb);
408 
410  AudioAttentionCb attcb);
411 
412 __attribute__((deprecated(
413  "\n \
414  \n Deprecated create API is used. \
415  \n Use \"AS_CreateOutputMixer(AsCreateOutputMixParam_t * \
416  \n AudioAttentionCb)\". \
417  \n \
418  \n")))
420 
422 
432 bool AS_ActivateOutputMixer(uint8_t handle, FAR AsActivateOutputMixer *actparam);
433 
443 bool AS_SendDataOutputMixer(FAR AsSendDataOutputMixer *sendparam);
444 
455 
465 bool AS_InitPostprocOutputMixer(uint8_t handle, FAR AsInitPostProc *initppparam);
466 
476 bool AS_SetPostprocOutputMixer(uint8_t handle, FAR AsSetPostProc *setppparam);
477 
487 bool AS_DeactivateOutputMixer(uint8_t handle, FAR AsDeactivateOutputMixer *deactparam);
488 
496 bool AS_DeleteOutputMix(void);
497 
506 
507 #endif /* __MODULES_INCLUDE_AUDIO_AUDIO_OUTPUTMIX_API_H */
508 
bool AS_FrameTermFineControlOutputMixer(uint8_t handle, FAR AsFrameTermFineControl *ftermparam)
Set clock recovery parameters.
OutputMixer No.1.
Definition: audio_outputmix_api.h:93
int8_t direction
[in] Recovery direction (advance or delay)
Definition: audio_outputmix_api.h:340
Definition: audio_common_defs.h:613
Definition: audio_outputmix_api.h:336
Definition: audio_outputmix_api.h:193
Speaker out.
Definition: audio_outputmix_api.h:100
Deactivation done.
Definition: audio_outputmix_api.h:153
AsOutputMixPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_outputmix_api.h:251
AsPcmDataParam pcm
[in] PCM data parameter
Definition: audio_outputmix_api.h:330
A2DP out.
Definition: audio_outputmix_api.h:108
Definition: audio_outputmix_api.h:275
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:721
Init Postproc command done.
Definition: audio_outputmix_api.h:161
Activation done.
Definition: audio_outputmix_api.h:149
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:224
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_outputmix_api.h:180
bool AS_SendDataOutputMixer(FAR AsSendDataOutputMixer *sendparam)
Send audio data via outputmixer.
Main.
Definition: audio_outputmix_api.h:118
bool AS_CreateOutputMixer(FAR AsCreateOutputMixParam_t *param, AudioAttentionCb attcb)
Create audio output mixer.
uint8_t cmd_type
Definition: audio_outputmix_api.h:354
Memory Handler API.
MemMgrLite::PoolId render_path0_filter_pcm
[in] Memory pool id of pcm data Effective only when use postfilter
Definition: audio_outputmix_api.h:199
uint8_t * addr
Definition: audio_outputmix_api.h:358
CXD5602 Audio Common Definitions.
I2S out.
Definition: audio_outputmix_api.h:104
uint8_t mixer
[in] Message queue id of output mixer
Definition: audio_outputmix_api.h:176
Definition: MemMgrTypes.h:88
Definition: audio_outputmix_api.h:141
__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:172
AsOutputMixDoneCmdType done_type
Definition: audio_outputmix_api.h:265
AsOutputMixMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_outputmix_api.h:235
Set Postproc command done.
Definition: audio_outputmix_api.h:165
OutputMixer No.0.
Definition: audio_outputmix_api.h:89
Definition: audio_outputmix_api.h:310
Definition: audio_outputmix_api.h:257
int handle
Definition: audio_outputmix_api.h:261
Definition: audio_outputmix_api.h:370
AsOutputMixerType
Definition: audio_outputmix_api.h:114
bool AS_InitPostprocOutputMixer(uint8_t handle, FAR AsInitPostProc *initppparam)
Init Postproces DSP.
uint8_t post_enable
[in] Enable postfilter
Definition: audio_outputmix_api.h:296
Definition: audio_outputmix_api.h:231
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:217
Definition: audio_outputmix_api.h:211
uint8_t handle
[in] Handle of OutputMixer
Definition: audio_outputmix_api.h:322
Main & SoundEffet.
Definition: audio_outputmix_api.h:126
uint8_t mixer_type
[in] Mixer typ
Definition: audio_outputmix_api.h:289
Definition: audio_outputmix_api.h:137
uint32_t times
[in] Recovery term
Definition: audio_outputmix_api.h:344
uint8_t render_path0_filter_dsp
[in] Message queue id of dsp Effective only when use postfilter
Definition: audio_outputmix_api.h:186
bool result
Definition: audio_outputmix_api.h:269
AsOutputMixMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_outputmix_api.h:247
uint32_t size
Definition: audio_outputmix_api.h:362
AsOutputMixDevice
Definition: audio_outputmix_api.h:96
AsOutputMixerHandle
Definition: audio_outputmix_api.h:85
bool AS_DeactivateOutputMixer(uint8_t handle, FAR AsDeactivateOutputMixer *deactparam)
Deactivate audio output mixer.
Set Clock recovery done.
Definition: audio_outputmix_api.h:157
bool AS_DeleteOutputMix(void)
Delete output mixer.
AsOutputMixPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_outputmix_api.h:239
MemMgrLite::PoolId render_path0_filter_dsp
[in] Memory pool id of dsp command data Effective only when use postfilter
Definition: audio_outputmix_api.h:206
Definition: audio_outputmix_api.h:350
SoundEffet.
Definition: audio_outputmix_api.h:122
bool AS_checkAvailabilityOutputMixer(void)
Check availability of OutputMixer.
uint8_t output_device
[in] Output device type
Definition: audio_outputmix_api.h:282
Definition: audio_outputmix_api.h:318
AsOutputMixDoneCmdType
Definition: audio_outputmix_api.h:145
Definition: audio_outputmix_api.h:243
AsOutputMixerPostFilter
Definition: audio_outputmix_api.h:133