Atmel Software Framework

audio_mixer.h File Reference
#include <stddef.h>
#include "compiler.h"

Macros

#define audio_mixer_close(...)   audio_mixer_close_direct(__VA_ARGS__)
 
#define audio_mixer_create_buffers(...)   audio_mixer_create_buffers_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_decrease_volume(...)   audio_mixer_dacs_decrease_volume_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_flush(...)   audio_mixer_dacs_flush_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_get_volume(...)   audio_mixer_dacs_get_volume_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_increase_volume(...)   audio_mixer_dacs_increase_volume_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_input(...)   audio_mixer_dacs_input_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_is_volume_muted(...)   audio_mixer_dacs_is_volume_muted_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_output(...)   audio_mixer_dacs_output_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_set_volume(...)   audio_mixer_dacs_set_volume_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_setup(...)   audio_mixer_dacs_setup_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_start(...)   audio_mixer_dacs_start_direct(__VA_ARGS__)
 
#define audio_mixer_dacs_stop(...)   audio_mixer_dacs_stop_direct(__VA_ARGS__)
 
#define audio_mixer_disable_dacs(...)   audio_mixer_disable_dacs_direct(__VA_ARGS__)
 
#define audio_mixer_enable_dacs(...)   audio_mixer_enable_dacs_direct(__VA_ARGS__)
 
#define audio_mixer_get_buffer(...)   audio_mixer_get_buffer_direct(__VA_ARGS__)
 
#define audio_mixer_mute_audio(...)   audio_mixer_mute_audio_direct(__VA_ARGS__)
 

Functions

void audio_mixer_close_direct (void)
 Close the audio_mixer. More...
 
bool audio_mixer_create_buffers_direct (uint8_t nb_buffers, size_t buffer_size)
 Creates DAC buffers. More...
 
void audio_mixer_dacs_decrease_volume_direct (void)
 Decreases the output volume of the DACs. More...
 
void audio_mixer_dacs_flush_direct (bool force)
 Flushes the sample buffer being output to the DACs. More...
 
uint8_t audio_mixer_dacs_get_volume_direct (void)
 Get the average volume of the DACs.
The value returned is in the range 0; 255 where 255 corresponds to the highest volume. More...
 
void audio_mixer_dacs_increase_volume_direct (void)
 Increases the output volume of the DACs. More...
 
bool audio_mixer_dacs_input_direct (void *sample_buffer, size_t sample_length)
 Inputs a sample buffer from the ADCs. More...
 
bool audio_mixer_dacs_is_volume_muted_direct (void)
 Checks if the volume is muted or un-muted.
. More...
 
bool audio_mixer_dacs_output_direct (void *sample_buffer, size_t sample_length)
 Outputs a sample buffer to the DACs. More...
 
void audio_mixer_dacs_set_volume_direct (uint8_t volume)
 set the average volume of the DACs.
More...
 
void audio_mixer_dacs_setup_direct (uint32_t sample_rate_hz, uint8_t num_channels, uint8_t bits_per_sample, bool swap_channels)
 Sets the DACs up with new settings. More...
 
void audio_mixer_dacs_start_direct (uint32_t sample_rate_hz, uint8_t num_channels, uint8_t bits_per_sample, bool swap_channels)
 Starts the DACs. More...
 
void audio_mixer_dacs_stop_direct (void)
 Stops the DACs. More...
 
void audio_mixer_disable_dacs_direct (uint32_t dacs_mask)
 Disables the handling of the specified DACs by the audio mixer. More...
 
void audio_mixer_enable_dacs_direct (uint32_t dacs_mask)
 Enables the handling of the specified DACs by the audio mixer. More...
 
void * audio_mixer_get_buffer_direct (size_t size)
 This functions returns a NULL pointer when no buffer are free, else returns a free temporary buffer. More...
 
void audio_mixer_mute_audio_direct (bool mute)
 Mute Audio if True. More...
 

#define audio_mixer_close (   ...)    audio_mixer_close_direct(__VA_ARGS__)

Referenced by play_mp3(), and play_wav().

#define audio_mixer_create_buffers (   ...)    audio_mixer_create_buffers_direct(__VA_ARGS__)

Referenced by play_mp3(), and play_wav().

#define audio_mixer_dacs_decrease_volume (   ...)    audio_mixer_dacs_decrease_volume_direct(__VA_ARGS__)

Referenced by playback_task().

#define audio_mixer_dacs_flush (   ...)    audio_mixer_dacs_flush_direct(__VA_ARGS__)

Referenced by output(), play_mp3(), and play_wav().

#define audio_mixer_dacs_get_volume (   ...)    audio_mixer_dacs_get_volume_direct(__VA_ARGS__)

Referenced by playback_task().

#define audio_mixer_dacs_increase_volume (   ...)    audio_mixer_dacs_increase_volume_direct(__VA_ARGS__)

Referenced by playback_task().

#define audio_mixer_dacs_input (   ...)    audio_mixer_dacs_input_direct(__VA_ARGS__)
#define audio_mixer_dacs_is_volume_muted (   ...)    audio_mixer_dacs_is_volume_muted_direct(__VA_ARGS__)

Referenced by play_wav().

#define audio_mixer_dacs_output (   ...)    audio_mixer_dacs_output_direct(__VA_ARGS__)
#define audio_mixer_dacs_set_volume (   ...)    audio_mixer_dacs_set_volume_direct(__VA_ARGS__)

Referenced by com_task().

#define audio_mixer_dacs_setup (   ...)    audio_mixer_dacs_setup_direct(__VA_ARGS__)

Referenced by output(), and play_wav().

#define audio_mixer_dacs_start (   ...)    audio_mixer_dacs_start_direct(__VA_ARGS__)

Referenced by main().

#define audio_mixer_dacs_stop (   ...)    audio_mixer_dacs_stop_direct(__VA_ARGS__)
#define audio_mixer_disable_dacs (   ...)    audio_mixer_disable_dacs_direct(__VA_ARGS__)
#define audio_mixer_enable_dacs (   ...)    audio_mixer_enable_dacs_direct(__VA_ARGS__)

Referenced by main().

#define audio_mixer_get_buffer (   ...)    audio_mixer_get_buffer_direct(__VA_ARGS__)

Referenced by output(), and play_wav().

#define audio_mixer_mute_audio (   ...)    audio_mixer_mute_audio_direct(__VA_ARGS__)

void audio_mixer_close_direct ( void  )

Close the audio_mixer.

References audio_mixer_dacs_settings, i, and NULL.

bool audio_mixer_create_buffers_direct ( uint8_t  nb_buffers,
size_t  buffer_size 
)

Creates DAC buffers.

References audio_mixer_dacs_settings, buffers, i, j, and nb_buffers.

void audio_mixer_dacs_decrease_volume_direct ( void  )

Decreases the output volume of the DACs.

Note
The DACs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, and i.

void audio_mixer_dacs_flush_direct ( bool  force)

Flushes the sample buffer being output to the DACs.

Parameters
forceForce flushing means do not wait until all samples have been played before flushing the DAC.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, and i.

Referenced by audio_speaker_set_sample_freq(), buff_player_dacs_flush(), player_shutdown(), and usb_stream_new_sample_rate().

uint8_t audio_mixer_dacs_get_volume_direct ( void  )

Get the average volume of the DACs.
The value returned is in the range 0; 255 where 255 corresponds to the highest volume.

Note
The DACs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, count, i, and volume.

void audio_mixer_dacs_increase_volume_direct ( void  )

Increases the output volume of the DACs.

Note
The DACs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, and i.

bool audio_mixer_dacs_input_direct ( void *  sample_buffer,
size_t  sample_length 
)

Inputs a sample buffer from the ADCs.

Note
The ADCs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, i, and input.

bool audio_mixer_dacs_is_volume_muted_direct ( void  )

Checks if the volume is muted or un-muted.
.

Note
The DACs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, count, and i.

bool audio_mixer_dacs_output_direct ( void *  sample_buffer,
size_t  sample_length 
)
void audio_mixer_dacs_set_volume_direct ( uint8_t  volume)

set the average volume of the DACs.

Note
The DACs must have been started beforehand.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, count, and i.

Referenced by audio_speaker_set_mute(), and audio_speaker_set_volume().

void audio_mixer_dacs_setup_direct ( uint32_t  sample_rate_hz,
uint8_t  num_channels,
uint8_t  bits_per_sample,
bool  swap_channels 
)
void audio_mixer_dacs_stop_direct ( void  )
void audio_mixer_disable_dacs_direct ( uint32_t  dacs_mask)

Disables the handling of the specified DACs by the audio mixer.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_dacs_settings, audio_mixer_enabled_dacs_mask, and i.

void audio_mixer_enable_dacs_direct ( uint32_t  dacs_mask)

Enables the handling of the specified DACs by the audio mixer.

References audio_mixer_dacs_settings, audio_mixer_dacs_start_direct(), and audio_mixer_enabled_dacs_mask.

void* audio_mixer_get_buffer_direct ( size_t  size)

This functions returns a NULL pointer when no buffer are free, else returns a free temporary buffer.

References audio_mixer_dacs_output, audio_mixer_dacs_settings, buffer, and NULL.

void audio_mixer_mute_audio_direct ( bool  mute)

Mute Audio if True.

Parameters
muteSet to true to mute the audio stream.
Set to false otherwise.

References AUDIO_MIXER_CODEC_COUNT, AUDIO_MIXER_DACS, audio_mixer_enabled_dacs_mask, and i.

Referenced by buff_player_mute_audio().