Developer World
Spresense SDK Library v1.4.2-3df2e9d
audio_recorder_api.h
Go to the documentation of this file.
1 /****************************************************************************
2  * modules/include/audio/audio_recorder_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_RECORDER_API_H
37 #define __MODULES_INCLUDE_AUDIO_AUDIO_RECORDER_API_H
38 
53 /****************************************************************************
54  * Included Files
55  ****************************************************************************/
56 
57 #include <stdint.h>
58 #include <stdbool.h>
59 
62 
63 /****************************************************************************
64  * Pre-processor Definitions
65  ****************************************************************************/
66 
67 #define AS_FEATURE_RECORDER_ENABLE
68 
74 #define LENGTH_START_RECORDER 2
75 
78 #define LENGTH_STOP_RECORDER 2
79 
82 #define LENGTH_INIT_RECORDER 10
83 
86 /****************************************************************************
87  * Public Types
88  ****************************************************************************/
89 
92 typedef enum
93 {
97 
101 
105 
109 
113 
117 
119 
120 /* SetRecorderStatus */
121 
124 typedef enum
125 {
129 
130  /* Note:
131  * Delete this definition with Ver 1.1.0
132  */
133 
134  AS_SETRECDR_STS_INPUTDEVICE_MIC_A = AS_SETRECDR_STS_INPUTDEVICE_MIC,
135  AS_SETRECDR_STS_INPUTDEVICE_MIC_D = AS_SETRECDR_STS_INPUTDEVICE_MIC,
136 
137  AS_SETRECDR_STS_INPUTDEVICE_NUM
139 
142 typedef enum
143 {
149 
153  AS_SETRECDR_STS_OUTPUTDEVICE_NUM
155 
156 /* InitRecorder */
157 
160 typedef enum
161 {
165 
169 
173 
177 
181 
185 
189 
193 
197 
201 
205  AS_INITREC_COMPLEXITY_NUM
207 
208 /* for AsRecorderOutputDeviceHdlr */
209 
215 
220 typedef struct
221 {
228 
236 
239 typedef struct
240 {
246  uint8_t input_device;
247 
253  uint8_t output_device;
254 
257  uint8_t reserved1;
258 
261  uint8_t reserved2;
262 
266 
270 
272 
273 typedef bool (*MediaRecorderCallback)(AsRecorderEvent evtype, uint32_t result, uint32_t sub_result);
274 
275 typedef struct
276 {
278 
279  MediaRecorderCallback cb;
280 
282 
285 typedef struct
286 {
292  uint32_t sampling_rate;
293 
299  uint8_t channel_number;
300 
306  uint8_t bit_length;
307 
313  uint8_t codec_type;
314 
321 
327  uint32_t bitrate;
328 
332  char dsp_path[AS_AUDIO_DSP_PATH_LEN];
333 
335 
337 typedef union
338 {
344 
345 
351 
353 
356 typedef struct
357 {
360  uint8_t recorder;
361 
364  uint8_t mng;
365 
368  uint8_t dsp;
370 
373 typedef struct
374 {
378 
382 
386 
388 
389 typedef struct
390 {
393  uint8_t input;
394 
397  uint8_t output;
398 
401  uint8_t dsp;
402 
404 
407 typedef struct
408 {
412 
416 
418 
419 typedef struct
420 {
424 
428 
430 
431 /****************************************************************************
432  * Public Data
433  ****************************************************************************/
434 
435 /****************************************************************************
436  * Inline Functions
437  ****************************************************************************/
438 
439 /****************************************************************************
440  * Public Function Prototypes
441  ****************************************************************************/
442 
454  AudioAttentionCb attcb);
455 
457  AudioAttentionCb attcb);
458 
459 __attribute__((deprecated(
460  "\n \
461  \n Deprecated create API is used. \
462  \n Use \"AS_CreateMediaRecorder(AsCreateRecorderParam_t, \
463  \n AudioAttentionCb)\". \
464  \n \
465  \n")))
467 
477 bool AS_ActivateMediaRecorder(FAR AsActivateRecorder *actparam);
478 
488 bool AS_InitMediaRecorder(FAR AsInitRecorderParam *initparam);
489 
500 
508 bool AS_StartMediaRecorder(void);
509 
517 bool AS_StopMediaRecorder(void);
518 
526 bool AS_DeactivateMediaRecorder(void);
527 
535 bool AS_DeleteMediaRecorder(void);
536 
545 
546 #endif /* __MODULES_INCLUDE_AUDIO_AUDIO_RECORDER_API_H */
547 
AsRecorderPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recorder_api.h:427
Complexity = 2.
Definition: audio_recorder_api.h:176
Definition: audio_common_defs.h:613
CXD5602 Audio Object Layer API.
Req Encode.
Definition: audio_recorder_api.h:112
MemMgrLite::PoolId dsp
[in] Memory pool id of dsp command data
Definition: audio_recorder_api.h:385
uint32_t bitrate
[in] Select InitRecorder bitrate
Definition: audio_recorder_api.h:327
AsRecorderEvent
Definition: audio_recorder_api.h:92
Stop.
Definition: audio_recorder_api.h:116
AsInitRecorderComputationalComplexity
Definition: audio_recorder_api.h:160
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_recorder_api.h:368
void * simple_fifo_handler
[in] Set SimpleFifo handler
Definition: audio_recorder_api.h:227
Complexity = 2.
Definition: audio_recorder_api.h:200
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_recorder_api.h:364
Start.
Definition: audio_recorder_api.h:108
Complexity = 10 (highest complexity)
Definition: audio_recorder_api.h:204
uint8_t bit_length
[in] Select InitRecorder input bit length
Definition: audio_recorder_api.h:306
Complexity = 2.
Definition: audio_recorder_api.h:192
void(* AudioAttentionCb)(const ErrorAttentionParam *attparam)
Definition: audio_common_defs.h:721
uint8_t reserved1
[in] reserved
Definition: audio_recorder_api.h:257
Init.
Definition: audio_recorder_api.h:104
uint8_t dsp
[in] Memory pool id of dsp command data
Definition: audio_recorder_api.h:401
AsRecorderMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recorder_api.h:423
bool AS_DeactivateMediaRecorder(void)
Deactivate audio recorder.
uint8_t computational_complexity
[in] Select InitRecorder computational complexity
Definition: audio_recorder_api.h:320
uint8_t reserved2
[in] reserved
Definition: audio_recorder_api.h:261
Complexity = 0(lowest complexity)
Definition: audio_recorder_api.h:164
Definition: audio_recorder_api.h:373
uint8_t codec_type
[in] Select InitRecorder codec type
Definition: audio_recorder_api.h:313
uint8_t output_device
[in] Select Recorder output device
Definition: audio_recorder_api.h:253
MemMgrLite::PoolId input
[in] Memory pool id of input data
Definition: audio_recorder_api.h:377
RAM.
Definition: audio_recorder_api.h:152
Definition: audio_recorder_api.h:220
AsInitRecorderParam init_param
[in] for InitRecorder (Object Interface==AS_InitMediaRecorder)
Definition: audio_recorder_api.h:350
#define AS_AUDIO_DSP_PATH_LEN
Definition: audio_common_defs.h:604
Complexity = 2.
Definition: audio_recorder_api.h:196
uint32_t input_device_handler
[in] Set Recorder input device handler, T.B.D.
Definition: audio_recorder_api.h:265
uint8_t input_device
[in] Select Recorder input device
Definition: audio_recorder_api.h:246
CXD5602 Audio Common Definitions.
uint8_t channel_number
[in] Select InitRecorder input channels
Definition: audio_recorder_api.h:299
Definition: audio_recorder_api.h:407
Definition: audio_recorder_api.h:356
Deactivate.
Definition: audio_recorder_api.h:100
eMMC FileSystem
Definition: audio_recorder_api.h:148
Definition: MemMgrTypes.h:88
AsRecorderPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recorder_api.h:415
__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_recorder_api.h:275
bool AS_ReqEncodeMediaRecorder(AsPcmDataParam *pcmparam)
Request encode to audio recorder.
bool AS_InitMediaRecorder(FAR AsInitRecorderParam *initparam)
Init audio recorder.
bool AS_ActivateMediaRecorder(FAR AsActivateRecorder *actparam)
Activate audio recorder.
uint8_t input
[in] Memory pool id of input data
Definition: audio_recorder_api.h:393
AsRecorderMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recorder_api.h:411
Complexity = 2.
Definition: audio_recorder_api.h:188
bool AS_CreateMediaRecorder(FAR AsCreateRecorderParam_t *param, AudioAttentionCb attcb)
Create audio recorder.
CXD5247 MIC.
Definition: audio_recorder_api.h:128
void(* AudioSimpleFifoWriteDoneCallbackFunction)(uint32_t size)
Definition: audio_recorder_api.h:214
Complexity = 1.
Definition: audio_recorder_api.h:168
bool AS_StopMediaRecorder(void)
Stop audio recorder.
uint32_t sampling_rate
[in] Select sampling rate for recorded data
Definition: audio_recorder_api.h:292
MemMgrLite::PoolId output
[in] Memory pool id of output data
Definition: audio_recorder_api.h:381
bool AS_StartMediaRecorder(void)
Start audio recorder.
AsRecorderOutputDeviceHdlr * output_device_handler
[in] Set Recorder output device handler, refer following.
Definition: audio_recorder_api.h:269
uint8_t recorder
[in] Message queue id of recorder
Definition: audio_recorder_api.h:360
Definition: audio_recorder_api.h:419
uint16_t size
Definition: video.h:77
AudioSimpleFifoWriteDoneCallbackFunction callback_function
[in] Set callback function
Definition: audio_recorder_api.h:234
bool AS_DeleteMediaRecorder(void)
Deactivate audio recorder.
Activate.
Definition: audio_recorder_api.h:96
bool AS_checkAvailabilityMediaRecorder(void)
Check availability of MediaRecorder.
Definition: audio_recorder_api.h:239
uint8_t output
[in] Memory pool id of output data
Definition: audio_recorder_api.h:397
Definition: audio_recorder_api.h:389
AsSetRecorderStsInputDevice
Definition: audio_recorder_api.h:124
AsActivateRecorder act_param
[in] for ActivateRecorder (Object Interface==AS_ActivateMediaRecorder)
Definition: audio_recorder_api.h:343
Complexity = 2.
Definition: audio_recorder_api.h:172
Definition: audio_recorder_api.h:285
Complexity = 2.
Definition: audio_recorder_api.h:184
Definition: audio_recorder_api.h:337
AsSetRecorderStsOutputDevice
Definition: audio_recorder_api.h:142
Complexity = 2.
Definition: audio_recorder_api.h:180