libsent/src/adin/adin.c

入力ソースの選択と準備,および録音の開始・読み込み・録音停止 [詳細]

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

説明

入力ソースの選択と準備,および録音の開始・読み込み・録音停止

作者:
Akinobu LEE
日付:
Sun Feb 13 12:02:08 2005

ここには,入力ソースの設定およびデータ読み込み,開始・停止を呼び出す ための汎用関数が定義されています.

ユーザはまず最初に 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();
   }
 }
Revision
1.3

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

引数:
[in] cad_standby Function of device initialization
[in] cad_begin Function to begin input stream for capturing
[in] cad_read Function to read captured samples
[in] cad_end Function to end input stream
[in] cad_resume Function to resume the paused stream
[in] cad_pause Function to pause the stream
[in] segmentation_default TRUE if speech detection and segmentation is preferrable on this device by default
[in] need_threaded TRUE if this device is live input and needs threading of A/D-in process

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

参照元 adin_select().

boolean adin_select ( int  source  ) 

Select input source and setup device-specific functions.

引数:
source [In] selection ID of input source
参照:
adin.h
戻り値:
TRUE on success, FALSE if source is not available.

adin.c134 行で定義されています。

参照元 adin_initialize().

boolean adin_standby ( int  freq,
void *  arg 
)

Call device-specific initialization.

引数:
freq [in] sampling frequency
arg [in] device-dependent extra argument
戻り値:
TRUE on success, FALSE on failure.

adin.c227 行で定義されています。

参照元 adin_initialize().

boolean adin_begin (  ) 

Call device-specific function to begin capturing of the audio stream.

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

adin.c239 行で定義されています。

参照元 main_recognition_loop().

boolean adin_end (  ) 

Call device-specific function to end capturing of the audio stream.

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

adin.c251 行で定義されています。

参照元 main_recognition_loop().


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