当前位置: 首页>>代码示例>>C++>>正文


C++ CData::XAddr方法代码示例

本文整理汇总了C++中CData::XAddr方法的典型用法代码示例。如果您正苦于以下问题:C++ CData::XAddr方法的具体用法?C++ CData::XAddr怎么用?C++ CData::XAddr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CData的用法示例。


在下文中一共展示了CData::XAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SynthesizeUsingPM

/*
 * Synthesis using pitch marks.
 *
 * Derived instances of FBAproc should override method
 * SynthesizePM() to add the desired functionality
 *
 * @return O_K if successfull, NOT_EXEC otherwise
 */
INT16 CGEN_VPROTECTED CFBAproc::SynthesizeUsingPM(data *idFea, data *idPm, data *idSyn) {
  CData   *idExcite    = NULL;
  FLOAT64 *excitation  = NULL;
  FLOAT64 *synthesis   = NULL;
  INT32    nSamples    = 0;
  INT16    nPer        = 0;
  INT32    nCompVuv    = idFea->FindComp("v/uv");
  INT16    nCompFea    = idFea->GetNNumericComps() - (nCompVuv >= 0 ? 1 : 0);
  INT32    iRecFea     = 0;
  INT32    nRecFea     = 0;

  AlignFramesToPitch(idPm, idFea, idFea);

  nRecFea = idFea->GetNRecs();

  if(m_bSynEnhancement) {
    for(iRecFea = 0; iRecFea < nRecFea; iRecFea++) {
      FeaEnhancement((FLOAT64*)idFea->XAddr(iRecFea,0), nCompFea);
    }
  }

  Smooth(idFea, idPm, idFea);

  // Generate modulated excitation
  ICREATEEX(CData,idExcite,"~idExcite",NULL);
  DLPASSERT(O_K==ModEx(idPm,idExcite));
  DLPASSERT(!idExcite->IsEmpty());

  nSamples = idExcite->GetNRecs();

  idSyn->Reset();
  idSyn->AddComp("syn", T_DOUBLE);
  idSyn->Allocate(nSamples);

  excitation = (FLOAT64*)idExcite->XAddr(0, 0);
  synthesis = (FLOAT64*)idSyn->XAddr(0, 0);

  for(INT32 currSample = 0, currPer = 0; (currSample < nSamples) && (currPer < idFea->GetNRecs()); currSample += nPer, currPer++) {
    nPer = (INT16)idPm->Dfetch(currPer,0);

    if(SynthesizeFrame((FLOAT64*)idFea->XAddr(currPer,0), nCompFea, excitation+currSample, nPer, synthesis+currSample) != O_K) {
      IDESTROY(idExcite);
      return IERROR(this,FBA_SYNTHESISE, currPer, 0,0);
    }
  }

  IDESTROY(idExcite);

  if (m_nMinLog != 0.0) for (INT32 i=0; i<idSyn->GetNRecs(); i++) *((FLOAT64*)idSyn->XAddr(0, 0)+i) *= exp(m_nMinLog);

  return O_K;
}
开发者ID:thias42,项目名称:dLabPro,代码行数:60,代码来源:fba_synt.cpp

示例2: AnalyzeFrame

/**
 * Analyse
 *
 * Derived instances of FBAproc should override method
 * Analyse() to add the desired functionality
 *
 * @return O_K if successfull, NOT_EXEC otherwise
 */
INT16 CGEN_PUBLIC CCPproc::AnalyzeFrame() {
  INT16 ret = O_K;

  if(!strcmp(m_lpsType, "MelFilter")) {
    CData* idCep = NULL;
    CData* idMel = NULL;
    ICREATEEX(CData, idCep, "~idCep", NULL);
    ICREATEEX(CData, idMel, "~idMel", NULL);
    if((ret = CMELproc::AnalyzeFrame()) != O_K) return ret;
    idMel->Select(m_idRealFrame, 0, m_nCoeff);
    if((ret = Mf2mcep(idMel, idCep, m_nCoeff)) != O_K) return ret;
    dlp_memmove(m_idRealFrame->XAddr(0, 0), idCep->XAddr(0, 0), m_nCoeff * sizeof(FLOAT64));
    IDESTROY(idMel);
    IDESTROY(idCep);
  } else {
    if(!strcmp(m_lpsWarptype, "time")) {
      if(!strcmp(m_lpsType, "BurgLPC")) {
        dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MLPC_BURG_MCEP);
      } else if(!strcmp(m_lpsType, "LevinsonLPC")) {
        dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MLPC_LEVI_MCEP);
      } else if(!strcmp(m_lpsType, "Uels")) {
        dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_MCEP_UELS);
      } else if(!strcmp(m_lpsType, "LogFFT")) {
        dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64));
        if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0),(FLOAT64*)m_idImagFrame->XAddr(0, 0),m_nLen,FALSE)) != O_K) {
          if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0);
          return NOT_EXEC;
        }
        LN();
        if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) {
          if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0);
          return NOT_EXEC;
        }
        for(INT32 i = 1; i < m_nCoeff; i++) {
          ((FLOAT64*)m_idRealFrame->XAddr(0, 0))[i] *= 2.0;
        }
      } else {
        IERROR(this,ERR_NULLINST,0,0,0);
        return NOT_EXEC;
      }
    } else {
      if(!strcmp(m_lpsType, "BurgLPC")) {
        if(!strcmp(m_lpsWarptype, "lpc")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_MLPC_MCEP);
        } else if(!strcmp(m_lpsWarptype, "cepstrum")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_CEP_MCEP);
        } else if(!strcmp(m_lpsWarptype, "none")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_BURG_CEP);
        } else {
          IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0);
          return NOT_EXEC;
        }
      } else if(!strcmp(m_lpsType, "LevinsonLPC")) {
        if(!strcmp(m_lpsWarptype, "lpc")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_MLPC_MCEP);
        } else if(!strcmp(m_lpsWarptype, "cepstrum")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen
              / 2, m_nPfaLambda, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_CEP_MCEP);
        } else if(!strcmp(m_lpsWarptype, "none")) {
          dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nWlen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, 0.0, -m_nMinLog, DLM_CALCCEP_METHOD_S_LPC_LEVI_CEP);
        } else {
          IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0);
          return NOT_EXEC;
        }
      } else if(!strcmp(m_lpsType, "Uels")) {
        if((ret = dlm_calcmcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nCoeff,
            m_nPfaLambda, exp(-m_nMinLog), DLM_CALCCEP_METHOD_S_MCEP_UELS)) != O_K) {
          return NOT_EXEC;
        }
      } else if(!strcmp(m_lpsType, "LogFFT")) {
        dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64));
        if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, FALSE)) != O_K) {
          if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0);
          return NOT_EXEC;
        }
        LN();
        if(!strcmp(m_lpsWarptype, "lpc")) {
          IERROR(this, CP_WARPTYPE, m_lpsWarptype, 0, 0);
          return NOT_EXEC;
        } else if(!strcmp(m_lpsWarptype, "cepstrum")) {
          dlp_memset(m_idImagFrame->XAddr(0, 0), 0L, m_nLen * sizeof(FLOAT64));
          if((ret = dlm_fft((FLOAT64*)m_idRealFrame->XAddr(0, 0), (FLOAT64*)m_idImagFrame->XAddr(0, 0), m_nLen, TRUE)) != O_K) {
            if(ret == ERR_MDIM) IERROR(this, FBA_BADFRAMELEN, m_nLen, "FFT", 0);
            return NOT_EXEC;
          }
          dlm_cep2mcep((FLOAT64*)m_idRealFrame->XAddr(0, 0), m_nLen, (FLOAT64*)m_idRealFrame->XAddr(0, 0),
              m_nCoeff, m_nPfaLambda, NULL);
//.........这里部分代码省略.........
开发者ID:gitgun,项目名称:dLabPro,代码行数:101,代码来源:cp_work.cpp


注:本文中的CData::XAddr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。