Skip to main content
gamedev.net
🔒 Locked

waveOutOpen

Started by uncutno 0 replies 1.5k views
Original Post
uncutno
uncutno
Hello! Im creating a realtime sound syntheziser. By realtime, the sounds are generated on the fly, and parameters can be changed anytime. I have 15 buffers with 100 samples each. To reduce reactiontimes in my synth, i try to have as few as possible of these in the waiting to be played queue. My problem is that when i drop under 50 ms = 2205 samples in the waiting-to-play queue, it does not manage to keep up! (silence between my buffers, resulting in noize). the problems is that 50 ms is a loooong reaction time when playing an instrument. I do two different things, that i think can be the problem: #1: my loop locks like this: Construction: waveOutOpen Loop: waveOutPrepareHeader //play... //when finished: waveOutUnprepareHeader Destructor: waveOutClose //The loop uses a calback function, so buffers are queued(played) before //the previous buffer is done... #2: my synth thread is delayed. I give my synth thread (only sound generating stuff) a higher priority so that most of my resources (CPU) are used on this. This results in the rest of the system laging alot, so i added a Sleep(1) in my synth thread loop. How are you suposed to do this? The loop is required to run every 4th ms, but once it gives away the focus, it often takes 10 ms before it get the focus back. Im using VC++ 6.0, on a 800Mhz WindowsXP system. Currently i have almost no calculations, so im working at maximum speed. I know im not realy clear in my text, but this is a complex problem. I would be thankfull for any answers regarding the waveOut system, and realtime threads in windows XP. (who also alow other threads to run) Anders Oredsson
-Anders-Oredsson-Norway-
darookie
darookie
Do yourself a favour and ditch the waveOut-API. It wasn't designed for real-time or low-latency use.
Switch to DirectSound - it's worth the effort!

Regards,
Pat.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.