I need to play multiple wave files which start at different times (not all together). I was trying to play the files using Directsound but a problem arised. I have the following code:
var dev = new Device(); //This line creates the problem
dev.SetCooperativeLevel(this, CooperativeLevel.Normal);
MemoryStream ms = new MemoryStream(Sample1);
soundBuffer = new Microsoft.DirectX.DirectSound.Buffer(ms, dev);
SecondaryBuffer sound = new SecondaryBuffer(ms,dev);
sound.Play();
The problem is when I type in the first line (var dev = new Device();), and compile the program an error occurs (ConsoleApplication1 encountered a problem and needs to close). This happens even when I remove all the code except the first line. The console error is as follows: "Mixed mode assembly is built against version v1.1.4322 of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information".
If this problem is not fixable, is there another way to play multiple sounds. The sound has to have minimum latency and must play instantly without any delays.
You need to edit your application configuration to include:
Which should allow you to use older .NET dlls.