// file: $isip_ifc/class/algo/Constant/const_05.cc // version: $Id: const_05.cc 10532 2006-03-29 21:26:30Z raghavan $ // // isip include files // #include "Constant.h" // method: apply // // arguments: // Vector& output: (output) output data // const Vector< CircularBuffer >& input: (input) input data // // return: a bool8 value indicating status // // this method calls the appropriate computation methods // bool8 Constant::apply(Vector& output_a, const Vector< CircularBuffer >& input_a) { // start the debugging output // displayStart(this); // add one frame to indicator we process one frame // frame_index_d++; // calculate the whole frames needed to process // float64 num_frames = signal_duration_d / frame_dur_d; int32 frame = (int32)Integral::round(num_frames); // determine the number of input channels and force the output to be // that number // int32 len = input_a.length(); output_a.setLength(len); data_d.setLength(len); // branch in the implementation: WRITE // if (implementation_d == WRITE) { if (frame_index_d != frame - 1) { // loop over the channels // for (int32 c = 0; c < len; c++) { // display the channel number // displayChannel(c); output_a(c).assign(input_a(c)(0)); data_d(c).assign(input_a(c)(0)); } // possibly display the data // display(output_a, input_a, name()); return true; } // write output to a file // computeWrite(output_a, input_a); } // implementation: READ // else if (implementation_d == READ) { // read input from a file // computeRead(output_a, input_a); } // implementation: UNKNOWN // else { return Error::handle(name(), L"apply", ERR_UNSUPM, __FILE__, __LINE__); } // finish the debugging output // displayFinish(this); // exit gracefully // return true; }