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>
#include <sys/soundcard.h>
adin_mic_linux_oss.cのインクルード依存関係図

ソースコードを見る。

マクロ定義

#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 FRAGMENT_POWER   10

関数

boolean adin_mic_standby (int sfreq, void *dummy)
boolean adin_mic_start ()
boolean adin_mic_stop ()
int adin_mic_read (SP16 *buf, int sampnum)
 Read samples from device.

変数

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).

説明

マイク入力 (Linux/OSS)

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

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

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

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

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

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

Revision
1.3

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


マクロ定義

#define FRAGMENT_POWER   10

Data fragment size. Input will be delayed by 2^X bytes. The default value of 10 means we treat input per a unit of 2~10=1024 bytes, which corresponds to 32 msec in 16kHz sampling.

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

参照元 adin_mic_standby().


関数

boolean adin_mic_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.c102 行で定義されています。

boolean adin_mic_start (  ) 

Start recording.

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

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

boolean adin_mic_stop (  ) 

Stop recording.

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

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

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 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.c347 行で定義されています。


Juliusに対してTue Sep 22 00:14:58 2009に生成されました。  doxygen 1.6.0