Developer World
Spresense SDK Library v3.2.0-ebc0364
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
92typedef enum
93{
97
101
105
109
113
117
119
120/* SetRecorderStatus */
121
124typedef enum
125{
129
133
134 /* Note:
135 * Delete this definition with Ver 1.1.0
136 */
137
138 AS_SETRECDR_STS_INPUTDEVICE_MIC_A = AS_SETRECDR_STS_INPUTDEVICE_MIC,
139 AS_SETRECDR_STS_INPUTDEVICE_MIC_D = AS_SETRECDR_STS_INPUTDEVICE_MIC,
140 AS_SETRECDR_STS_INPUTDEVICE_I2S_IN = AS_SETRECDR_STS_INPUTDEVICE_I2S,
141
142 AS_SETRECDR_STS_INPUTDEVICE_NUM
144
147typedef enum
148{
154
158 AS_SETRECDR_STS_OUTPUTDEVICE_NUM
160
161/* InitRecorder */
162
165typedef enum
166{
170
174
178
182
186
190
194
198
202
206
210 AS_INITREC_COMPLEXITY_NUM
212
213/* for AsRecorderOutputDeviceHdlr */
214
219typedef void (*AudioSimpleFifoWriteDoneCallbackFunction)(uint32_t size);
220
225typedef struct
226{
233
241
244typedef struct
245{
252
259
262 uint8_t reserved1;
263
266 uint8_t reserved2;
267
271
275
277
278typedef bool (*MediaRecorderCallback)(AsRecorderEvent evtype, uint32_t result, uint32_t sub_result);
279
280typedef struct
281{
283
284 MediaRecorderCallback cb;
285
287
290typedef struct
291{
298
305
311 uint8_t bit_length;
312
318 uint8_t codec_type;
319
326
332 uint32_t bitrate;
333
337 char dsp_path[AS_AUDIO_DSP_PATH_LEN];
338
340
342typedef union
343{
349
350
356
358
361typedef struct
362{
365 uint8_t recorder;
366
369 uint8_t mng;
370
373 uint8_t dsp;
375
378typedef struct
379{
383
387
391
393
394typedef struct
395{
398 uint8_t input;
399
402 uint8_t output;
403
406 uint8_t dsp;
407
409
412typedef struct
413{
417
421
423
424typedef struct
425{
429
433
435
436/****************************************************************************
437 * Public Data
438 ****************************************************************************/
439
440/****************************************************************************
441 * Inline Functions
442 ****************************************************************************/
443
444/****************************************************************************
445 * Public Function Prototypes
446 ****************************************************************************/
447
459 AudioAttentionCb attcb);
460
462 AudioAttentionCb attcb);
463
464__attribute__((deprecated(
465 "\n \
466 \n Deprecated create API is used. \
467 \n Use \"AS_CreateMediaRecorder(AsCreateRecorderParam_t, \
468 \n AudioAttentionCb)\". \
469 \n \
470 \n")))
472
483
494
505
514
523
532
541
550
551#endif /* __MODULES_INCLUDE_AUDIO_AUDIO_RECORDER_API_H */
CXD5602 Audio Common Definitions.
CXD5602 Audio Object Layer API.
__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
#define AS_AUDIO_DSP_PATH_LEN
Definition: audio_common_defs.h:693
bool AS_ReqEncodeMediaRecorder(AsPcmDataParam *pcmparam)
Request encode to audio recorder.
bool AS_InitMediaRecorder(FAR AsInitRecorderParam *initparam)
Init audio recorder.
AsInitRecorderComputationalComplexity
Definition: audio_recorder_api.h:166
bool AS_ActivateMediaRecorder(FAR AsActivateRecorder *actparam)
Activate audio recorder.
bool AS_DeleteMediaRecorder(void)
Deactivate audio recorder.
AsSetRecorderStsInputDevice
Definition: audio_recorder_api.h:125
AsRecorderEvent
Definition: audio_recorder_api.h:93
void(* AudioSimpleFifoWriteDoneCallbackFunction)(uint32_t size)
Definition: audio_recorder_api.h:219
AsSetRecorderStsOutputDevice
Definition: audio_recorder_api.h:148
bool AS_CreateMediaRecorder(FAR AsCreateRecorderParam_t *param, AudioAttentionCb attcb)
Create audio recorder.
bool AS_StartMediaRecorder(void)
Start audio recorder.
bool AS_StopMediaRecorder(void)
Stop audio recorder.
bool AS_checkAvailabilityMediaRecorder(void)
Check availability of MediaRecorder.
bool AS_DeactivateMediaRecorder(void)
Deactivate audio recorder.
@ AS_INITREC_COMPLEXITY_0
Complexity = 0(lowest complexity)
Definition: audio_recorder_api.h:169
@ AS_INITREC_COMPLEXITY_6
Complexity = 2.
Definition: audio_recorder_api.h:193
@ AS_INITREC_COMPLEXITY_3
Complexity = 2.
Definition: audio_recorder_api.h:181
@ AS_INITREC_COMPLEXITY_10
Complexity = 10 (highest complexity)
Definition: audio_recorder_api.h:209
@ AS_INITREC_COMPLEXITY_1
Complexity = 1.
Definition: audio_recorder_api.h:173
@ AS_INITREC_COMPLEXITY_5
Complexity = 2.
Definition: audio_recorder_api.h:189
@ AS_INITREC_COMPLEXITY_4
Complexity = 2.
Definition: audio_recorder_api.h:185
@ AS_INITREC_COMPLEXITY_9
Complexity = 2.
Definition: audio_recorder_api.h:205
@ AS_INITREC_COMPLEXITY_2
Complexity = 2.
Definition: audio_recorder_api.h:177
@ AS_INITREC_COMPLEXITY_8
Complexity = 2.
Definition: audio_recorder_api.h:201
@ AS_INITREC_COMPLEXITY_7
Complexity = 2.
Definition: audio_recorder_api.h:197
@ AS_SETRECDR_STS_INPUTDEVICE_MIC
CXD5247 MIC.
Definition: audio_recorder_api.h:128
@ AS_SETRECDR_STS_INPUTDEVICE_I2S
I2S Input.
Definition: audio_recorder_api.h:132
@ AsRecorderEventAct
Activate.
Definition: audio_recorder_api.h:96
@ AsRecorderEventStop
Stop.
Definition: audio_recorder_api.h:116
@ AsRecorderEventDeact
Deactivate.
Definition: audio_recorder_api.h:100
@ AsRecorderEventInit
Init.
Definition: audio_recorder_api.h:104
@ AsRecorderEventStart
Start.
Definition: audio_recorder_api.h:108
@ AsRecorderEventReqEncode
Req Encode.
Definition: audio_recorder_api.h:112
@ AS_SETRECDR_STS_OUTPUTDEVICE_EMMC
eMMC FileSystem
Definition: audio_recorder_api.h:153
@ AS_SETRECDR_STS_OUTPUTDEVICE_RAM
RAM.
Definition: audio_recorder_api.h:157
Definition: audio_recorder_api.h:245
uint8_t reserved1
[in] reserved
Definition: audio_recorder_api.h:262
uint8_t output_device
[in] Select Recorder output device
Definition: audio_recorder_api.h:258
AsRecorderOutputDeviceHdlr * output_device_handler
[in] Set Recorder output device handler, refer following.
Definition: audio_recorder_api.h:274
uint8_t reserved2
[in] reserved
Definition: audio_recorder_api.h:266
uint32_t input_device_handler
[in] Set Recorder input device handler, T.B.D.
Definition: audio_recorder_api.h:270
uint8_t input_device
[in] Select Recorder input device
Definition: audio_recorder_api.h:251
Definition: audio_recorder_api.h:281
Definition: audio_recorder_api.h:413
AsRecorderPoolId_old_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recorder_api.h:420
AsRecorderMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recorder_api.h:416
Definition: audio_recorder_api.h:425
AsRecorderPoolId_t pool_id
[in] ID of memory pool for processing data
Definition: audio_recorder_api.h:432
AsRecorderMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition: audio_recorder_api.h:428
Definition: audio_recorder_api.h:291
uint32_t bitrate
[in] Select InitRecorder bitrate
Definition: audio_recorder_api.h:332
uint8_t codec_type
[in] Select InitRecorder codec type
Definition: audio_recorder_api.h:318
uint8_t channel_number
[in] Select InitRecorder input channels
Definition: audio_recorder_api.h:304
uint32_t sampling_rate
[in] Select sampling rate for recorded data
Definition: audio_recorder_api.h:297
uint8_t computational_complexity
[in] Select InitRecorder computational complexity
Definition: audio_recorder_api.h:325
uint8_t bit_length
[in] Select InitRecorder input bit length
Definition: audio_recorder_api.h:311
Definition: audio_common_defs.h:703
Definition: audio_recorder_api.h:362
uint8_t mng
[in] Message queue id of audio_manager
Definition: audio_recorder_api.h:369
uint8_t dsp
[in] Message queue id of DSP
Definition: audio_recorder_api.h:373
uint8_t recorder
[in] Message queue id of recorder
Definition: audio_recorder_api.h:365
Definition: audio_recorder_api.h:226
AudioSimpleFifoWriteDoneCallbackFunction callback_function
[in] Set callback function
Definition: audio_recorder_api.h:239
void * simple_fifo_handler
[in] Set SimpleFifo handler
Definition: audio_recorder_api.h:232
Definition: audio_recorder_api.h:395
uint8_t input
[in] Memory pool id of input data
Definition: audio_recorder_api.h:398
uint8_t dsp
[in] Memory pool id of dsp command data
Definition: audio_recorder_api.h:406
uint8_t output
[in] Memory pool id of output data
Definition: audio_recorder_api.h:402
Definition: audio_recorder_api.h:379
MemMgrLite::PoolId dsp
[in] Memory pool id of dsp command data
Definition: audio_recorder_api.h:390
MemMgrLite::PoolId output
[in] Memory pool id of output data
Definition: audio_recorder_api.h:386
MemMgrLite::PoolId input
[in] Memory pool id of input data
Definition: audio_recorder_api.h:382
Definition: MemMgrTypes.h:88
Definition: audio_recorder_api.h:343
AsInitRecorderParam init_param
[in] for InitRecorder (Object Interface==AS_InitMediaRecorder)
Definition: audio_recorder_api.h:355
AsActivateRecorder act_param
[in] for ActivateRecorder (Object Interface==AS_ActivateMediaRecorder)
Definition: audio_recorder_api.h:348