diff options
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_plugin.c | 2 | ||||
-rw-r--r-- | libao2/pl_delay.c | 16 | ||||
-rw-r--r-- | libao2/pl_resample.c | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/libao2/ao_plugin.c b/libao2/ao_plugin.c index 72910062f5..9c84ce4d05 100644 --- a/libao2/ao_plugin.c +++ b/libao2/ao_plugin.c @@ -159,7 +159,7 @@ static int init(int rate,int channels,int format,int flags){ 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); diff --git a/libao2/pl_delay.c b/libao2/pl_delay.c index 70c5a37c69..3d0f457dc4 100644 --- a/libao2/pl_delay.c +++ b/libao2/pl_delay.c @@ -101,18 +101,16 @@ static void reset(){ // 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; diff --git a/libao2/pl_resample.c b/libao2/pl_resample.c index e7b2e21d21..3cc0b9beaf 100644 --- a/libao2/pl_resample.c +++ b/libao2/pl_resample.c @@ -91,8 +91,8 @@ static int control(int cmd,int arg){ 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; |