shithub: aubio

Download patch

ref: bafe71d4aff707869145b763043e36aaded03d02
parent: fddfa647d845149f90a4116483d287487f4b841c
author: Paul Brossier <piem@piem.org>
date: Tue Nov 3 11:22:39 EST 2009

src/temporal: indent

--- a/src/temporal/a_weighting.h
+++ b/src/temporal/a_weighting.h
@@ -79,7 +79,7 @@
   192000 Hz
 
 */
-uint_t aubio_filter_set_a_weighting (aubio_filter_t *f, uint_t samplerate);
+uint_t aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate);
 
 #ifdef __cplusplus
 }
--- a/src/temporal/biquad.c
+++ b/src/temporal/biquad.c
@@ -25,7 +25,8 @@
 
 uint_t
 aubio_filter_set_biquad (aubio_filter_t * f, lsmp_t b0, lsmp_t b1, lsmp_t b2,
-    lsmp_t a1, lsmp_t a2) {
+    lsmp_t a1, lsmp_t a2)
+{
   uint_t order = aubio_filter_get_order (f);
   lvec_t *bs = aubio_filter_get_feedforward (f);
   lvec_t *as = aubio_filter_get_feedback (f);
--- a/src/temporal/filter.c
+++ b/src/temporal/filter.c
@@ -80,21 +80,23 @@
 }
 
 /* The rough way: reset memory of filter between each run to avoid end effects. */
-void aubio_filter_do_filtfilt(aubio_filter_t * f, fvec_t * in, fvec_t * tmp) {
-  uint_t j,i=0;
+void
+aubio_filter_do_filtfilt (aubio_filter_t * f, fvec_t * in, fvec_t * tmp)
+{
+  uint_t j, i = 0;
   uint_t length = in->length;
   /* apply filtering */
-  aubio_filter_do(f,in);
-  aubio_filter_do_reset(f);
+  aubio_filter_do (f, in);
+  aubio_filter_do_reset (f);
   /* mirror */
   for (j = 0; j < length; j++)
-    tmp->data[i][length-j-1] = in->data[i][j];
+    tmp->data[i][length - j - 1] = in->data[i][j];
   /* apply filtering on mirrored */
-  aubio_filter_do(f,tmp);
-  aubio_filter_do_reset(f);
+  aubio_filter_do (f, tmp);
+  aubio_filter_do_reset (f);
   /* invert back */
   for (j = 0; j < length; j++)
-    in->data[i][j] = tmp->data[i][length-j-1];
+    in->data[i][j] = tmp->data[i][length - j - 1];
 }
 
 lvec_t *
@@ -131,8 +133,8 @@
 void
 aubio_filter_do_reset (aubio_filter_t * f)
 {
-  lvec_zeros(f->x);
-  lvec_zeros(f->y);
+  lvec_zeros (f->x);
+  lvec_zeros (f->y);
 }
 
 aubio_filter_t *
--- a/src/temporal/resampler.c
+++ b/src/temporal/resampler.c
@@ -22,49 +22,55 @@
 
 #if HAVE_SAMPLERATE
 
-#include <samplerate.h> /* from libsamplerate */
+#include <samplerate.h>         /* from libsamplerate */
 
 #include "aubio_priv.h"
 #include "fvec.h"
 #include "temporal/resampler.h"
 
-struct _aubio_resampler_t {
-	SRC_DATA  *proc;
-	SRC_STATE *stat;
-	smpl_t ratio;
-	uint_t type;
+struct _aubio_resampler_t
+{
+  SRC_DATA *proc;
+  SRC_STATE *stat;
+  smpl_t ratio;
+  uint_t type;
 };
 
-aubio_resampler_t * new_aubio_resampler(smpl_t ratio, uint_t type) {
-	aubio_resampler_t * s  = AUBIO_NEW(aubio_resampler_t);
-	int error = 0;
-	s->stat = src_new (type, 1, &error) ; /* only one channel */
-	s->proc = AUBIO_NEW(SRC_DATA);
-	if (error) AUBIO_ERR("%s\n",src_strerror(error));
-	s->ratio = ratio;
-	return s;
+aubio_resampler_t *
+new_aubio_resampler (smpl_t ratio, uint_t type)
+{
+  aubio_resampler_t *s = AUBIO_NEW (aubio_resampler_t);
+  int error = 0;
+  s->stat = src_new (type, 1, &error);  /* only one channel */
+  s->proc = AUBIO_NEW (SRC_DATA);
+  if (error)
+    AUBIO_ERR ("%s\n", src_strerror (error));
+  s->ratio = ratio;
+  return s;
 }
 
-void del_aubio_resampler(aubio_resampler_t *s) {
-	src_delete(s->stat);
-	AUBIO_FREE(s->proc);
-	AUBIO_FREE(s);
+void
+del_aubio_resampler (aubio_resampler_t * s)
+{
+  src_delete (s->stat);
+  AUBIO_FREE (s->proc);
+  AUBIO_FREE (s);
 }
 
-void aubio_resampler_do (aubio_resampler_t *s, 
-    fvec_t * input,  fvec_t * output) {
-	uint_t i ;
-	s->proc->input_frames = input->length;
-	s->proc->output_frames = output->length;
-	s->proc->src_ratio = (double)s->ratio;
-	for (i = 0 ; i< input->channels; i++) 
-	{
-		/* make SRC_PROC data point to input outputs */
-		s->proc->data_in = (float *)input->data[i];
-		s->proc->data_out= (float *)output->data[i];
-		/* do resampling */
-		src_process (s->stat, s->proc) ;
-	}
-}	
+void
+aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, fvec_t * output)
+{
+  uint_t i;
+  s->proc->input_frames = input->length;
+  s->proc->output_frames = output->length;
+  s->proc->src_ratio = (double) s->ratio;
+  for (i = 0; i < input->channels; i++) {
+    /* make SRC_PROC data point to input outputs */
+    s->proc->data_in = (float *) input->data[i];
+    s->proc->data_out = (float *) output->data[i];
+    /* do resampling */
+    src_process (s->stat, s->proc);
+  }
+}
 
 #endif /* HAVE_SAMPLERATE */
--- a/src/temporal/resampler.h
+++ b/src/temporal/resampler.h
@@ -45,10 +45,10 @@
   \param type libsamplerate resampling type
 
 */
-aubio_resampler_t * new_aubio_resampler(smpl_t ratio, uint_t type);
+aubio_resampler_t *new_aubio_resampler (smpl_t ratio, uint_t type);
 
 /** delete resampler object */
-void del_aubio_resampler(aubio_resampler_t *s);
+void del_aubio_resampler (aubio_resampler_t * s);
 
 /** resample input in output
 
@@ -57,7 +57,8 @@
   \param output output buffer of size N*ratio
 
 */
-void aubio_resampler_do (aubio_resampler_t *s, fvec_t * input,  fvec_t * output);
+void aubio_resampler_do (aubio_resampler_t * s, fvec_t * input,
+    fvec_t * output);
 
 #ifdef __cplusplus
 }