Developer World
Spresense Arduino Library v3.2.0-77d75a4
OutputMixer.h
Go to the documentation of this file.
1/*
2 * MediaPlayer.h - Audio include file for the Spresense SDK
3 * Copyright 2018 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
26#ifndef OutputMixer_h
27#define OutputMixer_h
28
29#ifdef SUBCORE
30#error "Audio library is NOT supported by SubCore."
31#endif
32
33// #ifdef __cplusplus
34
35#include <audio/audio_high_level_api.h>
36
37/*--------------------------------------------------------------------------*/
38
42#define OUTPUTMIXER_LOG_DEBUG
43
44#define print_err printf
45
46#ifdef OUTPUTMIXER_LOG_DEBUG
47#define print_dbg(...) printf(__VA_ARGS__)
48#else
49#define print_dbg(x...)
50#endif
51
56#define OUTPUTMIXER_ECODE_OK 0
57#define OUTPUTMIXER_ECODE_COMMAND_ERROR 1
58
63#define OUTPUTMIXER_RNDCLK_NORMAL (0)
64#define OUTPUTMIXER_RNDCLK_HIRESO (1)
65
66
67/*--------------------------------------------------------------------------*/
68
75{
76public:
77
83 {
84 static OutputMixer instance;
85 return &instance;
86 }
87
95 err_t begin(void){ return activateBaseband(); }
96
104 err_t end(void){ return deactivateBaseband(); }
105
115
123 err_t create(AudioAttentionCb attcb);
124
135 AsOutputMixerHandle handle,
136 OutputMixerCallback omcb
137 );
138
149 AsOutputMixerHandle handle,
150 uint8_t output_device,
151 OutputMixerCallback omcb
152 );
153
164 AsOutputMixerHandle handle,
165 PcmProcDoneCallback pcmdone_cb,
166 AsPcmDataParam pcm
167 );
168
177 AsOutputMixerHandle handle
178 );
179
189
198
208 int master,
209 int player0,
210 int player1
211 );
212
222 uint8_t clk_mode
223 );
224
225private:
226
231 OutputMixer() {}
232 OutputMixer(const OutputMixer&);
233 OutputMixer& operator=(const OutputMixer&);
234 ~OutputMixer() {}
235
236};
237
238// #endif // __cplusplus
239#endif // MediaPlayer_h
240
OutputMixer Class Definitions.
Definition: OutputMixer.h:75
err_t deactivate(AsOutputMixerHandle handle)
Deactivate the OutputMixer.
err_t create(AudioAttentionCb attcb)
Creation of the OutputMixer.
err_t activateBaseband(void)
Activate Audio Hw.
err_t begin(void)
Initialize the OutputMixer.
Definition: OutputMixer.h:95
err_t activate(AsOutputMixerHandle handle, uint8_t output_device, OutputMixerCallback omcb)
Activate the OutputMixer with specify output device.
err_t create(void)
Creation of the OutputMixer.
bool setRenderingClkMode(uint8_t clk_mode)
Set Rendering clock mode.
err_t sendData(AsOutputMixerHandle handle, PcmProcDoneCallback pcmdone_cb, AsPcmDataParam pcm)
Send PCM data via OutputMixer.
err_t deactivateBaseband(void)
Deactivate Audio Hw.
err_t end(void)
Finalize the OutputMixer.
Definition: OutputMixer.h:104
err_t setVolume(int master, int player0, int player1)
Set speaker out volume.
static OutputMixer * getInstance()
Get instance of MediaRecorder for singleton.
Definition: OutputMixer.h:82
err_t activate(AsOutputMixerHandle handle, OutputMixerCallback omcb)
Activate the OutputMixer.
unsigned int err_t
Definition: Audio.h:108