cb_alloc_0.cc

来自「这是处理语音信号的程序」· CC 代码 · 共 50 行

CC
50 行
字号
// file: circular_buffer/cb_alloc_0.cc//// isip include files//#include "CircularBuffer.h"// method: allocation//// arguments: ////  int dim: (input) dimensions of circular buffer//  int num_elements: (input) maximum size of circular buffer//// return: none//// this method allocates memory for circular buffer.//void Circular_buffer::allocate_cc(int dim, int num_elements) {  // check if a buffer already exists  //  if (buf_d != (float_8**)NULL) {        for (int i = 0; i < dim_d; i++) {      delete [] buf_d[i];    }    delete [] buf_d;    delete [] idx_d;    delete [] num_d;  }  // allocate a buffer  //  size_d = num_elements;  dim_d = dim;    buf_d = new float_8*[dim_d];  idx_d = new int[dim_d];  num_d = new int[dim_d];  for (int i = 0; i < dim_d; i++) {    buf_d[i] = new float_8[size_d];    idx_d[i] = -1;    num_d[i] = 0;  }  // exit gracefully  //}

⌨️ 快捷键说明

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