changeset 36397:44750c937ec8

Remove unused per-channel enable. It makes it hard to vectorize or otherwise optimize the code.
author reimar
date Sat, 26 Oct 2013 10:23:03 +0000
parents 49587a84cb91
children 4eb02d8a5095
files libaf/af_volume.c libaf/control.h
diffstat 2 files changed, 0 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_volume.c	Sat Oct 26 10:16:09 2013 +0000
+++ b/libaf/af_volume.c	Sat Oct 26 10:23:03 2013 +0000
@@ -43,7 +43,6 @@
 // Data for specific instances of this filter
 typedef struct af_volume_s
 {
-  int   enable[AF_NCH];		// Enable/disable / channel
   float	max[AF_NCH];		// Max Power level [dB]
   float level[AF_NCH];		// Gain level for each channel
   int soft;			// Enable/disable soft clipping
@@ -84,12 +83,6 @@
     s->fast = ((((af_cfg_t*)arg)->force & AF_INIT_FORMAT_MASK) ==
       AF_INIT_FLOAT) ? 0 : 1;
     return AF_OK;
-  case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_SET:
-    memcpy(s->enable,(int*)arg,AF_NCH*sizeof(int));
-    return AF_OK;
-  case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_GET:
-    memcpy((int*)arg,s->enable,AF_NCH*sizeof(int));
-    return AF_OK;
   case AF_CONTROL_VOLUME_SOFTCLIP | AF_CONTROL_SET:
     s->soft = *(int*)arg;
     return AF_OK;
@@ -136,13 +129,11 @@
     int16_t*    a   = (int16_t*)c->audio;	// Audio data
     int         len = c->len/2;			// Number of samples
     for(ch = 0; ch < nch ; ch++){
-      if(s->enable[ch]){
 	register int vol = (int)(255.0 * s->level[ch]);
 	for(i=ch;i<len;i+=nch){
 	  register int x = (a[i] * vol) >> 8;
 	  a[i]=av_clip_int16(x);
 	}
-      }
     }
   }
   // Machine is fast and data is floating point
@@ -151,7 +142,6 @@
     int       	len 	= c->len/4;		// Number of samples
     for(ch = 0; ch < nch ; ch++){
       // Volume control (fader)
-      if(s->enable[ch]){
 	for(i=ch;i<len;i+=nch){
 	  register float x 	= a[i];
 	  register float pow 	= x*x;
@@ -169,7 +159,6 @@
 	    x=av_clipf(x,-1.0,1.0);
 	  a[i] = x;
 	}
-      }
     }
   }
   return c;
@@ -188,7 +177,6 @@
     return AF_ERROR;
   // Enable volume control and set initial volume to 0dB.
   for(i=0;i<AF_NCH;i++){
-    ((af_volume_t*)af->setup)->enable[i] = 1;
     ((af_volume_t*)af->setup)->level[i]  = 1.0;
   }
   return AF_OK;
--- a/libaf/control.h	Sat Oct 26 10:16:09 2013 +0000
+++ b/libaf/control.h	Sat Oct 26 10:23:03 2013 +0000
@@ -156,9 +156,6 @@
 
 // Volume
 
-// Turn volume control on and off, arg is int*
-#define AF_CONTROL_VOLUME_ON_OFF	0x00000B00 | AF_CONTROL_FILTER_SPECIFIC
-
 // Turn soft clipping of the volume on and off, arg is binary
 #define AF_CONTROL_VOLUME_SOFTCLIP	0x00000C00 | AF_CONTROL_FILTER_SPECIFIC