libsent/src/adin/adin_portaudio.c File Reference

Microphone input using portaudio library. More...

#include <sent/stddefs.h>
#include <sent/speech.h>
#include <sent/adin.h>
#include "pa/portaudio.h"

Go to the source code of this file.

Defines

#define MAX_FRAGMENT_MSEC   128
 Maximum Data fragment Length in msec.

Functions

static int Callback (void *inbuf, void *outbuf, unsigned long len, PaTimestamp outTime, void *userdata)
 PortAudio callback to store the incoming speech data into the cycle buffer.
boolean adin_mic_standby (int sfreq, void *dummy)
 Device initialization: check device capability and open for recording.
boolean adin_mic_begin ()
 Start recording.
boolean adin_mic_end ()
 Stop recording.
int adin_mic_read (SP16 *buf, int sampnum)
 Read samples from device.

Variables

static SP16speech
 cycle buffer for incoming speech data
static int current
 writing point
static int processed
 reading point
static boolean buffer_overflowed = FALSE
 TRUE if buffer overflowed.
static int cycle_buffer_len
 length of cycle buffer based on INPUT_DELAY_SEC
static PortAudioStream * stream
 Stream information.


Detailed Description

Microphone input using portaudio library.

Low level I/O functions for microphone input using portaudio library. To use, please specify "--with-mictype=portaudio" options to configure script. This function is currently available for Linux and Win32. On Windows, this is default.

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

Portaudio is a free, cross platform, open-source audio I/O library. The sources are included at libsent/src/adin/pa/. This program uses ring buffer to store captured samples in callback functions with threading.

See also:
http://www.portaudio.com/
Author:
Akinobu LEE
Date:
Mon Feb 14 12:03:48 2005
Revision
1.1.1.1

Definition in file adin_portaudio.c.


Define Documentation

#define MAX_FRAGMENT_MSEC   128

Maximum Data fragment Length in msec.

Input can be delayed to this time. You can override this value by specifying environment valuable "LATENCY_MSEC".

Definition at line 72 of file adin_portaudio.c.


Function Documentation

static int Callback ( void *  inbuf,
void *  outbuf,
unsigned long  len,
PaTimestamp  outTime,
void *  userdata 
) [static]

PortAudio callback to store the incoming speech data into the cycle buffer.

Parameters:
inbuf [in] portaudio input buffer
outbuf [in] portaudio output buffer (not used)
len [in] length of above
outTime [in] output time (not used)
userdata [in] user defined data (not used)
Returns:
0 when no error, or 1 to terminate recording.

Definition at line 94 of file adin_portaudio.c.

Referenced by adin_mic_standby().

boolean adin_mic_standby ( int  sfreq,
void *  dummy 
)

Device initialization: check device capability and open for recording.

Connection initialization: check connectivity 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 160 of file adin_portaudio.c.

Referenced by adin_select().

boolean adin_mic_begin (  ) 

Start recording.

Returns:
TRUE on success, FALSE on failure.

Definition at line 224 of file adin_portaudio.c.

Referenced by adin_select().

boolean adin_mic_end (  ) 

Stop recording.

Returns:
TRUE on success, FALSE on failure.

Definition at line 244 of file adin_portaudio.c.

Referenced by adin_select().

int adin_mic_read ( SP16 buf,
int  sampnum 
)

Read samples from device.

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 some samples are 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 271 of file adin_portaudio.c.

Referenced by adin_select().


Generated on Tue Dec 18 16:01:37 2007 for Julius by  doxygen 1.5.4