changeset 544:c666e8e0696a

style
author Ulf.Hammarqvist@gmail.com
date Thu, 29 Mar 2012 19:43:36 +0000
parents cd2f402f3bd7
children e63fbe19b255
files branches/carfac_cpp/src/AGC.cpp branches/carfac_cpp/src/AGC.h branches/carfac_cpp/src/CAR.cpp branches/carfac_cpp/src/CAR.h branches/carfac_cpp/src/CARFAC.cpp branches/carfac_cpp/src/CARFAC.h branches/carfac_cpp/src/CARFAC_common_typedefs.h branches/carfac_cpp/src/IHC.cpp branches/carfac_cpp/src/IHC.h
diffstat 9 files changed, 116 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/branches/carfac_cpp/src/AGC.cpp	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/AGC.cpp	Thu Mar 29 19:43:36 2012 +0000
@@ -1,9 +1,11 @@
 #include "AGC.h"
 
-AGC_coefficients::	AGC_coefficients(AGC_parameters* AGC_params, float fs, int n_ch){
-	// TODO stuff goes here
+AGC_coefficients::AGC_coefficients(AGC_parameters* AGC_params, float fs, int n_ch)
+{
+  // TODO stuff goes here
 }
 
-AGC_coefficients::~AGC_coefficients() {
-	// TODO Auto-generated destructor stub
+AGC_coefficients::~AGC_coefficients()
+{
+  // TODO Auto-generated destructor stub
 }
--- a/branches/carfac_cpp/src/AGC.h	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/AGC.h	Thu Mar 29 19:43:36 2012 +0000
@@ -5,36 +5,36 @@
 
 class AGC_parameters {
 public:
-	AGC_parameters(){
-		n_stages = 4; // redundant?
-		time_constants = {0.002*1, 0.002*4, 0.002*16, 0.002*64};
-		AGC_stage_gain = 2;
-		decimation = {8, 2, 2, 2};
-		AGC1_scales = {1.0, 1.4,  2.0, 2.8};
-		AGC2_scales = {1.6, 2.25, 3.2, 4.5};
-		detect_scale = 0.25;
-		AGC_mix_coeff = 0.5;
-	}
+  AGC_parameters()
+  {
+    n_stages_ = 4; // redundant?
+    time_constants_ = {0.002*1, 0.002*4, 0.002*16, 0.002*64};
+    agc_stage_gain_ = 2;
+    decimation_ = {8, 2, 2, 2};
+    agc1_scales_ = {1.0, 1.4,  2.0, 2.8};
+    agc2_scales_ = {1.6, 2.25, 3.2, 4.5};
+    detect_scale_ = 0.25;
+    agc_mix_coeff_ = 0.5;
+  }
 
-	virtual ~AGC_parameters(){}
+  virtual ~AGC_parameters(){}
 
-	int n_stages;
-	FloatArray time_constants;
-	float AGC_stage_gain;
-	FloatArray decimation;
-	FloatArray AGC1_scales;
-	FloatArray AGC2_scales;
-	float detect_scale;
-	float AGC_mix_coeff;
-
+  int n_stages_;
+  FloatArray time_constants_;
+  float agc_stage_gain_;
+  FloatArray decimation_;
+  FloatArray agc1_scales_;
+  FloatArray agc2_scales_;
+  float detect_scale_;
+  float agc_mix_coeff_;
 };
 
 class AGC_coefficients {
 public:
-	AGC_coefficients(AGC_parameters*, float, int);
-	virtual ~AGC_coefficients();
+  AGC_coefficients(AGC_parameters*, float, int);
+  virtual ~AGC_coefficients();
 private:
-	AGC_coefficients(){}
+  AGC_coefficients(){}
 };
 
 #endif /* AGC_H_ */
--- a/branches/carfac_cpp/src/CAR.cpp	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/CAR.cpp	Thu Mar 29 19:43:36 2012 +0000
@@ -1,10 +1,12 @@
 #include "CAR.h"
 #include "CARFAC_common_typedefs.h"
 
-CAR_coefficients::CAR_coefficients(CAR_parameters* CAR_params, float fs, FloatArray pole_freqs) {
-	// TODO stuff goes here
+CAR_coefficients::CAR_coefficients(CAR_parameters* CAR_params, float fs, FloatArray pole_freqs)
+{
+  // TODO stuff goes here
 }
 
-CAR_coefficients::~CAR_coefficients() {
-	// TODO Auto-generated destructor stub
+CAR_coefficients::~CAR_coefficients()
+{
+  // TODO Auto-generated destructor stub
 }
--- a/branches/carfac_cpp/src/CAR.h	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/CAR.h	Thu Mar 29 19:43:36 2012 +0000
@@ -2,43 +2,44 @@
 #define CAR_H_
 
 #include "CARFAC_common_typedefs.h"
-#include <math.h>
+#include <cmath>
 
 class CAR_parameters {
 public:
-	CAR_parameters(){
-		velocity_scale = 0.2;
-		v_offset = 0.01;
-		v2_corner = 0.2;
-		v_damp_max = 0.01;
-		min_zeta = 0.10;
-		first_pole_theta = 0.085*PI;
-		zero_ratio = sqrt(2);
-		high_f_damping_compression = 0.5;
-		ERB_per_step = 0.5;
-		min_pole_Hz = 30;
-	}
-	virtual ~CAR_parameters(){}
+  CAR_parameters()
+  {
+    velocity_scale_ = 0.2;
+    v_offset_ = 0.01;
+    v2_corner_ = 0.2;
+    v_damp_max_ = 0.01;
+    min_zeta_ = 0.10;
+    first_pole_theta_ = 0.085*kPi;
+    zero_ratio_ = sqrt(2);
+    high_f_damping_compression_ = 0.5;
+    erb_per_step_ = 0.5;
+    min_pole_Hz_ = 30;
+  }
 
-	float velocity_scale;
-	float v_offset;
-	float v2_corner;
-	float v_damp_max;
-	float min_zeta;
-	float first_pole_theta;
-	float zero_ratio;
-	float high_f_damping_compression;
-	float ERB_per_step;
-	float min_pole_Hz;
+  virtual ~CAR_parameters(){}
 
+  float velocity_scale_;
+  float v_offset_;
+  float v2_corner_;
+  float v_damp_max_;
+  float min_zeta_;
+  float first_pole_theta_;
+  float zero_ratio_;
+  float high_f_damping_compression_;
+  float erb_per_step_;
+  float min_pole_Hz_;
 };
 
 class CAR_coefficients{
 public:
-	CAR_coefficients(CAR_parameters*, float, FloatArray);
-	virtual ~CAR_coefficients();
+  CAR_coefficients(CAR_parameters*, float, FloatArray);
+  virtual ~CAR_coefficients();
 private:
-	CAR_coefficients(){}
+  CAR_coefficients(){}
 };
 
 #endif /* CAR_H_ */
--- a/branches/carfac_cpp/src/CARFAC.cpp	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/CARFAC.cpp	Thu Mar 29 19:43:36 2012 +0000
@@ -5,34 +5,33 @@
 
 #include "CARFAC_common_typedefs.h"
 
-CARFAC::CARFAC(int fs = DEFAULT_FS,
-		CAR_parameters* _CAR_params = new CAR_parameters(),
-		IHC_parameters* _IHC_params = new IHC_parameters(),
-		AGC_parameters* _AGC_params = new AGC_parameters(),
-		float ERB_break_freq = DEFAULT_ERB_break_freq,
-		float ERB_Q = DEFAULT_ERB_Q){
+CARFAC::CARFAC(int fs = kDefaultFs,
+              CAR_parameters* car_params = new CAR_parameters(),
+              IHC_parameters* ihc_params = new IHC_parameters(),
+              AGC_parameters* agc_params = new AGC_parameters(),
+              float erb_break_freq = kDefaultErbBreakFreq,
+              float erb_q = kDefaultErbQ){
 
-	// for now, design is to take ownership. Preferences? Make copies, call by value, etc?
-	CAR_params = _CAR_params;
-	IHC_params = _IHC_params;
-	AGC_params = _AGC_params;
+  // for now, design is to take ownership. Preferences? Make copies, call by value, etc?
+  car_params_ = car_params;
+  ihc_params_ = ihc_params;
+  agc_params_ = agc_params;
 
-	FloatArray pole_freqs; //TODO: do it
-	CAR_coeffs = new CAR_coefficients(CAR_params, fs, pole_freqs);
+  FloatArray pole_freqs; //TODO: do it
+  car_coeffs_ = new CAR_coefficients(car_params_, fs, pole_freqs);
 
-	int n_ch = 10; // TODO: do the design loops
-	AGC_coeffs = new AGC_coefficients(AGC_params, fs, n_ch);
+  int n_ch = 10; // TODO: do the design loops
+  agc_coeffs_ = new AGC_coefficients(agc_params_, fs, n_ch);
 
-	IHC_coeffs = new IHC_coefficients(IHC_params, fs, n_ch);
+  ihc_coeffs_ = new IHC_coefficients(ihc_params_, fs, n_ch);
 }
 
 CARFAC::~CARFAC() {
-	delete CAR_coeffs;
-	//delete CAR_params;
+  delete car_coeffs_;
+  delete ihc_coeffs_;
+  delete agc_coeffs_;
 
-	delete IHC_coeffs;
-	//delete IHC_params;
-
-	delete AGC_coeffs;
-	//delete AGC_params;
+  //delete car_params_;
+  //delete ihc_params_;
+  //delete agc_params_;
 }
--- a/branches/carfac_cpp/src/CARFAC.h	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/CARFAC.h	Thu Mar 29 19:43:36 2012 +0000
@@ -7,17 +7,17 @@
 
 class CARFAC{
 public:
-	CARFAC(int, CAR_parameters*, IHC_parameters*, AGC_parameters*, float, float);
-	virtual ~CARFAC();
+  CARFAC(int, CAR_parameters*, IHC_parameters*, AGC_parameters*, float, float);
+  virtual ~CARFAC();
 
-	CAR_coefficients* CAR_coeffs;
-	CAR_parameters* CAR_params;
+  CAR_coefficients* car_coeffs_;
+  CAR_parameters* car_params_;
 
-	IHC_coefficients* IHC_coeffs;
-	IHC_parameters* IHC_params;
+  IHC_coefficients* ihc_coeffs_;
+  IHC_parameters* ihc_params_;
 
-	AGC_coefficients* AGC_coeffs;
-	AGC_parameters* AGC_params;
+  AGC_coefficients* agc_coeffs_;
+  AGC_parameters* agc_params_;
 };
 
 #endif /* CARFAC_H_ */
--- a/branches/carfac_cpp/src/CARFAC_common_typedefs.h	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/CARFAC_common_typedefs.h	Thu Mar 29 19:43:36 2012 +0000
@@ -5,10 +5,10 @@
 
 typedef std::vector<float> FloatArray;
 
-const double DEFAULT_ERB_break_freq = 165.3;
-const double DEFAULT_ERB_Q = 1000/(24.7*4.37);
-const double DEFAULT_FS = 22050;
+const double kDefaultErbBreakFreq = 165.3;
+const double kDefaultErbQ = 1000/(24.7*4.37);
+const double kDefaultFs = 22050;
 
-const double PI = 3.1415926;
+const double kPi = 3.1415926;
 
 #endif /* CARFAC_COMMON_TYPEDEFS_H_ */
--- a/branches/carfac_cpp/src/IHC.cpp	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/IHC.cpp	Thu Mar 29 19:43:36 2012 +0000
@@ -1,9 +1,9 @@
 #include "IHC.h"
 
 IHC_coefficients::IHC_coefficients(IHC_parameters* IHC_params, float fs, int n_ch){
-	// TODO stuff!
+  // TODO stuff!
 }
 
 IHC_coefficients::~IHC_coefficients() {
-	// TODO Auto-generated destructor stub
+  // TODO Auto-generated destructor stub
 }
--- a/branches/carfac_cpp/src/IHC.h	Wed Mar 28 20:26:15 2012 +0000
+++ b/branches/carfac_cpp/src/IHC.h	Thu Mar 29 19:43:36 2012 +0000
@@ -4,29 +4,30 @@
 // not sure how to best deal with the "three style" IHC - ulha
 class IHC_parameters {
 public:
-	IHC_parameters()
-	{
-		tau_lpf = 0.000080;
-		tau1_out = 0.020;
-		tau1_in = 0.020;
-		tau2_out = 0.005;
-		tau2_in = 0.005;
-	}
-	virtual ~IHC_parameters(){}
+  IHC_parameters()
+  {
+    tau_lpf_ = 0.000080;
+    tau1_out_ = 0.020;
+    tau1_in_ = 0.020;
+    tau2_out_ = 0.005;
+    tau2_in_ = 0.005;
+  }
 
-	float tau_lpf;
-	float tau1_out;
-	float tau1_in;
-	float tau2_out;
-	float tau2_in;
+  virtual ~IHC_parameters(){}
+
+  float tau_lpf_;
+  float tau1_out_;
+  float tau1_in_;
+  float tau2_out_;
+  float tau2_in_;
 };
 
 class IHC_coefficients {
 public:
-	IHC_coefficients(IHC_parameters*, float, int);
-	virtual ~IHC_coefficients();
+  IHC_coefficients(IHC_parameters*, float, int);
+  virtual ~IHC_coefficients();
 private:
-	IHC_coefficients(){}
+  IHC_coefficients(){}
 };
 
 #endif /* IHC_H_ */