Jump to content
  • Advertisement
Sign in to follow this  
rjbishop

[SlimDX] 2D Spectrum technique

This topic is 3560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

All, I am using SlimDX to help me graph a 96KHz wide spectrum from an audio source- and so far it's working fine. I have 2048 samples that are returned from a FFT, each sample representing dB gain across 47 Hz of the spectrum. I use a VertexBuffer to create 2048 LineList, and draw the spectrum across a panel that the user can vary the size on. I also need the ability to show the entire spectrum, or a fraction of the spectrum within this panel- so my strategy so far is to use the Device.Present(SourceRectangle, DestRectangle) method to control how much of the spectrum I present (i.e. ALL, or maybe only 1/16th) across the entire panel. My problem- I'm also drawing/labeling a "Grid" on the backbuffer before I draw the spectrum (among other things), and this grid gets "scaled" by the Device.Present(srcRect,DestRect) function (which I don't want to occur- it looks terrible) Obviously, I understand how this is happening, but I'm stumped how I can change this behavior. What I want is the ability to keep the Grid in the original 1/1 scale (knowing that I'll have to do some math in my code), but then allow DirectX to scale the spectrum view as needed. So how does one do this? I'm thinking instead of using Present() to do my scaling, I might need a 2d Transform for my spectrum, and zero transform for the grid? I'm such a newbie to DirectX and all the techniques, I'm just not sure what approach to take. Thanks in advance! And again, I LOVE SlimDX! -Reid-

Share this post


Link to post
Share on other sites
Advertisement
One thing you might want to look into is using a texture as a render target, and then scaling that with a StretchRect draw call. EasilyConfused talked about something similar in his journal for achieving resolution independence in your main draw code. I believe a similar system could work well here.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!