Julius 4.2
マクロ定義 | 関数 | 変数
libsent/src/adin/adin_mic_linux_oss.c

マイク入力 (Linux/OSS) [詳細]

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

ソースコードを見る。

マクロ定義

#define DEFAULT_DEVICE   "/dev/dsp"
 Default device name, can be overridden by AUDIODEV environment variable.
#define FREQALLOWRANGE   200
 Acceptable width of sampling frequency.
#define MAXPOLLINTERVAL   300
 Read timeout in msec.
#define MAX_FRAGMENT_MSEC   50
 Maximum Data fragment Length in msec.
#define MIN_FRAGMENT_SIZE   256
 Minimum fragment length in bytes.

関数

boolean adin_oss_standby (int sfreq, void *dummy)
 Device initialization: check device capability and open for recording.
boolean adin_oss_begin (char *pathname)
 Start recording.
boolean adin_oss_end ()
 Stop recording.
int adin_oss_read (SP16 *buf, int sampnum)
 Read samples from device.
char * adin_oss_input_name ()
 Function to return current input source device name.

変数

static int srate
 Required sampling rate.
static int audio_fd
 Audio descriptor.
static boolean need_swap
 Whether samples need byte swap.
static int frag_size
 Actual data fragment size.
static boolean stereo_rec
 TRUE if stereo recording (use left only)
static char * defaultdev = DEFAULT_DEVICE
 Default device name.
static char devname [MAXPATHLEN]
 Current device name.

説明

マイク入力 (Linux/OSS)

マイク入力のための低レベル関数です.インタフェースとして OSS サウンドドライバを使用する場合,このファイルが使用されます. カーネル標準のドライバ,OSS/Linuxのドライバ,および ALSA の OSS互換モードに対応しています.

configure でマイクタイプの自動判別を 行なう場合(デフォルト),Linux ではこのOSS用インタフェースが選択されます. 他のインタフェース (ALSA, esd, portaudio, spAudio等) を使用したい場合は configure 時に "--with-mictype=TYPE" を明示的に指定して下さい.

サウンドカードが 16bit モノラル で録音できることが必須です. ただしLinuxでは,ステレオ録音しかできないデバイスの場合, 左チャンネルのみを入力として取り出して認識することもできます.

JuliusはLinuxではミキサーデバイスの設定を一切行いません.録音デバイスの 選択(マイク/ライン)や録音ボリュームの調節は xmixer など他のツールで 行なって下さい.

デフォルトのデバイス名は "/dev/dsp" です.環境変数 AUDIODEV に デバイス名を指定することで,他のデバイス名を使用できます.

作者:
Akinobu LEE
日付:
Sun Feb 13 16:18:26 2005
Revision:
1.8

adin_mic_linux_oss.c で定義されています。


マクロ定義

#define MAX_FRAGMENT_MSEC   50

Maximum Data fragment Length in msec.

Input can be delayed to this time. a maximum of 2^x number smaller than this value will be taken. You can override this value by specifying environment valuable "LATENCY_MSEC".

adin_mic_linux_oss.c94 行で定義されています。

#define MIN_FRAGMENT_SIZE   256

Minimum fragment length in bytes.

adin_mic_linux_oss.c99 行で定義されています。


関数

boolean adin_oss_standby ( int  sfreq,
void *  dummy 
)

Device initialization: check device capability and open for recording.

引数:
sfreq[in] required sampling frequency.
dummy[in] a dummy data
戻り値:
TRUE on success, FALSE on failure.

adin_mic_linux_oss.c118 行で定義されています。

参照元 adin_mic_standby(), と adin_select().

boolean adin_oss_begin ( char *  pathname)

Start recording.

引数:
pathname[in] path name to open or NULL for default
戻り値:
TRUE on success, FALSE on failure.

adin_mic_linux_oss.c358 行で定義されています。

参照元 adin_mic_begin(), と adin_select().

boolean adin_oss_end ( )

Stop recording.

戻り値:
TRUE on success, FALSE on failure.

adin_mic_linux_oss.c394 行で定義されています。

参照元 adin_mic_end(), と adin_select().

int adin_oss_read ( SP16 buf,
int  sampnum 
)

Read samples from device.

Try to read sampnum samples and returns actual number of recorded samples currently available. This function will block at most MAXPOLLINTERVAL msec, until at least one sample can be obtained. If no data has been obtained after waiting for MAXPOLLINTERVAL msec, returns 0.

When stereo input, only left channel will be used.

引数:
buf[out] samples obtained in this function
sampnum[in] wanted number of samples to be read
戻り値:
actural number of read samples, 0 of no sample has been captured in MAXPOLLINTERVAL msec, -2 if error.

adin_mic_linux_oss.c418 行で定義されています。

参照元 adin_mic_read(), と adin_select().

char* adin_oss_input_name ( )

Function to return current input source device name.

戻り値:
string of current input device name.

adin_mic_linux_oss.c485 行で定義されています。

参照元 adin_mic_input_name(), と adin_select().