Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Delays in sound output

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

THough I am not writing a game program, I need real time response to sound. The program sends data over radios. The data bits are coded as tones of a specific frequency and duration. So, I create the digitized sine wave. To send the sounds I use the classic double buffering technique (under Windows). Buffer A is filled, Buffer B is filled and then two calls to ''waveOutWrite()'' are made. In the callback function, when the buffer is sent, one gets the MM_WOM_DONE message which also tells which buffer was just finished. So one loads that buffer and calls ''waveOutWrite()''. Now in theory, the other buffer should be sending at that time, so the flow should be continuous. However, there is a clear delay and a ''crack'' is heard at the rate of the buffer switching. How bad is it? Pretty bad. If I send some data signal at 1200 baud and make each buffer only large enough to hold two baud pulses, each buffer (should) last only 1/600th of a second. But if I send 600 of these items, the message takes SEVERAL seconds to send whereas it should take but one second. If I make the buffer large enough to hold one second''s worth of data, the message takes but a second to run. But no matter what I do, I lose some time EVERY time the buffer is switched. Am I doing something wrong or is it a fact that every call to ''waveOutWrite()'' takes a few milliseconds (maybe quite a few) to start the sending? (Not so with DOS32.) Does anyone know how I can send a continuous stream of data with NO loss of continuity in Windows? I''ve got a new 2.4 GHz Pentium with a soundblaster Live, so it''s not a hardware deficiency! Will Direct X solve this problem? From my understanding of game programmers, if they can''t do it, it can''t be done! Brian Reinhold

Share this post

Link to post
Share on other sites
I''ve got it perfect with DirectX but it is possible with WaveOut too because at least WinUAE does it. I know nothing of Waveout but In directX I use one looping buffer and write data ahead of the play position in blocks. It takes a bit of care because you can''t write over what hasn''t been played and you can''t play what hasn''t been written but when it works, it works.

Cornutopia Games
Bytten Independent Games Magazine

Share this post

Link to post
Share on other sites

  • 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!