<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Playing Multiple Wav Files Using Directsound without Delay' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Playing Multiple Wav Files Using Directsound without Delay' posted on the 'DirectSound' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 18:53:23 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 18:53:23 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Playing Multiple Wav Files Using Directsound without Delay</title>
      <link>http://www.programmersheaven.com/mb/DirectSound/426809/426809/playing-multiple-wav-files-using-directsound-without-delay/</link>
      <description>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:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
            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);
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I also converted the wavefiles to streams and played them using memorystream but the delay is the same. &lt;br /&gt;
&lt;br /&gt;
Thanks!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/DirectSound/426809/426809/playing-multiple-wav-files-using-directsound-without-delay/</guid>
      <pubDate>Sat, 14 Jan 2012 03:36:15 -0700</pubDate>
      <category>DirectSound</category>
    </item>
  </channel>
</rss>