// file: exft_conf_0.cc
//

// isip include files
//
#include "extract_feature.h"
#include "extract_feature_constants.h"
 
// method: config_frontend_cc
//
// arguments: none
//
// return: none
//
// this method configures the frontend according the parameters read
//
logical_1 Extract_feature::config_frontend_cc() {

  // indicate whether user selected -energy as a parameter
  //
  if (num_coeffs_d[EXTF_ALGO_MEAN] > 0)
     include_energy_d = ISIP_TRUE;
  else
     include_energy_d = ISIP_FALSE;

  // check bounds on window and frame durations as well as thresholds and
  // sample frequency
  //
  if ((frame_dur_d < (float_8)0.0) || (window_dur_d < (float_8)0.0) ||
      (sample_freq_d < (float_8)0.0)) {

    // output error message and exit
    //
    fprintf(stderr, "Extract_feature : all values must be greater than zero\n");

    exit(ISIP_PROTO_ERROR);
  }

  // determine the size of the vector
  //
  vector_size_d = 0;
  for (int_4 i=0; i < EXTF_NUM_ALGORITHMS; i++) {
    vector_size_d += num_coeffs_d[i];
  }

  vector_first_d = vector_size_d;
  
  if (delta_d == ISIP_TRUE) {
    vector_size_d += vector_first_d;
  }
  if (delta_delta_d == ISIP_TRUE) {
    vector_size_d += vector_first_d;
  }
  
  // determine the number of samples that will make up a window of data
  // and the number of samples that will make up a frame of data
  //
  window_num_samples_d = (int_4)(window_dur_d * EXTF_MSEC_TO_SEC
				 * sample_freq_d);
  frame_num_samples_d = (int_4)(frame_dur_d * EXTF_MSEC_TO_SEC
				* sample_freq_d);

  // exit gracefully
  //
  return ISIP_TRUE;
}
