#include <sent/stddefs.h>
#include <sent/speech.h>
#include <sent/adin.h>
Include dependency graph for adin.c:
Go to the source code of this file.
Functions | |
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 () |
Variables | |
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. |
User should call adin_select() at first to select input device dependent functions and variables. After that, user can call adin_standby() to initialize the selected device (with device specific argument if required), use adin_begin() and adin_end() to begin and end an input stream, use adin_pause() and adin_resume() to suspend and resume the current input stream, and use adin_read() to read the audio input. The entity of these functions are actually defined in separate files in this directory. This interface allows user to handle audio input consistently.
The following describes how these functions should be called. The difference between adin_begin(), adin_end() and adin_resume(), adin_pause() is that, the former corresponds to the start and end of an input stream, and the latter corrsponds to the pause and resume of the current input stream, typically for speech detection. For examples, in file input, file open and close are assigned to adin_begin() and adin_end(), and in live microphone input, device is opened in adin_standby() and their pause and resume are handled in adin_resume() and adin_pause().
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(); } }
Definition in file 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 |
Definition at line 108 of file adin.c.
Referenced by adin_select().
boolean adin_select | ( | int | source | ) |
Select input source and setup device-specific functions.
source | [In] selection ID of input source |
Definition at line 134 of file adin.c.
Referenced by adin_initialize().
boolean adin_standby | ( | int | freq, | |
void * | arg | |||
) |
Call device-specific initialization.
freq | [in] sampling frequency | |
arg | [in] device-dependent extra argument |
Definition at line 227 of file adin.c.
Referenced by adin_initialize().
boolean adin_begin | ( | ) |
Call device-specific function to begin capturing of the audio stream.
Definition at line 239 of file adin.c.
Referenced by main_recognition_loop().
boolean adin_end | ( | ) |
Call device-specific function to end capturing of the audio stream.
Definition at line 251 of file adin.c.
Referenced by main_recognition_loop().