2

I'm trying to clone SecondaryBuffer so I can play the same sound multiple times at the same time.

this is the code I'm using: In the main thread:

Device sounddevice = new Device();
sounddevice.SetCooperativeLevel(this, CooperativeLevel.Normal);

BufferDescription description = new BufferDescription();
description.ControlEffects = false;

SecondaryBuffer buffer = new SecondaryBuffer(file, description, sounddevice);

In a function running on different thread:

SecondaryBuffer buffer2 = buffer.Clone(sounddevice);
buffer2.Play(0, BufferPlayFlags.Default);

this is the exception I got on the Clone function:

An unhandled exception of type 'System.AccessViolationException' occurred in Microsoft.DirectX.DirectSound.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Anyone got a solution for that?

Community
  • 1
  • 1
Daniel
  • 71
  • 1
  • 4

0 Answers0