   Using DirectMusic and DirectSound
  This is my situation: Up until now I've been using DirectMusic for all my music and sound effects in my game. I wrote a nice clean wrapper to play music and 3D sounds with DirectMusic, and it works just fine. Except for one problem, DirectMusic can lag. By lag I mean that sometimes the sounds play a fraction of a second after they're meant to. This lag is very noticeable in my game when playing sounds rapidly, eg weapon firing sounds. So instead of using DirectMusic to play sound effects, I want to use DirectSound to avoid this lag problem. I still want to use DirectMusic to load my sounds, but instead of playing the sounds using the DirectMusic, I will play them using DirectSound.But I'm not too sure how to play my sounds using DirectSound. I've searched and read up on DirectSound, but most tutorials just show how to use DirectMusic, or just DirectSound, and not both.So basicly, what do I need to do after I've loaded a DirectMusic segment using the DirectMusic loader? How do I go about playing this sound using DirectSound instead of playing the sound using the DirectMusic performance?Thanks in advance,Julien.   
  I'm not entirely sure it's possible to do what you want. Despite the fact they serve a common purpose they are still seperate components.It's been a long time since I did any DSound programming (+I've managed to lose my RAID array so can't get at any files [headshake]) but I'm pretty sure you can manually write data to a DSound buffer (PCM wave format).If you could manage to get DMusic to give you access to data it's loaded in PCM format then you could just copy the data across... but this is where the problem lies - I don't think you can get it in the correct format, which means you'll (at least) have to do some manual conversion. If you're doing any conversion it almost defeats the point of using DMusic in the first place [smile]hthJack   ;  As far as I know, in DirectX 8.1, there were quite a few problems with DirectAudio's lag that were fixed. Are you using DirectAudio from DX 8.1? Also, how are you playing these segements, as primary or secondary?  I think secondary buffers may be synced to the beat of the primary which could cause a delay (not sure if it applies to wave data).Another trick may be to use the main DirectSound interface to keep the mixer on all the time. Normally, DirectSound stops the mixer and all DMA when nothing is playing. The cost of starting and stopping the mixer for constant short intervals of silence  and then sound can be noticable. Also, don't forget to match you primary and secondary buffers' sample rates and number of channels. The conversion can kill if enough is going on. (Unfortunately you may not be able to do much about the channels)Try doing this: Create DirectSound8. Set it to priority mode so that you can create a primary buffer of your own choosing. Make sure all sound data matches this format for the primary buffer. Create DirectAudio and pass to it the interface pointer you have from DirectSound. Finally, use lpPrimaryBuffer->Play with the looping flag to turn on the mixer all the time. Just don't forget to turn it off.An finally, are you using 3D sound? And are you using software or hardware processing?Tell me if this helps any? =)   