changeset 4374:0a95c5074c50

Fixed sig 11 caused by resampling plugin, some cosmetic changes and speed improvements
author anders
date Sun, 27 Jan 2002 10:41:43 +0000
parents 4f36681c95f8
children bd108c2796ab
files libao2/ao_plugin.c libao2/pl_delay.c libao2/pl_resample.c
diffstat 3 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_plugin.c	Sun Jan 27 08:07:01 2002 +0000
+++ b/libao2/ao_plugin.c	Sun Jan 27 10:41:43 2002 +0000
@@ -159,7 +159,7 @@
 
   if(!ok) return 0;
 
-  // Allocate output buffer */
+  // Allocate output buffer
   if(ao_plugin_local_data.buf)
     free(ao_plugin_local_data.buf);
   ao_plugin_local_data.buf=malloc(MAX_OUTBURST);
--- a/libao2/pl_delay.c	Sun Jan 27 08:07:01 2002 +0000
+++ b/libao2/pl_delay.c	Sun Jan 27 10:41:43 2002 +0000
@@ -101,18 +101,16 @@
 // processes 'ao_plugin_data.len' bytes of 'data'
 // called for every block of data
 static int play(){
-  int i=0;
-  int j=0;
-  int k=0;
   // Copy end of prev block to begining of buffer
-  for(i=0;i<ao_plugin_cfg.pl_delay_len;i++,j++)
-    ((char*)pl_delay.data)[j]=((char*)pl_delay.delay)[i];
+  memcpy(pl_delay.data,pl_delay.delay,ao_plugin_cfg.pl_delay_len);
   // Copy current block except end
-  for(i=0;i<ao_plugin_data.len-ao_plugin_cfg.pl_delay_len;i++,j++,k++)
-    ((char*)pl_delay.data)[j]=((char*)ao_plugin_data.data)[k];
+  memcpy(pl_delay.data+ao_plugin_cfg.pl_delay_len,
+  	 ao_plugin_data.data,
+  	 ao_plugin_data.len-ao_plugin_cfg.pl_delay_len);
   // Save away end of current block for next call
-  for(i=0;i<ao_plugin_cfg.pl_delay_len;i++,k++)
-    ((char*)pl_delay.delay)[i]=((char*)ao_plugin_data.data)[k];
+  memcpy(pl_delay.delay,
+	 ao_plugin_data.data+ao_plugin_data.len-ao_plugin_cfg.pl_delay_len,
+	 ao_plugin_cfg.pl_delay_len);
   // Set output data block
   ao_plugin_data.data=pl_delay.data;
   return 1;
--- a/libao2/pl_resample.c	Sun Jan 27 08:07:01 2002 +0000
+++ b/libao2/pl_resample.c	Sun Jan 27 10:41:43 2002 +0000
@@ -91,8 +91,8 @@
     if(!pl_resample.data)
       return CONTROL_ERROR;
     ao_plugin_data.len = (int)((double)ao_plugin_data.len * 
-			     ((double)pl_resample.up)/
-			     ((double)pl_resample.dn));
+			     ((double)pl_resample.dn)/
+			     ((double)pl_resample.up));
     return CONTROL_OK;
   }
   return -1;