[vlc-devel] commit: Fixed PCM values given to projectm. (Laurent Aimar )

git version control git at videolan.org
Sun Dec 13 13:53:41 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Dec 13 13:21:28 2009 +0100| [745c790b436ed55581d249c62f5451e5842652b6] | committer: Laurent Aimar 

Fixed PCM values given to projectm.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=745c790b436ed55581d249c62f5451e5842652b6
---

 modules/visualization/projectm.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
index c74936f..42475fd 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -200,11 +200,17 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
     vlc_mutex_lock( &p_sys->lock );
     if( p_sys->i_buffer_size > 0 )
     {
-        p_sys->p_buffer[0] = 0;
         p_sys->i_nb_samples = __MIN( p_sys->i_buffer_size,
                                      p_in_buf->i_nb_samples );
+
+        const float *p_src = (float*)p_in_buf->p_buffer;
         for( int i = 0; i < p_sys->i_nb_samples; i++ )
-            p_sys->p_buffer[i] = p_in_buf->p_buffer[i];
+        {
+            float v = 0;
+            for( int j = 0; j < p_sys->i_channels; j++ )
+                v += p_src[p_sys->i_channels * i + j];
+            p_sys->p_buffer[i] = v / p_sys->i_channels;
+        }
     }
     vlc_mutex_unlock( &p_sys->lock );
 




More information about the vlc-devel mailing list