]> git.sesse.net Git - mlt/commitdiff
bugfix in waveform method
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 29 Aug 2004 22:44:48 +0000 (22:44 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 29 Aug 2004 22:44:48 +0000 (22:44 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@398 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c

index 204eaae94a2ffd8c046d6763f6c2afaa953d20a7..46c2aaebc4c29d6eea3f0c425e7e12b42188acd7 100644 (file)
@@ -371,7 +371,7 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, double fps, int w, int h
                for ( j = 0; j < channels; j++ )
                {
                        /* the height of a "bar" is the ratio of the sample multiplied by the vertical resolution */
-                       int pcm_scaled = ( int )( ( double )( *pcm ) / 32767 * vertical_resolution );
+                       int pcm_scaled = ( int )( ( double )( *pcm ) / 32768 * vertical_resolution / 2 );
                        int height = pcm_scaled < 0 ? -pcm_scaled : pcm_scaled;
                        int offset = j * samples * vertical_resolution;
                        int displacement = pcm_scaled < 0 ? ( vertical_resolution / 2 ) : ( vertical_resolution / 2 - pcm_scaled );
@@ -383,6 +383,7 @@ unsigned char *mlt_frame_get_waveform( mlt_frame this, double fps, int w, int h
                        pcm++;
                }
        }
+
        return bitmap;
 }