Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,
I have a quick question. (well, hopefully the answer is as quick as my question as I'm sure I'm doing something dumb.)

I have a direct sound application that runs just fine as a windows console app which makes sense because there is nothing else going on.

I'm working on a software synth and have gotten to the point where I grow weary of punching in values to a text file. It's a subtractor synth built from scratch. I now need to support knobs, sliders, etc.. to modify my sounds.

This is where things go downhill.

Waiting on notifications in my console app works just fine, but in the threaded app it waits forever. I know about MsgWaitForMultipleObjects but it just falls through and I dont' update my streaming buffers correctly.

I'm a complete noob at dialog based windows programming so if someone has some example code of waiting for directsound buffer notifications with dialog based apps I'll be very thankful.

If you want source code I don't mind providing it, I just figured if someone had a main loop that they could share with me it would trigger a spark in my mind.

Thanks in advance.
Posted

1 solution

calducciano wrote:
I know about MsgWaitForMultipleObjects but it just falls through


But with what return code? That's what tells you if you a) have a message to process, or b) one of your handles has been signalled!

For something like audio, I'd have thought you'd want a dedicated thread handling the audio, communicating with the UI thread using PostMessage (audio thread -> UI thread) and events? (UI thread -> audio thread). But I could be completely wrong - I've never really looked at DirectSound :)

BTW - does this CP article help[^] any? It's got a dialog with sliders and it talks about DirectSound :)
 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900