Jump to content
  • Advertisement
Sign in to follow this  
Omaha

DirectSound Oscilloscope

This topic is 5464 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

I have some empty space on my main menu screen so I thought it would be a good waste of screen real estate and processing time to put a little oscilloscopic view of the music being played there, ala Star Control 2. It was here that I realized the DirectSound documentation specifically says not to attempt to read back from a sound buffer pointer obtained by getting the buffer position. Now short of keeping the music data resident in main memory, which I don't want to do since it is streamed by a different thread and stored locally only long enough to upload it into a direct sound buffer, does anyone have some suggestions for implementing this? I guess this would work but it seems like a hassle-filled way of doing it. Maybe what I'm trying to do is just naturally hassle-tacular. Ideas?

Share this post


Link to post
Share on other sites
Advertisement
A real oscilloscope deals with similraly streamed data, remember. So record your thread that is feeding the DSound buffer so that it also feeds a system side buffer. Have the oscilloscope read from that system side buffer (with exactly the same contents as the DSound buffer) and you're good to go.

Share this post


Link to post
Share on other sites
Yes, I've thought of this but one minor niggle I had is that the oscilloscope will probably be slightly out of sync with the sound depending on when the thread is updating the buffer because I have it update every second or so, depending on how close a Sleep call gets to its request 1000ms, and at that time another whole second of audio is decoded and uploaded. One thing I personally can't stand are visualizers that aren't in sync with the sound they're reflecting.

I will try it out, though, and see if the results are acceptable. I may have to settle for it if I want the effect in there, and just in case I will try and think of another way to use up the big black circle at the lower right. Perhaps another procedural texture effect of some sort... hmm...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!