Audio Library Class Definitions. More...
#include <Audio.h>
Public Types | |
enum | PlayerId { Player0 , Player1 } |
Audio library allows you to use two players simultaneously. Please set Player ID that player instance id created to use. More... | |
enum | ThroughInput { MicIn , I2sIn , BothIn } |
Input select parameter at baseband through mode. More... | |
enum | ThroughI2sOut { None , Mixer , Mic } |
I2S output select parameter at baseband through mode. More... | |
Public Member Functions | |
err_t | begin (void) |
Initialize the audio library and HW modules. More... | |
err_t | begin (AudioAttentionCb attcb) |
Initialize the audio library and HW modules. More... | |
err_t | end (void) |
Finalization the audio library and HW modules. More... | |
err_t | setPlayerMode (uint8_t device) |
Set Audio Library Mode to Music Player. More... | |
err_t | setPlayerMode (uint8_t device, uint32_t player0bufsize, uint32_t player1bufsize) |
Set Audio Library Mode to Music Player. More... | |
err_t | setPlayerMode (uint8_t device, uint8_t sp_drv) |
Set Audio Library Mode to Music Player. More... | |
err_t | setPlayerMode (uint8_t device, uint8_t sp_drv, uint32_t player0bufsize, uint32_t player1bufsize) |
Set Audio Library Mode to Music Player. More... | |
err_t | setRecorderMode (uint8_t input_device) |
Set Audio Library Mode to Sound Recorder. More... | |
err_t | setRecorderMode (uint8_t input_device, int32_t input_gain) |
Set Audio Library Mode to Sound Recorder. More... | |
err_t | setRecorderMode (uint8_t input_device, int32_t input_gain, uint32_t bufsize) |
Set Audio Library Mode to Sound Recorder. More... | |
err_t | setRecorderMode (uint8_t input_device, int32_t input_gain, uint32_t bufsize, bool is_digital) |
Set Audio Library Mode to Sound Recorder. More... | |
err_t | setThroughMode (ThroughInput input, ThroughI2sOut i2s_out, bool sp_out, int32_t input_gain, uint8_t sp_drv) |
Set Audio Library Mode to BaseBand Through. More... | |
err_t | setReadyMode (void) |
Set Audio Library Mode to Ready. More... | |
err_t | initPlayer (PlayerId id, uint8_t codec, uint32_t fs, uint8_t channel) |
Initialize player. More... | |
err_t | initPlayer (PlayerId id, uint8_t codec, uint32_t fs, uint8_t bitlen, uint8_t channel) |
Initialize player. More... | |
err_t | initPlayer (PlayerId id, uint8_t codec, const char *codec_path, uint32_t fs, uint8_t channel) |
Initialize player. More... | |
err_t | initPlayer (PlayerId id, uint8_t codec, const char *codec_path, uint32_t fs, uint8_t bitlen, uint8_t channel) |
Initialize player. More... | |
err_t | initRecorder (uint8_t codec, uint32_t fs, uint8_t channel) |
Initialize recorder. More... | |
err_t | initRecorder (uint8_t codec, uint32_t fs, uint8_t bitlen, uint8_t channel) |
Initialize recorder. More... | |
err_t | initRecorder (uint8_t codec, const char *codec_path, uint32_t fs, uint8_t channel) |
Initialize recorder. More... | |
err_t | initRecorder (uint8_t codec, const char *codec_path, uint32_t fs, uint8_t bitlen, uint8_t channel) |
Initialize recorder. More... | |
err_t | startPlayer (PlayerId id) |
Start Player. More... | |
err_t | startRecorder (void) |
Start Recorder. More... | |
err_t | stopPlayer (PlayerId id) |
Stop Player. More... | |
err_t | stopPlayer (PlayerId id, uint8_t mode) |
Stop Player (mode specified) More... | |
err_t | stopRecorder (void) |
Stop Recorder. More... | |
err_t | setBeep (char enable, short volume, short frequency) |
Set Beep Sound. More... | |
err_t | setVolume (int volume) |
Set Player Volume. More... | |
err_t | setVolume (int master, int player0, int player1) |
Set Player Volume. More... | |
err_t | setLRgain (PlayerId id, unsigned char l_gain, unsigned char r_gain) |
Set Player L/R Gain. More... | |
err_t | writeFrames (PlayerId id, File &myfile) |
Write Stream Data from a file to FIFO by some frames.(now 5 frames) More... | |
err_t | writeFrames (PlayerId id, int fd) |
Write Stream Data from a file to FIFO by some frames.(now 5 frames) More... | |
err_t | writeFrames (PlayerId id, uint8_t *data, uint32_t write_size) |
Write Stream Data from buffer. More... | |
err_t | writeWavHeader (File &myFile) |
Write WAV Header. More... | |
err_t | readFrames (File &myFile) |
Read Stream Data from FIFO to a file by some frames.(now 5 frames) More... | |
err_t | closeOutputFile (File &myFile) |
Close Outputfile. More... | |
err_t | readFrames (char *p_buffer, uint32_t buffer_size, uint32_t *read_size) |
Read Stream Data from FIFO to a file by some frames.(now 5 frames) More... | |
err_t | setRenderingClockMode (AsClkMode mode) |
Set Rendering clock mode. More... | |
int | getRecordingSize () |
Get recording ES size. More... | |
Static Public Member Functions | |
static AudioClass * | getInstance () |
Get instance of AudioClass for singleton. | |
Audio Library Class Definitions.
enum AudioClass::PlayerId |
err_t AudioClass::begin | ( | void | ) |
Initialize the audio library and HW modules.
This function is called only once when using the Audio library. In this function, initialization of required shared memory management library, initialization of inter-task communication library, Initialize Audio MW, initialize FIFO for ES supply, set callback at error occurrence, etc.
If you call it more than once, an error occurs, but if you call "end ()" you need to call this function again.
err_t AudioClass::begin | ( | AudioAttentionCb | attcb | ) |
Initialize the audio library and HW modules.
This function can set callback funtion which receive attention notify.
err_t AudioClass::end | ( | void | ) |
Finalization the audio library and HW modules.
This function is called when you want to exit the Audio library. In this function, necessary termination processing of the shared memory management library, end processing of the inter-task communication library, end processing of Audio MW, destruction of FIFO for ES supply, clearing of callback setting at error occurrence, etc.
This can only be called once when activated. If you call it before calling "begin ()" or call it more than once, an error occurs.
err_t AudioClass::setPlayerMode | ( | uint8_t | device | ) |
Set Audio Library Mode to Music Player.
This function switches the mode of the Audio library to Music Player. For mode details, follow the state transition chart on the developer guide.
This function cannot be called after transition to "Music Player mode". To return to the original state, please call setReadyMode ().
In this function, setting HW necessary for music playback, and setting ES buffer configuration etc.
device | Select output device. AS_SETPLAYER_OUTPUTDEVICE_SPHP or AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT. |
err_t AudioClass::setPlayerMode | ( | uint8_t | device, |
uint32_t | player0bufsize, | ||
uint32_t | player1bufsize | ||
) |
Set Audio Library Mode to Music Player.
This API has same function as setPlayerMode(device). But you can set buffer size of players.
device | Select output device. AS_SETPLAYER_OUTPUTDEVICE_SPHP or AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT. |
player0bufsize | Buffer size of player 0. Must be n > 0. |
player1bufsize | Buffer size of player 1. Must be n > 0. |
err_t AudioClass::setPlayerMode | ( | uint8_t | device, |
uint8_t | sp_drv | ||
) |
Set Audio Library Mode to Music Player.
This function works as same as "setPlayerMode(uint8_t)", but you are able to set speaker drive mode by parameter "sp_drv". If you would like to set speaker drive mode, use this API instead of setPlayerMode(uint8_t).
device | Select output device. AS_SETPLAYER_OUTPUTDEVICE_SPHP or AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT. |
sp_drv | Select audio speaker driver mode. AS_SP_DRV_MODE_LINEOUT or AS_SP_DRV_MODE_1DRIVER or AS_SP_DRV_MODE_2DRIVER or AS_SP_DRV_MODE_4DRIVER |
err_t AudioClass::setPlayerMode | ( | uint8_t | device, |
uint8_t | sp_drv, | ||
uint32_t | player0bufsize, | ||
uint32_t | player1bufsize | ||
) |
Set Audio Library Mode to Music Player.
This API has same function as setPlayerMode(device, sp_drv). But you can set buffer size of players.
device | Select output device. AS_SETPLAYER_OUTPUTDEVICE_SPHP or AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT. |
sp_drv | Select audio speaker driver mode. AS_SP_DRV_MODE_LINEOUT or AS_SP_DRV_MODE_1DRIVER or AS_SP_DRV_MODE_2DRIVER or AS_SP_DRV_MODE_4DRIVER |
player0bufsize | Buffer size of player 0. Must be n > 0. |
player1bufsize | Buffer size of player 1. Must be n > 0. |
err_t AudioClass::setRecorderMode | ( | uint8_t | input_device | ) |
Set Audio Library Mode to Sound Recorder.
This function switches the mode of the Audio library to Sound Recorder. For mode details, follow the state transition chart on the developer guide.
This function cannot be called after transition to "Sound Recorder mode". To return to the original state, please call setReadyMode ().
In this function, setting HW necessary for sound recording, and setting ES buffer configuration etc.
The type of MIC is determined by configuration of sdk. The default is an analog microphone. The value of CXD56_AUDIO_MIC_CHANNEL_SEL can be used to select the analog microphone or digital microphone and assign the microphone channel. Refer to the document for the setting value. If you change the settings, import sdk again.
Recording Mic-gain is 0dB fixed.
input_device | Set AS_SETRECDR_STS_INPUTDEVICE_MIC. |
err_t AudioClass::setRecorderMode | ( | uint8_t | input_device, |
int32_t | input_gain | ||
) |
Set Audio Library Mode to Sound Recorder.
This function works as same as "setRecorderMode(uint8_t)", but you are able to set Mic-gain by parameter "mic_gain". If you would like to set recording mic-gain, use this API instead of setRecorderMode(uint8_t).
input_device | Set AS_SETRECDR_STS_INPUTDEVICE_MIC. |
input_gain | Input gain : value range Analog Mic 0:0dB, 5:+0.5dB, ... , 210:+21.0dB (Max is 21dB.) Digital Mic -7850:-78.50dB, ... , -5:-0.05dB, 0:0dB (Max is 0dB.) set #AS_MICGAIN_HOLD is keep setting. |
err_t AudioClass::setRecorderMode | ( | uint8_t | input_device, |
int32_t | input_gain, | ||
uint32_t | bufsize | ||
) |
Set Audio Library Mode to Sound Recorder.
This function works as same as "setRecorderMode(input_device, input_gain)", But you can set buffer size of recorder.
input_device | Set AS_SETRECDR_STS_INPUTDEVICE_MIC. |
input_gain | Input gain : value range Analog Mic 0:0dB, 5:+0.5dB, ... , 210:+21.0dB (Max is 21dB.) Digital Mic -7850:-78.50dB, ... , -5:-0.05dB, 0:0dB (Max is 0dB.) set #AS_MICGAIN_HOLD is keep setting. |
bufsize | Buffer size of recorder. |
err_t AudioClass::setRecorderMode | ( | uint8_t | input_device, |
int32_t | input_gain, | ||
uint32_t | bufsize, | ||
bool | is_digital | ||
) |
Set Audio Library Mode to Sound Recorder.
This function works as same as "setRecorderMode(input_device, input_gain, bufsize)", But you can set buffer size of recorder.
input_device | Set AS_SETRECDR_STS_INPUTDEVICE_MIC. |
input_gain | Input gain : value range Analog Mic 0:0dB, 5:+0.5dB, ... , 210:+21.0dB (Max is 21dB.) Digital Mic -7850:-78.50dB, ... , -5:-0.05dB, 0:0dB (Max is 0dB.) set #AS_MICGAIN_HOLD is keep setting. |
bufsize | Buffer size of recorder. |
is_digital | Select mic type. true:Digital, false:Analog. |
err_t AudioClass::setThroughMode | ( | ThroughInput | input, |
ThroughI2sOut | i2s_out, | ||
bool | sp_out, | ||
int32_t | input_gain, | ||
uint8_t | sp_drv | ||
) |
Set Audio Library Mode to BaseBand Through.
This function switches the mode of the Audio library to the Baseband through state. (For low power, low latency, small memory)
For mode details, follow the state transition chart on the developer guide. You can chose input and I2S output data, but speaker output is always mixer data. And, in this mode, output starts as soon as the state changes. This function cannot be called after transition to "BaseBand Through mode". To return to the original state, please call setReadyMode ().
input | Set input source. Use ThroughInput enum type. |
i2s_out | Set I2S output source. Use ThroughI2sOut enum type. |
sp_out | sp_out : Use speaker output. |
input_gain | Input gain : value range Analog Mic 0:0dB, 5:+0.5dB, ... , 210:+21.0dB (Max is 21dB.) Digital Mic -7850:-78.50dB, ... , -5:-0.05dB, 0:0dB (Max is 0dB.) set #AS_MICGAIN_HOLD is keep setting. |
sp_drv | Select audio speaker driver mode. AS_SP_DRV_MODE_LINEOUT or AS_SP_DRV_MODE_1DRIVER or AS_SP_DRV_MODE_2DRIVER or AS_SP_DRV_MODE_4DRIVER |
err_t AudioClass::setReadyMode | ( | void | ) |
Set Audio Library Mode to Ready.
This function switches the mode of the Audio library to the initial state. For mode details, follow the state transition chart on the developer guide.
This function cannot be called after transition to "Ready mode". Immediately after boot, it is in Ready mode.
In this function, we will release resources which used in each mode, change HW to the standby state, etc.
Initialize player.
This function initializes and sets Player action. When player do not play music, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
id | Select Player ID. |
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
channel | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t AudioClass::initPlayer | ( | PlayerId | id, |
uint8_t | codec, | ||
uint32_t | fs, | ||
uint8_t | bitlen, | ||
uint8_t | channel | ||
) |
Initialize player.
This function initializes and sets Player action. When player do not play music, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
id | Select Player ID. |
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
bitlen | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t AudioClass::initPlayer | ( | PlayerId | id, |
uint8_t | codec, | ||
const char * | codec_path, | ||
uint32_t | fs, | ||
uint8_t | channel | ||
) |
Initialize player.
This function initializes and sets Player action. When player do not play music, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
id | Select Player ID. |
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP Binary path. Maximum length is 24 bytes. |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
channel | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t AudioClass::initPlayer | ( | PlayerId | id, |
uint8_t | codec, | ||
const char * | codec_path, | ||
uint32_t | fs, | ||
uint8_t | bitlen, | ||
uint8_t | channel | ||
) |
Initialize player.
This function initializes and sets Player action. When player do not play music, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
id | Select Player ID. |
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP Binary path. Maximum length is 24 bytes. |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
bitlen | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t AudioClass::initRecorder | ( | uint8_t | codec, |
uint32_t | fs, | ||
uint8_t | channel | ||
) |
Initialize recorder.
This function initializes and sets Recorder action. When recorder do not start, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
channel | Set channnel number. AS_CHANNEL_MONO, AS_CHANNEL_STEREO, AS_CHANNEL_4CH, or etc... |
err_t AudioClass::initRecorder | ( | uint8_t | codec, |
uint32_t | fs, | ||
uint8_t | bitlen, | ||
uint8_t | channel | ||
) |
Initialize recorder.
This function initializes and sets Recorder action. When recorder do not start, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
bitlen | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel | Set channnel number. AS_CHANNEL_MONO, AS_CHANNEL_STEREO, AS_CHANNEL_4CH, or etc... |
err_t AudioClass::initRecorder | ( | uint8_t | codec, |
const char * | codec_path, | ||
uint32_t | fs, | ||
uint8_t | channel | ||
) |
Initialize recorder.
This function initializes and sets Recorder action. When recorder do not start, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP Binary path. Maximum length is 24 bytes. |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
channel | Set channnel number. AS_CHANNEL_MONO, AS_CHANNEL_STEREO, AS_CHANNEL_4CH, or etc... |
err_t AudioClass::initRecorder | ( | uint8_t | codec, |
const char * | codec_path, | ||
uint32_t | fs, | ||
uint8_t | bitlen, | ||
uint8_t | channel | ||
) |
Initialize recorder.
This function initializes and sets Recorder action. When recorder do not start, you can call it as many times as you like.
By this function,
If you would like to set codec binary path and bit length of audio data, You are able to set them by other type of this API. Default values of them are /mnt/sd0/BIN and AS_BITLENGTH_16(16bit).
codec | Select compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP Binary path. Maximum length is 24 bytes. |
fs | Set sampling rate. AS_SAMPLINGRATE_XXXXX. |
bitlen | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel | Set channnel number. AS_CHANNEL_MONO, AS_CHANNEL_STEREO, AS_CHANNEL_4CH, or etc... |
Start Player.
This function starts Player. Once you call this function, the Player will be in the active state, so you can not call it until you call StopPlayer.
When Player is started, it starts reading the data for the Access Unit[ from the stream data buffer. Therefore, in order to start Player, it is necessary to supply Stream Data to the stream buffer beforehand. Be sure to call writeFrames before startPlay. If you execute without calling * writeFrames, ES_UNDER_FLOW_ERR will be occurs.
id | Select Player ID. |
err_t AudioClass::startRecorder | ( | void | ) |
Start Recorder.
This function starts Recorder. Once you call this function, the Recorder will be in the active state, so you can not call it until you call StopRecorder. And, in the case of WAV data, it is necessary to create a Wav Header at the beginning of the file, you need to call writeWavHeader function at first.
Stop Player.
This function stops Player. The function can be called only when called startPlayer and changed to the Playing state.
When stop player, it read Stream Data until the last frame, and stops. The next API will not be accepted until the audio output stops completely. (it takes about 100 ms).
id | Select Player ID. |
Stop Player (mode specified)
This function stops Player with specified mode.
You can set stop mode. If you would like to stop player immediately, set mode to AS_STOPPLAYER_NORMAL. If you don't set mode, player stops after all of audio data in buffer is going out.
id | Select Player ID. |
mode | Stop mode. AS_STOPPLAYER_NORMAL, AS_STOPPLAYER_ESEND |
err_t AudioClass::stopRecorder | ( | void | ) |
Stop Recorder.
This function stops Recorder. The function can be called only when called startRecorder and changed to the Recording state.
When stop the Recorder, stop the audio capture and write until the last captured audio data. If this function return, the recording process had ended.
err_t AudioClass::setBeep | ( | char | enable, |
short | volume, | ||
short | frequency | ||
) |
Set Beep Sound.
This function sets beep sound. Beep sound On / Off, volume, pitch (frequency) can be configured. It can call on PlayerMode or ReadyMode status.
enable | Set beep sound On/Off. enable(On) = 1, disable(Off) = 0. |
volume | Set beep sound volume. -90(db) - 0(db) can be set. 0db is Maximum amplitude. |
frequency | Set beep sound. frequency (pitch). Set the frequency value as it is. (example, 1000 is 1kHz sound) |
err_t AudioClass::setVolume | ( | int | volume | ) |
Set Player Volume.
This function can set the volume when playing the player. It can be called on PlayerMode.
volume | Set the master volume. Range of volume is -1020(-102db) - 120(12db). A value larger than 0 may distort the sound. |
err_t AudioClass::setVolume | ( | int | master, |
int | player0, | ||
int | player1 | ||
) |
Set Player Volume.
This function can set the volume when playing the player. It can be called on PlayerMode.
master | Set the master volume. Range of volume is -1020(-102db) - 120(12db). A value larger than 0 may distort the sound. |
player0 | Set the player0 volume. Range of volume is -1020(-102db) - 120(12db). This value is before Mixing. |
player1 | Set the player1 volume. Range of volume is -1020(-102db) - 120(12db). This value is before Mixing. |
Set Player L/R Gain.
This function can set the Left and Right channel gain for Player playback. It can be executed with PlayerMode. If you do not call this, the sound is original.
id | Select Player ID. |
l_gain | Set left gain. 0(%) - 200(%) can be set. 100% is orignal and a value larger than 100 may distort the sound. |
r_gain | Set right gain. 0(%) - 200(%) can be set. 100% is orignal and a value larger than 100 may distort the sound. |
Write Stream Data from a file to FIFO by some frames.(now 5 frames)
APIs for Player Mode
This function writes from the audio file specified by the File class to the Stream data FIFO in the Audio library. It writes for several frames data (now five frames). It can be called on PlayerMode.
This FIFO is cleared when calling StopPlayer or setReadyMode.
During music playback, please call this function periodically. When an error occurs, you should error handling as properly
id | Select Player ID. |
myfile | Specify an instance of the File class of the audio file. |
Write Stream Data from a file to FIFO by some frames.(now 5 frames)
This function writes from the audio file specified by the File class to the Stream data FIFO in the Audio library. It writes for several frames data (now five frames). It can be called on PlayerMode.
This FIFO is cleared when calling StopPlayer or setReadyMode.
During music playback, please call this function periodically. When an error occurs, you should error handling as properly
id | Select Player ID. |
fd | file pointer of the audio file. |
Write Stream Data from buffer.
This function writes from the buffer to the Stream data FIFO in the Audio library. It writes for several frames data (now five frames). It can be called on PlayerMode.
This FIFO is cleared when calling StopPlayer or setReadyMode.
During music playback, please call this function periodically. When an error occurs, you should error handling as properly
data | Select Player ID. |
write_size | Buffer address of the audio data. Size of the audio data. |
Write WAV Header.
APIs for Recorder Mode
This function should call when file format is WAV file recording. When codec of InitRecoder is "wav", be sure to call it before StartRecoder. Do not call it if other codecs are selected.
myFile | Specify an instance of the File class of the audio file. |
Read Stream Data from FIFO to a file by some frames.(now 5 frames)
This function reads the generated Stream data from the Stream FIFO into the file specified by the File class. It reads for several frames data (now five frames). It can be called on RecorderMode.
During sound recording, please call this function periodically.
myFile | Specify an instance of the File class of the audio file. |
Close Outputfile.
This function do closing processing on the file in which stream is written. Be sure to call it after calling StopRecorder. It can be called on RecorderMode.
myFile | Specify an instance of the File class of the audio file. |
err_t AudioClass::readFrames | ( | char * | p_buffer, |
uint32_t | buffer_size, | ||
uint32_t * | read_size | ||
) |
Read Stream Data from FIFO to a file by some frames.(now 5 frames)
This function reads the generated Stream data from the Stream FIFO into the specified buffer area.
This function is for you want to process sounds in applications.
It reads for several frames data (now five frames). It can be called on RecorderMode.
During sound recording, please call this function periodically.
p_buffer | Address of buffer area. |
buffer_size | Buffer size.(byte) |
read_size | Read size.(byte) |
err_t AudioClass::setRenderingClockMode | ( | AsClkMode | mode | ) |
Set Rendering clock mode.
This function sets the internal data rate mode of rendering to Normal or High Resolution.
The internal data rate Normal indicates "fs = 48 kHz" and High Resolution indicates "fs = 192 kHz".
Please call the function in Ready Mode. Ready Mode is either after calling bigin () or after calling setReadyMode ().
The default when not calling is Normal.
mode | Mode of rendering clock. |
|
inline |
Get recording ES size.
This function gets recording elementary stream size.