#include <sent/stddefs.h>
#include <sent/speech.h>
#include <sent/adin.h>
adin.cのインクルード依存関係図
関数 | |
static void | adin_register_func (boolean(*cad_standby)(int, void *), boolean(*cad_begin)(), int(*cad_read)(SP16 *, int), boolean(*cad_end)(), boolean(*cad_resume)(), boolean(*cad_pause)(), boolean segmentation_default, boolean need_threaded) |
boolean | adin_select (int source) |
boolean | adin_standby (int freq, void *arg) |
boolean | adin_begin () |
boolean | adin_end () |
変数 | |
static boolean(*) | ad_standby (int, void *) |
Pointer to store function for device initialization (call once on startup) | |
static boolean(*) | ad_begin () |
Pointer to store function for begin capturing | |
static boolean(*) | ad_end () |
Pointer to store function for end capturing |
ユーザはまず最初に adin_select() を呼び,入力ソースごとに依存した 関数と設定値をセットします.あとは, adin_standby() でデバイスの初期化, adin_begin() , adin_end() で入力ストリームの開始と終了, adin_pause() と adin_resume() でストリームの中断と再開,adin_read() でサンプルの読み込み を行ないます.それぞれの関数の実体は,選択した入力ソースごとに それぞれ別ファイルで定義されています.この仕組みにより,ユーザは ファイルやマイクなどの入力ソースごとの処理の違いを気にせずにすみます.
以下に,実際にどのようにこれらの関数が呼ばれているかを 簡単に示します.adin_begin(), adin_end() と adin_resume(), adin_pause() の 違いは,前者はある入力ストリーム全体の開始と終了,後者はその中で 検出した音声区間ごとの入力中断・再開を表します.例えばファイル入力では, 前者をファイルの open と close に対応し,マイク入力では(入力ストリーム は無限に続くので)後者を入力の中断と再開に対応しています.実際の処理では, ストリームの終了や入力エラーにも対応する必要があります.
adin_go() { adin_resume(); for(;;) adin_read(); SOME SPEECH SEGMENT DETECTION HERE if (no_segmentation || valid_segment) callback(); if (error || end_of_stream || (!no_segmentation && end_of_segment)) break; } adin_pause(); return(-1..error 0...end of stream, 1...end of segment); } main() { adin_standby(freq, arg); for(;;) { adin_begin(); for(;;) { adin_go(); if (error) break; Process_2nd_Pass; if (end of segment) break; } adin_end(); } }
adin.c で定義されています。
static void adin_register_func | ( | boolean(*)(int, void *) | cad_standby, | |
boolean(*)() | cad_begin, | |||
int(*)(SP16 *, int) | cad_read, | |||
boolean(*)() | cad_end, | |||
boolean(*)() | cad_resume, | |||
boolean(*)() | cad_pause, | |||
boolean | segmentation_default, | |||
boolean | need_threaded | |||
) | [static] |
Assign specified functions to adin functions and adin_cut().
cad_standby | [in] Function of device initialization |
cad_begin | [in] Function to begin input stream for capturing |
cad_read | [in] Function to read captured samples |
cad_end | [in] Function to end input stream |
cad_resume | [in] Function to resume the paused stream |
cad_pause | [in] Function to pause the stream |
segmentation_default | [in] TRUE if speech detection and segmentation is preferrable on this device by default |
need_threaded | [in] TRUE if this device is live input and needs threading of A/D-in process |
参照元 adin_select().
boolean adin_select | ( | int | source | ) |
Select input source and setup device-specific functions.
source | [In] selection ID of input source |
参照元 adin_initialize().
boolean adin_standby | ( | int | freq, | |
void * | arg | |||
) |
Call device-specific initialization.
freq | [in] sampling frequency | |
arg | [in] device-dependent extra argument |
参照元 adin_initialize().
boolean adin_begin | ( | ) |
Call device-specific function to begin capturing of the audio stream.
boolean adin_end | ( | ) |
Call device-specific function to end capturing of the audio stream.