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

📄 dspd_03.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/algo/DisplayData/dspd_03.cc// version: $Id: dspd_03.cc,v 1.4 2001/11/29 21:20:10 gao Exp $//// isip include files//#include "DisplayData.h"//------------------------------------------------------------------// these methods have to be in the same file so they can use the same// static parser pointer//------------------------------------------------------------------// declare a static sof parser pointer//static SofParser* parser_d = (SofParser*)NULL;// method: setParser//// arguments://  SofParser* parser: (input) sof file object//// return: a boolean value indicating status//// this method sets the parser from the parent object to be used in// the next readData method.//boolean DisplayData::setParser(SofParser* parser_a) {  // set the parser  //  parser_d = parser_a;  // exit gracefully  //  return true;}// method: read//// arguments://  Sof& sof: (input) sof file object//  long tag: (input) sof object instance tag//  const String& name: (input) sof object instance name//// return: a boolean value indicating status//// this method has the object, with specified name and tag, read// itself from an Sof file//boolean DisplayData::read(Sof& sof_a, long tag_a, const String& name_a) {  // read the instance of the object from the Sof file  //  if (!sof_a.find(name_a, tag_a)) {    return false;  }    // read the actual data from the sof file  //  if (!readData(sof_a)) {    return false;  }    // exit gracefully  //  return true;  }// method: readData//// arguments://  Sof& sof: (input) sof file object//  const String& pname: (input) parameter name//  long size: (input) size in bytes of object (or full_size)//  boolean param: (input) is the parameter name in the file?//  boolean nested: (input) are we nested?//// return: a boolean indicating status//// this method has the object read itself from an Sof file. it assumes// that the Sof file is already positioned correctly.//boolean DisplayData::readData(Sof& sof_a, const String& pname_a,			   long size_a, boolean param_a,			   boolean nested_a) {  // we need a parser  //   if (parser_d == (SofParser*)NULL) {    // initialize the parser    //    parser_d = new SofParser;    // check if the object is nested    //    if (nested_a) {      parser_d->setNest();    }        // load the parse    //    if (!parser_d->load(sof_a, size_a)) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ,                           __FILE__, __LINE__, Error::WARNING);    }             }  // set the debug level of the parser  //  parser_d->setDebug(debug_level_d);  // read the algorithm  //  if (parser_d->isPresent(sof_a, PARAM_ALGORITHM)) {    if (!ALGO_MAP.readElementData((long&)algorithm_d, sof_a, PARAM_ALGORITHM,				  parser_d->getEntry(sof_a,						     PARAM_ALGORITHM))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    algorithm_d = DEF_ALGORITHM;  }  // read the implementation  //  if (parser_d->isPresent(sof_a, PARAM_IMPLEMENTATION)) {    if (!IMPL_MAP.readElementData((long&)implementation_d, sof_a,				  PARAM_IMPLEMENTATION,				  parser_d->getEntry(sof_a,						     PARAM_IMPLEMENTATION))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    implementation_d = DEF_IMPLEMENTATION;  }  // read the number  //  if (parser_d->isPresent(sof_a, PARAM_NUMBER)) {    if (!number_d.readData(sof_a, PARAM_NUMBER,			    parser_d->getEntry(sof_a, PARAM_NUMBER))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    number_d = DEF_NUMBER;  }  // read the label  //  if (parser_d->isPresent(sof_a, PARAM_LABEL)) {    if (!label_d.readData(sof_a, PARAM_LABEL,			    parser_d->getEntry(sof_a, PARAM_LABEL))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    label_d.assign(DEF_LABEL);  }  // read the prefix  //  if (parser_d->isPresent(sof_a, PARAM_PREFIX)) {    if (!prefix_d.readData(sof_a, PARAM_PREFIX,			    parser_d->getEntry(sof_a, PARAM_PREFIX))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    prefix_d.assign(DEF_PREFIX);  }  // read the suffix  //  if (parser_d->isPresent(sof_a, PARAM_SUFFIX)) {    if (!suffix_d.readData(sof_a, PARAM_SUFFIX,			    parser_d->getEntry(sof_a, PARAM_SUFFIX))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::READ, __FILE__,			   __LINE__, Error::WARNING);    }  }  else {    suffix_d.assign(DEF_SUFFIX);  }  // read the debug level  //  if (parser_d->isPresent(sof_a, PARAM_DBGL)) {    if (!debug_level_d.readData(sof_a, PARAM_DBGL,				parser_d->getEntry(sof_a, PARAM_DBGL))) {      // delete the parser      //      delete parser_d;      parser_d = (SofParser*)NULL;            // return a warning message      //      return Error::handle(name(), L"readData", Error::IO,			   __FILE__, __LINE__, Error::WARNING);    }  }  else {    debug_level_d = DEF_DEBUG_LEVEL;  }  // check that all parameters are accounted for  //  if (!parser_d->checkParams(sof_a)) {    // delete the parser    //    delete parser_d;    parser_d = (SofParser*)NULL;    // return a warning message    //    return Error::handle(name(), L"readData", Error::IO,			 __FILE__, __LINE__, Error::WARNING);  }  // delete the parser  //  delete parser_d;  parser_d = (SofParser*)NULL;    // exit gracefully  //  return true;}

⌨️ 快捷键说明

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