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

📄 out_06.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
字号:
// file: $isip/class/algo/Output/out_06.cc// version: $Id: out_06.cc,v 1.3 2002/07/16 16:36:29 gao Exp $//// isip include files//#include "Output.h"// method: computeFeatures//// arguments://  Vector<AlgorithmData>& output: (output) output data//  const Vector< CircularBuffer<AlgorithmData> >& input: (input) input data//// return: a boolean value indicating status//// this method write out features data//boolean Output::computeFeatures(Vector<AlgorithmData>& output_a,				const Vector< CircularBuffer<AlgorithmData> >&				input_a) {  if (implementation_d != FEATURES) {    return Error::handle(name(), L"computeFeatures", ERR_UNKIMP,			 __FILE__, __LINE__);  }  // determine the number of input channels and force the output to be  // that number  //  long len = input_a.length();  output_a.setLength(len);  // loop over the channels and call the compute method  //  for (long c = 0; c < len; c++) {        // display the channel number    //    displayChannel(c);        // copy the data    //    output_a(c).assign(input_a(c)(0));    // possibly display the data    //    display(output_a(c), input_a(c)(0), name());  }  AlgorithmData::DATA_TYPE dtype = input_a(0)(0).getDataType() ;      if (dtype == AlgorithmData::VECTOR_FLOAT) {    // write the data    //    feature_output_d.writeFeatureData(output_a);  }  else {    return Error::handle(name(), L"computeFeatures",			 ERR_UNKIMP, __FILE__, __LINE__);  }      // possibly display the data  //    display(output_a, input_a, name());    // exit gracefully  //  return true;}// method: computeSampledData//// arguments://  Vector<AlgorithmData>& output: (output) output data//  const Vector< CircularBuffer<AlgorithmData> >& input: (input) input data//// return: a boolean value indicating status//// this method write out the sampled data//boolean Output::computeSampledData(Vector<AlgorithmData>& output_a,				   const Vector< CircularBuffer<AlgorithmData> >& input_a) {  if (implementation_d != SAMPLED_DATA) {    return Error::handle(name(), L"computeSampledData", ERR_UNKIMP,			 __FILE__, __LINE__);  }  // determine the number of input channels and force the output to be  // that number  //  long len = input_a.length();  output_a.setLength(len);  // loop over the channels and call the compute method  //  for (long c = 0; c < len; c++) {        // display the channel number    //    displayChannel(c);        // copy the data    //    output_a(c).assign(input_a(c)(0));    // possibly display the data    //    display(output_a(c), input_a(c)(0), name());  }    AlgorithmData::DATA_TYPE dtype = input_a(0)(0).getDataType() ;  // calculate the whole frames needed to process  //  double  num_frames = signal_duration_d / frame_dur_d;  long frame = (long)Integral::round(num_frames);    if (dtype == AlgorithmData::VECTOR_FLOAT) {        // write the data    //      Vector <VectorFloat> temp;      temp.setLength(output_a.length());      for (long i = 0; i < output_a.length(); i++) {	temp(i).assign(output_a(i).getVectorFloat());		if (leftover_samps_d == 0) {	}	else if (leftover_samps_d < output_a(i).getVectorFloat().length() &&		 dmode_d == SAMPLE_BASED && frame_index_d == frame - 1) {	  temp(i).setLength(leftover_samps_d);	}      }      audio_output_d.writeAudioData(temp);  }  else {    return Error::handle(name(), L"computeSampledData", ERR_UNKIMP,			 __FILE__, __LINE__);  }    // possibly display the data  //  display(output_a, input_a, name());      // exit gracefully  //  return true;}

⌨️ 快捷键说明

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