diff libaf/af_resample.c @ 8167:e8832e66babd

New features: -- Support for runtime cpu detection -- Stand alone compile of libaf -- Unlimited number of channels (compiletime switch) -- Sample format defined by bit-fields -- New formats: float, A-Law and mu-law -- Format conversion set in human readable format i.e. format=4:us_be to set 32 bit unsigned big endian output -- Format reporting in human readable format -- Volume control has only one parameter for setting the volume i.e. volume=-10.0:1:0:1 to set atenuation = -10dB
author anders
date Tue, 12 Nov 2002 12:33:56 +0000
parents a7fa2d14ee91
children fb88ccbc5ccc
line wrap: on
line diff
--- a/libaf/af_resample.c	Tue Nov 12 12:23:32 2002 +0000
+++ b/libaf/af_resample.c	Tue Nov 12 12:33:56 2002 +0000
@@ -9,18 +9,11 @@
 */
 
 /* This audio filter changes the sample rate. */
-
-#define PLUGIN
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <inttypes.h>
 
-#include "../config.h"
-#include "../mp_msg.h"
-#include "../libao2/afmt.h"
-
 #include "af.h"
 #include "dsp.h"
 
@@ -214,11 +207,11 @@
 
     // Set parameters
     af->data->nch    = n->nch;
-    af->data->format = AFMT_S16_NE;
+    af->data->format = AF_FORMAT_NE | AF_FORMAT_SI;
     af->data->bps    = 2;
     if(af->data->format != n->format || af->data->bps != n->bps)
       rv = AF_FALSE;
-    n->format = AFMT_S16_NE;
+    n->format = AF_FORMAT_NE | AF_FORMAT_SI;
     n->bps = 2;
 
     // Calculate up and down sampling factors
@@ -256,7 +249,7 @@
       // Design prototype filter type using Kaiser window with beta = 10
       if(NULL == w || NULL == s->w || 
 	 -1 == design_fir(s->up*L, w, &fc, LP|KAISER , 10.0)){
-	mp_msg(MSGT_AFILTER,MSGL_ERR,"[resample] Unable to design prototype filter.\n");
+	af_msg(AF_MSG_ERROR,"[resample] Unable to design prototype filter.\n");
 	return AF_ERROR;
       }
       // Copy data from prototype to polyphase filter
@@ -269,7 +262,7 @@
 	}
       }
       free(w);
-      mp_msg(MSGT_AFILTER,MSGL_V,"[resample] New filter designed up: %i down: %i\n", s->up, s->dn);
+      af_msg(AF_MSG_VERBOSE,"[resample] New filter designed up: %i down: %i\n", s->up, s->dn);
     }
 
     // Set multiplier and delay
@@ -289,12 +282,12 @@
     
     // Sanity check
     if(((int*)arg)[0] < 8000 || ((int*)arg)[0] > 192000){
-      mp_msg(MSGT_AFILTER,MSGL_ERR,"[resample] The output sample frequency must be between 8kHz and 192kHz. Current value is %i \n",((int*)arg)[0]);
+      af_msg(AF_MSG_ERROR,"[resample] The output sample frequency must be between 8kHz and 192kHz. Current value is %i \n",((int*)arg)[0]);
       return AF_ERROR;
     }
 
     af->data->rate=((int*)arg)[0]; 
-    mp_msg(MSGT_AFILTER,MSGL_V,"[resample] Changing sample rate to %iHz\n",af->data->rate);
+    af_msg(AF_MSG_VERBOSE,"[resample] Changing sample rate to %iHz\n",af->data->rate);
     return AF_OK;
   }
   return AF_UNKNOWN;