Spresense SDK Library v3.4.5-e9a4f17
Loading...
Searching...
No Matches
audio_synthesizer_api.h
Go to the documentation of this file.
1/****************************************************************************
2 * modules/include/audio/audio_synthesizer_api.h
3 *
4 * Copyright 2020 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_SYNTHESIZER_API_H
37#define __MODULES_INCLUDE_AUDIO_SYNTHESIZER_API_H
38
43
52
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_SYNTHESIZER_ENABLE
68
71
73
74#define LENGTH_INIT_SYNTHESIZER 10
75
77
78#define LENGTH_START_SYNTHESIZER 2
79
81
82#define LENGTH_STOP_SYNTHESIZER 2
83
84
86
87/****************************************************************************
88 * Public Types
89 ****************************************************************************/
90
92
122
124
125typedef enum
126{
127 InvalidWave = 0xffffffff,
128
130
132 AsSynthesizerRectWave, /* 1 */
133 AsSynthesizerSawWave, /* 2 */
134
135 AsSynthesizerWaveModeNum
136
138
140
141typedef enum
142{
144
146
148
150
162
163/* SetSynthesizerStatus */
164
165/* InitSynthesizer */
166
168
169typedef bool (*SynthesizerCallback)(AsSynthesizerEvent evtype, uint32_t result, void *param);
170
171typedef struct
172{
174
176
178
179 void *param;
180
182
184
186
188{
190
192 {
193 MsgQueId id;
194 uint32_t identifier;
195 } msg;
196};
197
198typedef struct
199{
201
203
205
206 uint8_t channel_num;
207
209
210 uint8_t bit_width;
211
213
214 uint16_t sample_size;
215
217
219
221
222 uint16_t attack;
224
225 uint16_t decay;
227
228 uint16_t sustain;
229
231
232 uint16_t release;
233
235
237
242
244
249
251
253
254typedef struct
255{
257
258 uint8_t channel_no;
259
261
262 uint32_t frequency;
263
265
266 uint16_t attack;
268
269 uint16_t decay;
271
272 uint16_t sustain;
273
275
276 uint16_t release;
277
279
281
282typedef struct
283{
285
286 uint8_t synthesizer;
287
289
290 uint8_t mng;
291
293
294 uint8_t dsp;
295
297
299
311
313
325
326/****************************************************************************
327 * Public Data
328 ****************************************************************************/
329
330/****************************************************************************
331 * Inline Functions
332 ****************************************************************************/
333
334/****************************************************************************
335 * Public Function Prototypes
336 ****************************************************************************/
337
347
349 AudioAttentionCb attcb);
350
351__attribute__((deprecated(
352 "\n \
353 \n Deprecated create API is used. \
354 \n Use \"AS_CreateMediaSynthesizer(AsCreateSynthesizerParam_t, \
355 \n AudioAttentionCb)\". \
356 \n \
357 \n")))
359
368
370
379
381
388
390
397
399
406
408
415
417
424
426
433
435
442
444
453
455
456#endif /* __MODULES_INCLUDE_AUDIO_SYNTHESIZER_API_H */
460
CXD5602 Audio Common Definitions.
CXD5602 Audio Object Layer API.
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_ReleaseMediaSynthesizer(bool is_end)
Deactivate audio synthesizer.
AsSynthesizerDataPath
Definition audio_synthesizer_api.h:152
bool AS_DeleteMediaSynthesizer(void)
Deactivate audio synthesizer.
bool AS_SetMediaSynthesizer(FAR AsSetSynthesizer *set_param)
Deactivate audio synthesizer.
bool AS_StartMediaSynthesizer(void)
Start audio synthesizer.
AsSynthesizerEvent
Definition audio_synthesizer_api.h:94
AsSynthesizerWaveMode
Definition audio_synthesizer_api.h:126
bool AS_SetFrequencyMediaSynthesizer(FAR AsSetSynthesizer *set_param)
Set audio synthesizer at frequency.
bool AS_CreateMediaSynthesizer(FAR AsCreateSynthesizerParam_t *param, AudioAttentionCb attcb)
Create audio synthesizer.
AsSynthesizerChannelNum
Definition audio_synthesizer_api.h:142
bool AS_StopMediaSynthesizer(void)
Stop audio synthesizer.
bool AS_ActivateMediaSynthesizer(FAR AsActivateSynthesizer *actparam)
Activate audio synthesizer.
bool(* SynthesizerCallback)(AsSynthesizerEvent evtype, uint32_t result, void *param)
Definition audio_synthesizer_api.h:169
bool AS_SetEnvelopeMediaSynthesizer(FAR AsSetSynthesizer *set_param)
Set audio synthesizer at envelope.
bool AS_DeactivateMediaSynthesizer(void)
Deactivate audio synthesizer.
bool AS_InitMediaSynthesizer(FAR AsInitSynthesizerParam *initparam)
Init audio synthesizer.
void(* SynthesizerDoneCallback)(AsPcmDataParam param)
Definition audio_synthesizer_api.h:185
@ AsSynthesizerDataPathCallback
PCM data is send by callback.
Definition audio_synthesizer_api.h:155
@ AsSynthesizerDataPathMessage
PCM data is send by message.
Definition audio_synthesizer_api.h:159
@ AsSynthesizerEventInit
Init.
Definition audio_synthesizer_api.h:101
@ AsSynthesizerEventSet
Set.
Definition audio_synthesizer_api.h:117
@ AsSynthesizerEventStart
Start.
Definition audio_synthesizer_api.h:105
@ AsSynthesizerEventDeact
Deactivate.
Definition audio_synthesizer_api.h:113
@ AsSynthesizerEventStop
Stop.
Definition audio_synthesizer_api.h:109
@ AsSynthesizerEventAct
Activate.
Definition audio_synthesizer_api.h:97
@ AsSynthesizerSinWave
Waveform.
Definition audio_synthesizer_api.h:131
@ AsSynthesizerMaxChannelNum
Maximum number of channels.
Definition audio_synthesizer_api.h:145
Definition audio_synthesizer_api.h:172
void * param
[in] General parameter to callback arguments
Definition audio_synthesizer_api.h:179
SynthesizerCallback cb
[in] Processing completion callback
Definition audio_synthesizer_api.h:175
Definition audio_synthesizer_api.h:315
AsSynthesizerPoolId_t pool_id
[in] ID of memory pool for processing data
Definition audio_synthesizer_api.h:322
AsSynthesizerMsgQueId_t msgq_id
[in] ID for sending messages to each function
Definition audio_synthesizer_api.h:318
Definition audio_synthesizer_api.h:199
uint16_t sustain
[in] sustain
Definition audio_synthesizer_api.h:228
uint8_t bit_width
[in] Bit depth
Definition audio_synthesizer_api.h:210
uint16_t attack
[in] attack
Definition audio_synthesizer_api.h:222
uint16_t decay
[in] decay
Definition audio_synthesizer_api.h:225
uint8_t channel_num
[in] Number of channels
Definition audio_synthesizer_api.h:206
AsSynthesizerWaveMode type
[in] Waveform type
Definition audio_synthesizer_api.h:202
AsSynthesizerDataDest dest
[in] Data destination, callback or message
Definition audio_synthesizer_api.h:250
AsSynthesizerDataPath data_path
[in] Select Data path from oscillator
Definition audio_synthesizer_api.h:243
uint16_t release
[in] release
Definition audio_synthesizer_api.h:232
uint32_t sampling_rate
[in] sampling rate
Definition audio_synthesizer_api.h:218
char dsp_path[AS_AUDIO_DSP_PATH_LEN]
[in] Audio DSP path
Definition audio_synthesizer_api.h:236
uint16_t sample_size
[in] sample per frame
Definition audio_synthesizer_api.h:214
Definition audio_common_defs.h:703
Definition audio_synthesizer_api.h:255
uint16_t sustain
[in] sustain
Definition audio_synthesizer_api.h:272
uint8_t channel_no
[in] Channel number
Definition audio_synthesizer_api.h:258
uint16_t attack
[in] attack
Definition audio_synthesizer_api.h:266
uint16_t decay
[in] decay
Definition audio_synthesizer_api.h:269
uint16_t release
[in] release
Definition audio_synthesizer_api.h:276
uint32_t frequency
[in] Sound frequency
Definition audio_synthesizer_api.h:262
Definition audio_synthesizer_api.h:192
Definition audio_synthesizer_api.h:283
uint8_t mng
[in] Message queue id of audio_manager
Definition audio_synthesizer_api.h:290
uint8_t dsp
[in] Message queue id of DSP
Definition audio_synthesizer_api.h:294
uint8_t synthesizer
[in] Message queue id of synthesizer
Definition audio_synthesizer_api.h:286
Definition audio_synthesizer_api.h:301
MemMgrLite::PoolId dsp
[in] Memory pool id of dsp command data
Definition audio_synthesizer_api.h:308
MemMgrLite::PoolId output
[in] Memory pool id of output data
Definition audio_synthesizer_api.h:304
Definition MemMgrTypes.h:88
Definition audio_synthesizer_api.h:188