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

マイク入力 (portaudioライブラリ) [詳細]

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

ソースコードを見る。

マクロ定義

#define OLDVER
#define MAX_FRAGMENT_MSEC   128
 Define this to choose which audio device to open by querying the device API type in the following order in Windows:

関数

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.
static boolean adin_mic_open (char *arg)
 Open the portaudio device and check capability of the opening device.
boolean adin_mic_begin (char *arg)
 Start recording.
boolean adin_mic_end ()
 Stop recording.
int adin_mic_read (SP16 *buf, int sampnum)
 Read samples from device.
char * adin_mic_input_name ()
 Function to return current input source device name.

変数

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 = NULL
 Stream information.
static int srate
 Required sampling rate.

説明

マイク入力 (portaudioライブラリ)

portaudiooライブラリを使用したマイク入力のための低レベル関数です. 使用するには configure 時に "--with-mictype=portaudio" を指定して下さい. Linux および Win32 で使用可能です.Win32モードではこれが デフォルトとなります.

録音デバイスは WASAPI -> ASIO -> DirectSound -> MME の順で選択されます。 使用するデバイスを指定したい場合は、環境変数 PORTAUDIO_DEV でデバイス名 (先頭から部分マッチ)を指定するか、PORTAUDIO_DEV_NUM でデバイス番号を 指定してください。使用可能なデバイス名とデバイス番号は起動時に出力されます。

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

portaudio はフリーでクロスプラットホームのオーディオ入出力ライブラリ です.ソースは libsent/src/adin/pa/ に含まれています.このプログラムでは スレッドを利用したcallback を利用して入力音声をリングバッファに取り込んで います.

参照:
http://www.portaudio.com/
作者:
Akinobu LEE
日付:
Mon Feb 14 12:03:48 2005
Revision:
1.18

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


マクロ定義

#define MAX_FRAGMENT_MSEC   128

Define this to choose which audio device to open by querying the device API type in the following order in Windows:

WASAPI -> ASIO -> DirectSound -> MME

This will be effective when using portaudio library with multiple Host API support, in which case Pa_OpenDefaultStream() will open the first found one (not the one with the optimal performance)

(not work on OLDVER) Maximum Data fragment Length in msec. Input can be delayed to this time. You can override this value by specifying environment valuable "LATENCY_MSEC".

This is not used in the new V19, it uses default value given by the library. At the new V19, you can force latency by PA_MIN_LATENCY_MSEC instead of LATENCY_MSEC.

adin_portaudio.c108 行で定義されています。

参照元 adin_mic_open().


関数

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.

引数:
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)
戻り値:
0 when no error, or 1 to terminate recording.

adin_portaudio.c132 行で定義されています。

参照元 adin_mic_open().

boolean adin_mic_standby ( int  sfreq,
void *  dummy 
)

Device initialization: check device capability and open for recording.

Device initialization: check machine capability.

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

adin_portaudio.c356 行で定義されています。

参照元 adin_select().

static boolean adin_mic_open ( char *  arg) [static]

Open the portaudio device and check capability of the opening device.

引数:
arg[in] argument: if number, use it as device ID
戻り値:
TRUE on success, FALSE on failure.

adin_portaudio.c371 行で定義されています。

参照元 adin_mic_begin().

boolean adin_mic_begin ( char *  arg)

Start recording.

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

adin_portaudio.c528 行で定義されています。

参照元 adin_select().

boolean adin_mic_end ( )

Stop recording.

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

adin_portaudio.c554 行で定義されています。

参照元 adin_select().

int adin_mic_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 until at least some samples are obtained.

引数:
buf[out] samples obtained in this function
sampnum[in] wanted number of samples to be read
戻り値:
actural number of read samples, -2 if an error occured.

adin_portaudio.c597 行で定義されています。

参照元 adin_select().

char* adin_mic_input_name ( )

Function to return current input source device name.

戻り値:
string of current input device name.

adin_portaudio.c672 行で定義されています。

参照元 adin_select().