⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instance.c

📁 julius version 4.12.about sound recognition.
💻 C
📖 第 1 页 / 共 2 页
字号:
 *  * @callgraph * @callergraph * @ingroup jconf */JCONF_LM *j_jconf_lm_new(){  JCONF_LM *new;  new = (JCONF_LM *)mymalloc(sizeof(JCONF_LM));  jconf_set_default_values_lm(new);  new->next = NULL;  return new;}/**  * <EN> * Release a language model (LM) parameter structure * </EN> * <JA> * 咐胳モデル (LM) パラメ〖タ菇陇挛を豺庶する * </JA> *  * @param lmconf [in] LM parameter structure * * @callgraph * @callergraph * @ingroup jconf *  */voidj_jconf_lm_free(JCONF_LM *lmconf){  free(lmconf);}/**  * <EN> * Register LM configuration to global jconf. * Returns error if the same name already exist in the jconf. * </EN> * <JA> * 咐胳モデル(LM)パラメ〖タ菇陇挛を jconf に判峡するˉ * jconf柒に票じ叹涟のモジュ〖ルが贷に判峡されている眷圭はエラ〖となるˉ * </JA> *  * @param jconf [i/o] global jconf * @param lmconf [in] LM configuration to register * @param name [in] module name * * @return TRUE on success, FALSE on failure *  * @callgraph * @callergraph * @ingroup jconf */booleanj_jconf_lm_regist(Jconf *jconf, JCONF_LM *lmconf, char *name){  JCONF_LM *ltmp;  if (!name) {    jlog("ERROR: j_jconf_lm_regist: no name specified to register a LM conf\n");    return FALSE;  }  for(ltmp = jconf->lm_root; ltmp; ltmp = ltmp->next) {    if (strmatch(ltmp->name, name)) {      jlog("ERROR: j_jconf_lm_regist: failed to regist a LM conf: the same name \"%s\" already exist\n", ltmp->name);      return FALSE;    }  }  /* set name */  strncpy(lmconf->name, name, JCONF_MODULENAME_MAXLEN);  /* append to last */  lmconf->next = NULL;  if (jconf->lm_root == NULL) {    lmconf->id = 1;    jconf->lm_root = lmconf;  } else {    for(ltmp = jconf->lm_root; ltmp->next; ltmp = ltmp->next);    lmconf->id = ltmp->id + 1;    ltmp->next = lmconf;  }  return TRUE;}/**  * <EN> * Allocate a new search (SEARCH) parameter structure. * Default parameter values are set to it. * </EN> * <JA> * 玫瑚パラメ〖タ(SEARCH)菇陇挛を糠たに充り烧ける.  * 柒婶メンバにはデフォルト猛が呈羌される.  * </JA> *  * @return the newly allocated SEARCH parameter structure. *  * @callgraph * @callergraph * @ingroup jconf */JCONF_SEARCH *j_jconf_search_new(){  JCONF_SEARCH *new;  new = (JCONF_SEARCH *)mymalloc(sizeof(JCONF_SEARCH));  jconf_set_default_values_search(new);  new->next = NULL;  return new;}/**  * <EN> * Release a search (SEARCH) parameter structure * </EN> * <JA> * 玫瑚パラメ〖タ(SEARCH)菇陇挛を豺庶する * </JA> *  * @param sconf [in] SEARCH parameter structure * * @callgraph * @callergraph * @ingroup jconf *  */voidj_jconf_search_free(JCONF_SEARCH *sconf){  free(sconf);}/**  * <EN> * Register SEARCH configuration to global jconf. * Returns error if the same name already exist in the jconf. * </EN> * <JA> * 玫瑚(SEARCH)パラメ〖タ菇陇挛を jconf に判峡するˉ * jconf柒に票じ叹涟のモジュ〖ルが贷に判峡されている眷圭はエラ〖となるˉ * </JA> *  * @param jconf [i/o] global jconf * @param sconf [in] SEARCH configuration to register * @param name [in] module name * * @return TRUE on success, FALSE on failure *  * @callgraph * @callergraph * @ingroup jconf */booleanj_jconf_search_regist(Jconf *jconf, JCONF_SEARCH *sconf, char *name){  JCONF_SEARCH *stmp;  if (!name) {    jlog("ERROR: j_jconf_search_regist: no name specified to register a SR conf\n");    return FALSE;  }  for(stmp = jconf->search_root; stmp; stmp = stmp->next) {    if (strmatch(stmp->name, name)) {      jlog("ERROR: j_jconf_search_regist: failed to regist an SR conf: the same name \"%s\" already exist\n", stmp->name);      return FALSE;    }  }  /* set name */  strncpy(sconf->name, name, JCONF_MODULENAME_MAXLEN);  /* append to last */  sconf->next = NULL;  if (jconf->search_root == NULL) {    sconf->id = 1;    jconf->search_root = sconf;  } else {    for(stmp = jconf->search_root; stmp->next; stmp = stmp->next);    sconf->id = stmp->id + 1;    stmp->next = sconf;  }  return TRUE;}/**  * <EN> * @brief  Allocate a new global configuration parameter structure. * * JCONF_AM, JCONF_LM, JCONF_SEARCH are defined one for each, and * assigned to the newly allocated structure as initial instances. *  * </EN> * <JA> * @brief  链挛のパラメ〖タ菇陇挛を糠たに充り烧ける.  * * JCONF_AM, JCONF_LM, JCONF_SEARCHも1つづつ充り碰てられる.  * これらは -AM 霹の回年を崔まない 3.x 笆涟の jconf を粕み哈んだときに· * そのまま脱いられる.  *  * </JA> *  * @return the newly allocated global configuration parameter structure. *  * @callgraph * @callergraph * @ingroup jconf */Jconf *j_jconf_new(){  Jconf *jconf;  /* allocate memory */  jconf = (Jconf *)mymalloc(sizeof(Jconf));  /* set default values */  jconf_set_default_values(jconf);  /* allocate first one am / lm /search instance with their name left NULL */  jconf->am_root = j_jconf_am_new();  jconf->am_root->id = 0;  strcpy(jconf->am_root->name, JCONF_MODULENAME_DEFAULT);  jconf->lm_root = j_jconf_lm_new();  jconf->lm_root->id = 0;  strcpy(jconf->lm_root->name, JCONF_MODULENAME_DEFAULT);  jconf->search_root = j_jconf_search_new();  jconf->search_root->id = 0;  strcpy(jconf->search_root->name, JCONF_MODULENAME_DEFAULT);  /* assign the am /lm instance to the instance */  jconf->search_root->amconf = jconf->am_root;  jconf->search_root->lmconf = jconf->lm_root;  /* set current */  jconf->amnow = jconf->am_root;  jconf->lmnow = jconf->lm_root;  jconf->searchnow = jconf->search_root;  /* set gmm am jconf */  jconf->gmm = NULL;  return(jconf);}/**  * <EN> * @brief  Free a global configuration parameter structure. * * All JCONF_AM, JCONF_LM, JCONF_SEARCH are also released. *  * </EN> * <JA> * @brief  链挛のパラメ〖タ菇陇挛を倡庶する.  * * JCONF_AM, JCONF_LM, JCONF_SEARCHもすべて倡庶される.  *  * </JA> *  * @param jconf [in] global configuration parameter structure *  * @callgraph * @callergraph * @ingroup jconf */voidj_jconf_free(Jconf *jconf){  JCONF_AM *am, *amtmp;  JCONF_LM *lm, *lmtmp;  JCONF_SEARCH *sc, *sctmp;  opt_release(jconf);  am = jconf->am_root;  while(am) {    amtmp = am->next;    j_jconf_am_free(am);    am = amtmp;  }  lm = jconf->lm_root;  while(lm) {    lmtmp = lm->next;    j_jconf_lm_free(lm);    lm = lmtmp;  }  sc = jconf->search_root;  while(sc) {    sctmp = sc->next;    j_jconf_search_free(sc);    sc = sctmp;  }  free(jconf);}/**  * <EN> * Allocate memory for a new engine instance. * </EN> * <JA> * エンジンインスタンスを糠たにメモリ充り烧けする.  * </JA> *  * @return the newly allocated engine instance. *  * @callgraph * @callergraph * @ingroup instance */Recog *j_recog_new(){  Recog *recog;  /* allocate memory */  recog = (Recog *)mymalloc(sizeof(Recog));  /* clear all values to 0 (NULL)  */  memset(recog, 0, sizeof(Recog));  /* initialize some values */  recog->jconf = NULL;  recog->amlist = NULL;  recog->lmlist = NULL;  recog->process_list = NULL;  recog->process_online = FALSE;  recog->process_active = TRUE;  recog->process_want_terminate = FALSE;  recog->process_want_reload = FALSE;  recog->gram_switch_input_method = SM_PAUSE;  recog->process_segment = FALSE;  /* set default function for vector calculation to RealTimeMFCC() */  recog->calc_vector = RealTimeMFCC;  /* clear callback func. */  callback_init(recog);  recog->adin = (ADIn *)mymalloc(sizeof(ADIn));  memset(recog->adin, 0, sizeof(ADIn));  return(recog);}/**  * <EN> * @brief  Free an engine instance. * * All allocated memories in the instance will be also released. * </EN> * <JA> * @brief  エンジンインスタンスを倡庶する * * インスタンス柒でこれまでにアロケ〖トされた链てのメモリも倡庶される.  * </JA> *  * @param recog [in] engine instance. *  * @callgraph * @callergraph * @ingroup instance */voidj_recog_free(Recog *recog){  if (recog->gmm) hmminfo_free(recog->gmm);  if (recog->speech) free(recog->speech);  /* free adin work area */  adin_free_param(recog);  /* free GMM calculation work area if any */  gmm_free(recog);  /* Output result -> free just after malloced and used */  /* StackDecode pass2 -> allocate and free within search */  /* RealBeam real */  realbeam_free(recog);  /* adin */  if (recog->adin) free(recog->adin);  /* instances */  {    RecogProcess *p, *ptmp;    p = recog->process_list;    while(p) {      ptmp = p->next;      j_recogprocess_free(p);      p = ptmp;    }  }  {    PROCESS_LM *lm, *lmtmp;    lm = recog->lmlist;    while(lm) {      lmtmp = lm->next;      j_process_lm_free(lm);      lm = lmtmp;    }  }  {    PROCESS_AM *am, *amtmp;    am = recog->amlist;    while(am) {      amtmp = am->next;      j_process_am_free(am);      am = amtmp;    }  }  {    MFCCCalc *mfcc, *tmp;    mfcc = recog->mfcclist;    while(mfcc) {      tmp = mfcc->next;      j_mfcccalc_free(mfcc);      mfcc = tmp;    }  }  /* jconf */  if (recog->jconf) {    j_jconf_free(recog->jconf);  }  free(recog);}/* end of file */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -