[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40911] trunk/blender/intern/audaspace/ intern/AUD_C-API.cpp: Sequencer audio waveform drawing fix, now assured to be within the strip bounds.
Campbell Barton
ideasman42 at gmail.com
Tue Oct 11 02:12:30 CEST 2011
Wouldn't it be better to clamp the drawing within the strip rather
then normalizing the displayed waveform?
On Tue, Oct 11, 2011 at 1:59 AM, Joerg Mueller <nexyon at gmail.com> wrote:
> Revision: 40911
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40911
> Author: nexyon
> Date: 2011-10-10 14:59:13 +0000 (Mon, 10 Oct 2011)
> Log Message:
> -----------
> Sequencer audio waveform drawing fix, now assured to be within the strip bounds.
>
> Modified Paths:
> --------------
> trunk/blender/intern/audaspace/intern/AUD_C-API.cpp
>
> Modified: trunk/blender/intern/audaspace/intern/AUD_C-API.cpp
> ===================================================================
> --- trunk/blender/intern/audaspace/intern/AUD_C-API.cpp 2011-10-10 14:56:09 UTC (rev 40910)
> +++ trunk/blender/intern/audaspace/intern/AUD_C-API.cpp 2011-10-10 14:59:13 UTC (rev 40911)
> @@ -1094,9 +1094,11 @@
> specs.specs = reader->getSpecs();
> int len;
> float samplejump = specs.rate / samples_per_second;
> - float min, max, power;
> + float min, max, power, overallmax;
> bool eos;
>
> + overallmax = 0;
> +
> for(int i = 0; i < length; i++)
> {
> len = floor(samplejump * (i+1)) - floor(samplejump * i);
> @@ -1121,6 +1123,11 @@
> buffer[i * 3 + 1] = max;
> buffer[i * 3 + 2] = sqrt(power) / len;
>
> + if(overallmax < max)
> + overallmax = max;
> + if(overallmax < -min)
> + overallmax = -min;
> +
> if(eos)
> {
> length = i;
> @@ -1128,6 +1135,14 @@
> }
> }
>
> + if(overallmax > 1.0f)
> + {
> + for(int i = 0; i < length * 3; i++)
> + {
> + buffer[i] /= overallmax;
> + }
> + }
> +
> return length;
> }
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>
--
- Campbell
More information about the Bf-committers
mailing list