Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 #ifndef _CONT_AD_H_
00080 #define _CONT_AD_H_
00081
00082
00083 #include <sphinxbase_export.h>
00084 #include <prim_type.h>
00085 #include <ad.h>
00086
00114 #include <stdio.h>
00115
00116
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120 #if 0
00121
00122 }
00123 #endif
00124
00125
00126 #define CONT_AD_STATE_SIL 0
00127 #define CONT_AD_STATE_SPEECH 1
00128
00129
00135 typedef struct spseg_s {
00136 int32 startfrm;
00137 int32 nfrm;
00138 struct spseg_s *next;
00139 } spseg_t;
00140
00141
00151 typedef struct {
00152
00153 int32 (*adfunc)(ad_rec_t *ad, int16 *buf, int32 max);
00154 ad_rec_t *ad;
00156 int32 rawmode;
00158 int16 *adbuf;
00160
00161
00162
00163
00164
00165 int32 state;
00167 int32 read_ts;
00171 int32 seglen;
00175 int32 siglvl;
00178
00179
00180 int32 sps;
00183 int32 eof;
00185 int32 spf;
00186 int32 adbufsize;
00187 int32 prev_sample;
00188 int32 headfrm;
00189 int32 n_frm;
00190 int32 n_sample;
00191 int32 tot_frm;
00192 int32 noise_level;
00194 int32 *pow_hist;
00195 char *frm_pow;
00197 int32 auto_thresh;
00198 int32 delta_sil;
00199 int32 delta_speech;
00200 int32 min_noise;
00201 int32 max_noise;
00202 int32 winsize;
00203 int32 speech_onset;
00204 int32 sil_onset;
00205 int32 leader;
00206 int32 trailer;
00208 int32 thresh_speech;
00210 int32 thresh_sil;
00212 int32 thresh_update;
00213 float32 adapt_rate;
00217 int32 tail_state;
00220 int32 win_startfrm;
00221 int32 win_validfrm;
00222 int32 n_other;
00224 spseg_t *spseg_head;
00225 spseg_t *spseg_tail;
00227 FILE *rawfp;
00231 FILE *logfp;
00236 int32 n_calib_frame;
00237 } cont_ad_t;
00238
00239
00255 SPHINXBASE_EXPORT
00256 cont_ad_t *cont_ad_init (ad_rec_t *ad,
00257 int32 (*adfunc)(ad_rec_t *ad, int16 *buf, int32 max)
00261 );
00262
00269 SPHINXBASE_EXPORT
00270 cont_ad_t *cont_ad_init_rawmode (ad_rec_t *ad,
00271 int32 (*adfunc)(ad_rec_t *ad, int16 *buf, int32 max));
00272
00273
00302 SPHINXBASE_EXPORT
00303 int32 cont_ad_read (cont_ad_t *r,
00304 int16 *buf,
00307 int32 max
00310 );
00311
00315 SPHINXBASE_EXPORT
00316 int32 cont_ad_buffer_space(cont_ad_t *r);
00317
00330 SPHINXBASE_EXPORT
00331 int32 cont_ad_calib (cont_ad_t *cont
00332 );
00333
00345 SPHINXBASE_EXPORT
00346 int32 cont_ad_calib_loop (cont_ad_t *r, int16 *buf, int32 max);
00347
00359 SPHINXBASE_EXPORT
00360 int32 cont_ad_calib_size(cont_ad_t *r);
00361
00374 SPHINXBASE_EXPORT
00375 int32 cont_ad_set_thresh (cont_ad_t *cont,
00376 int32 sil,
00377 int32 sp
00378 );
00379
00380
00388 SPHINXBASE_EXPORT
00389 int32 cont_ad_set_params (cont_ad_t *r, int32 delta_sil, int32 delta_speech,
00390 int32 min_noise, int32 max_noise,
00391 int32 winsize, int32 speech_onset, int32 sil_onset,
00392 int32 leader, int32 trailer,
00393 float32 adapt_rate);
00394
00402 SPHINXBASE_EXPORT
00403 int32 cont_ad_get_params (cont_ad_t *r, int32 *delta_sil, int32 *delta_speech,
00404 int32 *min_noise, int32 *max_noise,
00405 int32 *winsize, int32 *speech_onset, int32 *sil_onset,
00406 int32 *leader, int32 *trailer,
00407 float32 *adapt_rate);
00408
00413 SPHINXBASE_EXPORT
00414 int32 cont_ad_reset (cont_ad_t *cont);
00415
00416
00420 SPHINXBASE_EXPORT
00421 int32 cont_ad_close (cont_ad_t *cont);
00422
00423
00427 SPHINXBASE_EXPORT
00428 void cont_ad_powhist_dump (FILE *fp, cont_ad_t *cont);
00429
00430
00435 SPHINXBASE_EXPORT
00436 int32 cont_ad_detach (cont_ad_t *c);
00437
00438
00444 SPHINXBASE_EXPORT
00445 int32 cont_ad_attach (cont_ad_t *c, ad_rec_t *a, int32 (*func)(ad_rec_t *, int16 *, int32));
00446
00447
00459 SPHINXBASE_EXPORT
00460 int32 cont_ad_set_rawfp (cont_ad_t *c,
00461 FILE *fp);
00462
00463
00471 SPHINXBASE_EXPORT
00472 int32 cont_ad_set_logfp (cont_ad_t *c,
00473 FILE *fp);
00474
00475
00484 SPHINXBASE_EXPORT
00485 int32 cont_set_thresh(cont_ad_t *r, int32 silence, int32 speech);
00486
00487 #ifdef __cplusplus
00488 }
00489 #endif
00490
00491
00492 #endif