libsent/src/adin/adin_mic_linux_alsa.c File Reference

Microphone input on Linux/ALSA. More...

#include <sent/stddefs.h>
#include <sent/adin.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <alsa/asoundlib.h>

Include dependency graph for adin_mic_linux_alsa.c:

Go to the source code of this file.

Functions

boolean adin_mic_standby (int sfreq, void *dummy)
static int xrun_recovery (snd_pcm_t *handle, int err)
boolean adin_mic_start ()
boolean adin_mic_stop ()
int adin_mic_read (SP16 *buf, int sampnum)
 Read samples from the daemon.

Variables

static snd_pcm_t * handle
 Audio handler.
static snd_pcm_hw_params_t * hwparams
 Pointer to device hardware parameters.
static char * pcm_name = "hw:0,0"
 Name of the PCM device.
static boolean need_swap
 Whether samples need byte swap.
static int latency = 50
 Lantency time in msec.
static struct pollfd * ufds
 Poll descriptor.
static int count
 Poll descriptor count.


Detailed Description

Microphone input on Linux/ALSA.

Author:
Akinobu LEE
Date:
Sun Feb 13 16:18:26 2005
Low level I/O functions for microphone input on Linux using Advanced Linux Sound Architechture (ALSA) API, developed on version 0.9.x. If you want to use this API, please specify "--with-mictype=alsa" options at compilation time to configure script.

Julius does not alter any mixer device setting at all on Linux. You should configure the mixer for recording source (mic/line) and recording volume correctly using other audio tool such as alsamixer.

Note that sound card should support 16bit monaural recording, and multiple cards are not supported (in that case the first one will be used).

See also:
http://www.alsa-project.org/
Revision
1.3

Definition in file adin_mic_linux_alsa.c.


Function Documentation

boolean adin_mic_standby ( int  sfreq,
void *  dummy 
)

Device initialization: check device capability and open for recording.

Parameters:
sfreq [in] required sampling frequency.
dummy [in] a dummy data
Returns:
TRUE on success, FALSE on failure.

Definition at line 80 of file adin_mic_linux_alsa.c.

static int xrun_recovery ( snd_pcm_t *  handle,
int  err 
) [static]

Error recovery when PCM buffer underrun or suspend.

Parameters:
handle [in] audio handler
err [in] error code
Returns:
0 on success, otherwise the given errno.

Definition at line 270 of file adin_mic_linux_alsa.c.

Referenced by adin_mic_start().

boolean adin_mic_start (  ) 

Start recording.

Returns:
TRUE on success, FALSE on failure.

Definition at line 296 of file adin_mic_linux_alsa.c.

boolean adin_mic_stop (  ) 

Stop recording.

Returns:
TRUE on success, FALSE on failure.

Definition at line 342 of file adin_mic_linux_alsa.c.

int adin_mic_read ( SP16 buf,
int  sampnum 
)

Read samples from the daemon.

Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block until at least one sample can be obtained.

Parameters:
buf [out] samples obtained in this function
sampnum [in] wanted number of samples to be read
Returns:
actural number of read samples, -2 if an error occured.

Definition at line 360 of file adin_mic_linux_alsa.c.


Generated on Tue Dec 26 16:17:35 2006 for Julius by  doxygen 1.5.0