Developer World
Spresense Arduino Library v3.2.0-77d75a4
FrontEnd.h
Go to the documentation of this file.
1/*
2 * FrontEnd.h - Audio include file for the Spresense SDK
3 * Copyright 2019, 2021 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
29#ifndef FrontEnd_h
30#define FrontEnd_h
31
32#ifdef SUBCORE
33#error "Audio library is NOT supported by SubCore."
34#endif
35
36#include <audio/audio_capture_api.h>
37#include <audio/audio_frontend_api.h>
38#include <audio/audio_message_types.h>
39#include <audio/utilities/frame_samples.h>
40#include <audio/utilities/wav_containerformat.h>
41#include <memutils/simple_fifo/CMN_SimpleFifo.h>
42
43/*--------------------------------------------------------------------------*/
44
49#define FRONTEND_LOG_DEBUG
50
51#define print_err printf
52
53#ifdef FRONTEND_LOG_DEBUG
54#define print_dbg(...) printf(__VA_ARGS__)
55#else
56#define print_dbg(x...)
57#endif
58
63#define FRONTEND_ECODE_OK 0
64#define FRONTEND_ECODE_COMMAND_ERROR 1
65#define FRONTEND_ECODE_BASEBAND_ERROR 2
66
71#define FRONTEND_CAPCLK_NORMAL (0)
72#define FRONTEND_CAPCLK_HIRESO (1)
73
74/*--------------------------------------------------------------------------*/
75
82{
83public:
84
90 {
91 static FrontEnd instance;
92 return &instance;
93 }
94
104
112 err_t begin(AudioAttentionCb attcb);
113
121 err_t end(void);
122
132
145 MicFrontendCallback fedcb
146 );
148 MicFrontendCallback fedcb,
149 bool is_digital
150 );
151
162 uint8_t channel_number,
163 uint8_t bit_length,
164 uint32_t samples_per_frame,
165 uint8_t data_path,
166 AsDataDest dest
167 );
168
181
190 err_t stop(void);
191
200 AsInitPreProcParam *param
201 );
202
211 AsSetPreProcParam *param
212 );
213
225 int16_t mic_gain
229 );
230
240 uint8_t clk_mode
241 );
242
251
252private:
253
258 FrontEnd()
259 : m_fed_callback(NULL)
260 {}
261 FrontEnd(const FrontEnd&);
262 FrontEnd& operator=(const FrontEnd&);
263 ~FrontEnd() {}
264
269 MicFrontendCallback m_fed_callback;
270
275 err_t activateBaseband(void);
276 err_t deactivateBaseband(void);
277
278};
279
280#endif // FrontEnd_h
281
FrontEnd Class Definitions.
Definition: FrontEnd.h:82
err_t init(uint8_t channel_number, uint8_t bit_length, uint32_t samples_per_frame, uint8_t data_path, AsDataDest dest)
Initialize the FrontEnd.
err_t end(void)
Finalize the FrontEnd.
err_t deactivate(void)
Deactivate the FrontEnd.
err_t setCapturingClkMode(uint8_t clk_mode)
Set capturing clock mode.
err_t activate(MicFrontendCallback fedcb)
Activate the FrontEnd.
err_t activate(void)
Activate the FrontEnd.
err_t setMicGain(int16_t mic_gain)
Set Mic gain.
err_t initpreproc(AsInitPreProcParam *param)
Send init command to pre-process DSP.
err_t setpreproc(AsSetPreProcParam *param)
Send init command to pre-process DSP.
err_t begin(void)
Initialize the FrontEnd.
err_t stop(void)
Stop Recording.
static FrontEnd * getInstance()
Get instance of FrontEnd for singleton.
Definition: FrontEnd.h:89
err_t begin(AudioAttentionCb attcb)
Initialize the FrontEnd.
err_t start(void)
Start FrontEnd.
unsigned int err_t
Definition: Audio.h:108