   Creating a Diagonal Waveform - Windows Media Player Visualization
  Howdy,    I've been playing around with creating a Windows Media Player Visualization which is included with the Windows SDK. When a Windows Media Player plugin (Visualization) is created the template that is generated by Visual Studio 2008 creates a horizontal waveform from left to right and displayes the change in waveform values. The code which accomplishes this is:case PRESET_BARS:   {  // Walk through the frequencies until we run out of levels or drawing surface.  for (int x = prc->left; x < prc->right && x < (SA_BUFFER_SIZE-1); ++x)  { int y = static_cast<int>(((prc->bottom - prc->top)/256.0f) * pLevels->frequency[0][x - (prc->left - 1)]); ::MoveToEx( hdc, x, prc->bottom, NULL );   ::LineTo(hdc, x, prc->bottom - y);   }   }   break;This code snippet is part of a Switch statement, each case in the switch statement represents a different type of visualization. In the template these are PRESET_BARS and PRESET_SCOPE.I am interested in creating a diagonal waveform. It is simple enough to create a verticle waveform simply by switching the x and y values.In the code snippet the y value is of interest as this is the value which accepts the waveform array and affects the horizontal line which is drawn across the screen.If a diagonal line is to be drawn it seems that both the x and y coordinates need to be affected by the waveform array while still keeping the angle of the diagonal line.Unfortunatly I have been unsuccessful at generating the diagonal waveform and information on the net on the subject of visualizations seems to be sparse.Is their anyone here who can point me in the right direction?Many Thanks =]   
  Hi EpicTesh.WMP Visualizations were the first graphical programs i started writing for fun before i started writing my game. I made two visualizations, the first one using GDI (like the SDK sample) then moved on to using OpenGL which allowed me to do much cooler effects. I have them uploaded on SaveFile but unfortunately it is down for upgrading, if you are interested i can send them to you.As for your problem, what you need to do is calculate the offset from the middle of the diagonal line and add that to both the x and y axis. It depends on how you want the waveform to be drawn, from the code you posted it looks like it will draw vertical bars along the bottom of the screen that rise to a height determined by the waveform. I'm not sure how you want this to be diagonal.If by diagonal you mean rotated to any angle, then OpenGL might be worth looking at.   ;  Hi XTAL256Thanks for the reply. I had not considered using OpenGL or GDI. I will most certainly look into it. I was also considering an offset to the diagonal line although this seems like quite a bit of maths (which isn't my strongest area) since the offset would be greater than the diagonal line while their would need to be an inverted offset below the diagonal line.It would be very much appreciated if you could send me your visualizations since I always learn best from examples. Let me know if you would like me to PM you my e-mail or if your simply posting a link when SaveFile is back online.Many Thanks   