ARMEBS4  revision-26.06.2015
Enumerations | Functions
Audio
Collaboration diagram for Audio:

Enumerations

enum  note_e
 

Functions

status_e Audio_Init (uint32_t fs, uint32_t sample_size)
 Audio initialization. More...
 
status_e Audio_PlaySin (uint16_t freq, uint16_t duration)
 Play a sine sound at a given frequency. More...
 
status_e Audio_SetVolumeSpeaker (uint8_t volume)
 Set the volume for speaker output. More...
 
status_e Audio_SetVolumeHeadphone (uint8_t volume)
 Set the volume for headphone output. More...
 
status_e Audio_Record (int16_t *dataBuf, uint32_t length)
 Record a sound (polling mode) More...
 
status_e Audio_Play (const int16_t *dataBuf, uint32_t length)
 Play a sound (polling mode) More...
 
status_e Audio_DMA_Play (const void *data, uint32_t length, void(*done)(const void *))
 Play a sound (DMA version) More...
 
status_e Audio_DMA_Play_Status (void)
 Is Audio_DMA_Play finished? More...
 
status_e Audio_Stream_Play_Init (uint32_t length, void *buffer0, void *buffer1, void(*done)(const void *))
 Audio stream play initialization. More...
 
status_e Audio_Stream_Play (const void *data)
 Audio stream play buffer. More...
 
status_e Audio_Stream_Play_Pause (void)
 Audio stream play pause. More...
 
status_e Audio_Stream_Play_Stop (void)
 Audio stream playing stop. More...
 
status_e Audio_Stream_Play_Status (void)
 Is Audio_Stream_Play ready for the next buffer? More...
 
status_e Audio_Stream_Record_Init (uint32_t length, void *buffer0, void *buffer1, void(*done)(const void *))
 Audio stream record initialization. More...
 
status_e Audio_Stream_Record_Stop (void)
 Audio stream record stop. More...
 
status_e AudioSTM32_Play (const int16_t *dataBuf, uint32_t length)
 Play a sound (polling mode) More...
 
status_e AudioSTM32_Stream_Play_Init (uint32_t length, void *buffer0, void *buffer1, void(*done)(const void *))
 Audio stream initialization. More...
 
status_e AudioSTM32_Stream_Play (const void *data)
 Audio stream play buffer. More...
 
status_e AudioSTM32_Stream_Play_Stop (void)
 Audio stream stop. More...
 
status_e AudioSTM32_Stream_Play_Status (void)
 Is AudioSTM32_Stream_Play ready for the next buffer? More...
 

Detailed Description

== Full-duplex notes == Full duplex is possible usint Audio_Stream_* function.

Enumeration Type Documentation

enum note_e

Music notes

Definition at line 193 of file audio.h.

Function Documentation

status_e Audio_Init ( uint32_t  fs,
uint32_t  sample_size 
)

Audio initialization.

Parameters
fsthe sampling frequency (96000,48000,44100,32000,16000,8000)
sample_size(32,24 or 16 bit)
Returns
NO_ERROR for no problem

Definition at line 140 of file audio.c.

References Audio_SetVolumeHeadphone(), Audio_SetVolumeSpeaker(), ERROR_BAD_PARAM, NO_ERROR, and setup.

Here is the call graph for this function:

status_e Audio_PlaySin ( uint16_t  freq,
uint16_t  duration 
)

Play a sine sound at a given frequency.

Parameters
freqFrequency of sine.
See also
note_e
Parameters
durationduration in milliseconds
Returns
NO_ERROR for no problem

Definition at line 184 of file audio.c.

References gen_sine_wave_float(), init_sine_wave_float(), NO_ERROR, setup, time_elapsed(), and time_set_timeout_ms().

Here is the call graph for this function:

status_e Audio_SetVolumeSpeaker ( uint8_t  volume)

Set the volume for speaker output.

Parameters
volumeVolume to set (0 is mute, 255 is max)
Returns
NO_ERROR for no problem

Definition at line 240 of file audio.c.

Referenced by Audio_Init().

Here is the caller graph for this function:

status_e Audio_SetVolumeHeadphone ( uint8_t  volume)

Set the volume for headphone output.

Parameters
volumeVolume to set (0 is mute, 255 is max) *
Returns
NO_ERROR for no problem

Definition at line 245 of file audio.c.

Referenced by Audio_Init().

Here is the caller graph for this function:

status_e Audio_Record ( int16_t *  dataBuf,
uint32_t  length 
)

Record a sound (polling mode)

Parameters
dataBufData buffer of sound to record
lengthbyte length of the buffer
Returns
NO_ERROR for no problem

Definition at line 235 of file audio.c.

status_e Audio_Play ( const int16_t *  dataBuf,
uint32_t  length 
)

Play a sound (polling mode)

Parameters
dataBufData buffer of sound to record
lengthbyte length of the buffer
Returns
NO_ERROR for no problem

Definition at line 230 of file audio.c.

References AudioSTM32_Play().

Here is the call graph for this function:

status_e Audio_DMA_Play ( const void *  data,
uint32_t  length,
void(*)(const void *)  done 
)

Play a sound (DMA version)

Parameters
datathe buffer
lengthbyte length of the buffer
done_handlerFunction to be called when the sound has finished (will be called from interrupt context), can be NULL.
Returns
NO_ERROR for no problem, ERROR_AGAIN when busy, another error if any
See also
Audio_DMA_Play_Status

Definition at line 45 of file audio_dma.c.

References Audio_Stream_Play_Init(), and NO_ERROR.

Here is the call graph for this function:

status_e Audio_DMA_Play_Status ( void  )

Is Audio_DMA_Play finished?

Returns
ERROR_AGAIN if the sound has not finished playing, NO_ERROR when finished
See also
Audio_DMA_Play

Definition at line 60 of file audio_dma.c.

References ERROR_AGAIN, and NO_ERROR.

status_e Audio_Stream_Play_Init ( uint32_t  length,
void *  buffer0,
void *  buffer1,
void(*)(const void *)  done 
)

Audio stream play initialization.

Parameters
lengthbyte length of each buffer
buffer0the first buffer to be played
buffer1the second buffer to be played
donethe handler called after a buffer has been played. Called in interrupt context. can be NULL if not used
Returns
NO_ERROR for no problem
Warning
buffer0 and buffer1 are expected to exist until
See also
Audio_Stream_Play_Stop

The DMA will play alternatively buffer0 and buffer1.

See also
Audio_Stream_Play will be used to replace the next buffer.

The stream will be Paused after this function

Definition at line 97 of file audio.c.

References AudioSTM32_Stream_Play_Init().

Referenced by Audio_DMA_Play().

Here is the call graph for this function:

Here is the caller graph for this function:

status_e Audio_Stream_Play ( const void *  data)

Audio stream play buffer.

Parameters
databuffer to be played
Returns
NO_ERROR for no problem
See also
Audio_Stream_Status
Warning
This function will block unless Audio_Stream_Play_Status has returned NO_ERROR

Definition at line 117 of file audio.c.

References AudioSTM32_Stream_Play().

Here is the call graph for this function:

status_e Audio_Stream_Play_Pause ( void  )

Audio stream play pause.

Returns
NO_ERROR for no problem
See also
Audio_Stream_Play for (re-)starting playback

This function will in fact fill the output buffers with zeroes, effectively muting the output.

Definition at line 112 of file audio.c.

status_e Audio_Stream_Play_Stop ( void  )

Audio stream playing stop.

Returns
NO_ERROR for no problem

Definition at line 102 of file audio.c.

References AudioSTM32_Stream_Play_Stop().

Here is the call graph for this function:

status_e Audio_Stream_Play_Status ( void  )

Is Audio_Stream_Play ready for the next buffer?

Returns
ERROR_AGAIN if not ready, NO_ERROR when ready
See also
Audio_DMA_Play

Definition at line 107 of file audio.c.

References AudioSTM32_Stream_Play_Status().

Here is the call graph for this function:

status_e Audio_Stream_Record_Init ( uint32_t  length,
void *  buffer0,
void *  buffer1,
void(*)(const void *)  done 
)

Audio stream record initialization.

Parameters
lengthbyte length of each buffer
buffer0the first buffer to be played
buffer1the second buffer to be played
donehandler called with the data recorded. Called in interrupt context
Returns
NO_ERROR for no problem
Warning
buffer0 and buffer1 are expected to exist until
See also
Audio_Stream_Record_Stop

The DMA will record alternatively into buffer0 and buffer1.

Definition at line 122 of file audio.c.

status_e Audio_Stream_Record_Stop ( void  )

Audio stream record stop.

Returns
NO_ERROR for no problem

Definition at line 127 of file audio.c.

status_e AudioSTM32_Play ( const int16_t *  dataBuf,
uint32_t  length 
)

Play a sound (polling mode)

Parameters
dataBufData buffer of sound to record
lengthbyte length of the buffer
Returns
NO_ERROR for no problem

Definition at line 523 of file audio_stm32.c.

References NO_ERROR.

Referenced by Audio_Play().

Here is the caller graph for this function:

status_e AudioSTM32_Stream_Play_Init ( uint32_t  length,
void *  buffer0,
void *  buffer1,
void(*)(const void *)  done 
)

Audio stream initialization.

Parameters
lengthbyte length of each buffer
buffer0the first buffer to be played
buffer1the second buffer to be played
Returns
NO_ERROR for no problem
Warning
buffer0 and buffer1 are expected to exist until
See also
AudioSTM32_Stream_Stop

The DMA will play alternatively buffer0 and buffer1.

See also
AudioSTM32_Stream_Play will be used to replace the next buffer.

Definition at line 403 of file audio_stm32.c.

References dma_xfer_t::data, dma_play_xfer, dma_xfer_t::done, ERROR_BAD_ALIGN, ERROR_BAD_PARAM, ERROR_BAD_STATE, memset(), and NO_ERROR.

Referenced by Audio_Stream_Play_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

status_e AudioSTM32_Stream_Play ( const void *  data)

Audio stream play buffer.

Parameters
databuffer to be played
Returns
NO_ERROR for no problem
See also
AudioSTM32_Stream_Status
Warning
This function is blocking unless AudioSTM32_Stream_Status has returned NO_ERROR

Definition at line 479 of file audio_stm32.c.

References AudioSTM32_Stream_Play_Status(), dma_play_xfer, ERROR_AGAIN, memcpy(), and NO_ERROR.

Referenced by Audio_Stream_Play().

Here is the call graph for this function:

Here is the caller graph for this function:

status_e AudioSTM32_Stream_Play_Stop ( void  )

Audio stream stop.

Returns
NO_ERROR for no problem

Definition at line 462 of file audio_stm32.c.

References NO_ERROR.

Referenced by Audio_Stream_Play_Stop().

Here is the caller graph for this function:

status_e AudioSTM32_Stream_Play_Status ( void  )

Is AudioSTM32_Stream_Play ready for the next buffer?

Returns
ERROR_AGAIN if not ready, NO_ERROR when ready
See also
AudioSTM32_DMA_Play

Definition at line 469 of file audio_stm32.c.

References dma_play_xfer, ERROR_AGAIN, and NO_ERROR.

Referenced by Audio_Stream_Play_Status(), and AudioSTM32_Stream_Play().

Here is the caller graph for this function: