Better WMP visualizations (2) (1 Viewer)

Symphy

Retired Team Member
  • Premium Supporter
  • August 25, 2007
    501
    151
    Groningen
    Home Country
    Netherlands Netherlands
    Hi there!

    It seems that the wave data supplied to WMP visualizations is completely wrong. (Tested with the BetterBars viz from WMPPlugins.com). Allthough probably not used much, here's an suggestion:

    Code:
    ....
    // Convert float value between -1 and 1 to 0 and 255
    float val = (buf[i] + 1f) * 127.5f;
    
    if (val < 0)
       val = 0;
    else if (val > 255)
       val = 255;
    
    // Left Channel
    if (i % 2 == 0)
    {
       audioData[x] = (byte)val;
    }
    // Right Channel
    else
    {
       audioData[x + 1024] = (byte)val;
       x++;
    }
    ....

    Regards,
    Symph
     

    Users who are viewing this thread

    Top Bottom