Lumiera  0.pre.03
»edityourfreedom«
alsa.c File Reference

Go to the source code of this file.

Description

Example implementation how to access the ALSA sound backend.

Definition in file alsa.c.

#include "alsa.h"
#include <alsa/asoundlib.h>

Functions

void audio_init ()
 
size_t audio_offset ()
 
void audio_start (unsigned int rate, unsigned int channel_count)
 
void audio_stop ()
 
size_t audio_write (const void *data, size_t amount)
 

Variables

static int audio_initialised
 
static snd_pcm_sframes_t buffer_size
 
static snd_pcm_sframes_t delay
 
static snd_pcm_hw_params_t * hw_params
 
static snd_pcm_t * playback_handle
 
static unsigned int rate
 
static snd_pcm_sw_params_t * sw_params
 
static snd_pcm_sframes_t written
 

Function Documentation

◆ audio_offset()

size_t audio_offset ( )

Definition at line 46 of file alsa.c.

References delay, playback_handle, and written.

◆ audio_init()

void audio_init ( )

Definition at line 54 of file alsa.c.

References audio_initialised, buffer_size, hw_params, lib::meta::min(), playback_handle, rate, and sw_params.

Referenced by audio_start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ audio_write()

size_t audio_write ( const void *  data,
size_t  amount 
)

Definition at line 130 of file alsa.c.

References playback_handle, and written.

Referenced by main().

+ Here is the caller graph for this function:

◆ audio_start()

void audio_start ( unsigned int  rate,
unsigned int  channel_count 
)

Definition at line 163 of file alsa.c.

References audio_init(), and playback_handle.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ audio_stop()

void audio_stop ( )

Definition at line 171 of file alsa.c.

References playback_handle.

Referenced by main().

+ Here is the caller graph for this function:

Variable Documentation

◆ playback_handle

snd_pcm_t* playback_handle
static

Definition at line 33 of file alsa.c.

Referenced by audio_init(), audio_offset(), audio_start(), audio_stop(), and audio_write().

◆ sw_params

snd_pcm_sw_params_t* sw_params
static

Definition at line 34 of file alsa.c.

Referenced by audio_init().

◆ hw_params

snd_pcm_hw_params_t* hw_params
static

Definition at line 35 of file alsa.c.

Referenced by audio_init().

◆ buffer_size

snd_pcm_sframes_t buffer_size
static

Definition at line 36 of file alsa.c.

Referenced by audio_init().

◆ written

snd_pcm_sframes_t written
static

Definition at line 38 of file alsa.c.

Referenced by audio_offset(), and audio_write().

◆ delay

snd_pcm_sframes_t delay
static

Definition at line 39 of file alsa.c.

Referenced by audio_offset().

◆ rate

unsigned int rate
static

Definition at line 41 of file alsa.c.

Referenced by audio_init().

◆ audio_initialised

int audio_initialised
static

Definition at line 43 of file alsa.c.

Referenced by audio_init().