• After more than 30 years running websites and forums I am retiring.

    I have made many friends through the years. I will cherish my time getting to know you. I wish you all the best. This was not an easy decision to make. The cost to keep the communities running has gotten to the point where it's just too expensive. Security certificates, hosting cost, software renewals and everything else has increased threefold. While costs are up ad revenue is down. It's no longer viable to keep things running.

    All sites will be turned off on Thursday 30 November 2023. If you are interested in acquiring any of the websites I own you can Email Schwarz Network.

Playing Multiple Wav Files Using Directsound without Delay

Jakpot

Newcomer
Joined
Jan 14, 2012
Hi, I need to play multiple wave files using directsound or any other method. My application is similar to this: http://msdn.microsoft.com/en-us/library/ms973091.aspx, where i need to create beats. The problem is that when I play two or more sounds, there will be some delay between both files. The program provided in that link does not have any delays present when more than 1 file is played but I couldn't understand the coding since it is extremely difficult and im just a beginner. Is there a way to remove the delay completely? I am using the following method:


Code:
            var dev = new Device();
            dev.SetCooperativeLevel(this, CooperativeLevel.Priority);
            MemoryStream ms = new MemoryStream(Sample1);
            SecondaryBuffer sound = new SecondaryBuffer(@"C:\1.wav", dev);

            var dev1 = new Device();
            dev1.SetCooperativeLevel(this, CooperativeLevel.Priority);
            MemoryStream ms1 = new MemoryStream(Sample2);
            SecondaryBuffer sound1 = new SecondaryBuffer(@"C:\3.wav", dev1);

            var dev2 = new Device();
            dev2.SetCooperativeLevel(this, CooperativeLevel.Priority);
            SecondaryBuffer sound2 = new SecondaryBuffer(@"C:\VEE Bassdrum 012.wav", dev2);

            sound.Play(0, BufferPlayFlags.Default);
            sound1.Play(0, BufferPlayFlags.Default);
            sound2.Play(0, BufferPlayFlags.Default);

I also converted the wavefiles to streams and played them using memorystream but the delay is the same.

Thanks!
 
Top Bottom