[vlc-devel] karaoke filter

Ilkka Ollakka ileoo at videolan.org
Thu Apr 14 17:08:49 CEST 2011


On Thu, Apr 14, 2011 at 11:00:31PM +0800, 郭宇宏 wrote:
> Yes, i check the problem of the filter.

> And i made a new patch of the filter *karaoke and sweep.*

Hi,

> From 6e85c56990a90f84049485f03942bd8c224d2852 Mon Sep 17 00:00:00 2001
> From: yuhong <yuhong.guo at gmail.com>
> Date: Thu, 14 Apr 2011 22:56:08 +0800
> Subject: [PATCH] karaoke and sweep audio filters

> + * DoWork : Do karaoke filter
> + *****************************************************************************/
> +static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
> +{
> +   int i, i_chan;
> +   int i_samples = p_in_buf->i_nb_samples/4;
> +   int i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
> +   float *p_in =  (float*)p_in_buf->p_buffer;
> +
> +   /* filter calculation */
> +   for( i = 0; i < i_samples; i+=i_channels) {
> +          p_in[i] = (p_in[i] - p_in[i+1]) * 0.7;
> +          p_in[i+1] = p_in[i];
> +   }

What if theres only mono channel? your code seems to assume that theres
allways atleast two channels.

-- 
Ilkka Ollakka
A penny saved is ridiculous.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110414/5bf62e3c/attachment.sig>


More information about the vlc-devel mailing list