Archived

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

Full duplex sound

This topic is 5156 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 note that in the Microsoft SDK documentation that there is an example of full duplex use of DirectSound/DirectSoundCapture. However, there is little explanation as to WHY the code is set up as it is. So here is the question and I wonder if anyone can give any insight. First: (1) DirectSoundCapture only. Standard procedure, create object, and use interface (2) DirectSound only (for playback). Also standard procedure, but here we have the decision to make using the cooperation level. What it comes down to is whether one writes to the primary or secondary sound buffers. The primary buffer is for quite unique situations. However, if you want to set something besides a 22 KHz sampling rate at 8 bits, you will need to use a higher priority cooperation setting than NORMAL, but you can still use secondary buffers and set different formats. Only if you need to WRITE to the primary buffer to you have to set THAT cooperation level. So, in a nutshell, one can use secondary buffers and still set the primary buffer format using the ->Format() method. (3) Both. Now this is funny. DirectSoundCapture stays the same, but this example code opens BOTH a primary buffer AND a secondary buffer interface. As Far as I can tell, the ONLY purpose of the primary buffer is to set the format. Yet the cooperation level set for the secondary buffers ALSO allows one to set the format (sampling rate, bit depth, stereo, etc). The sample code then sets the format using the ->FOrmat() method for BOTH the primary and secondary buffer interfaces. However, writing is never done to the primary buffer (As far as I can tell). Why? Why do we need to have the primary buffer interface? We DON''T need it if just doing playback. Is this to make sure that we don''t set different formats for the capture and playback? It would have been very helpful if MIcrosoft put a little explanation into what is unique about the full duplex case. If it weren''t for the open of the primary buffer stuff, the code looks like the sum of playback + capture. Any info and insight into this (or experience) would be greatly appreciated! Brian Brian Reinhold

Share this post


Link to post
Share on other sites