Fix a memory corruption in SoundIO wrapper

This fix audio slowdown on Unix based platforms where soundio will try
to switch to mono because of the invalid data written.
This commit is contained in:
Thomas Guillemard 2019-08-18 20:02:45 +02:00
parent a731ab3a2a
commit cb23c08211
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6

View file

@ -64,7 +64,7 @@ namespace SoundIOSharp
get { unsafe { return new SoundIOChannelLayout ((IntPtr) ((void*) ((IntPtr) handle + layout_offset))); } }
set {
unsafe {
Buffer.MemoryCopy ((void*)((IntPtr)handle + layout_offset), (void*)value.Handle,
Buffer.MemoryCopy ((void*)value.Handle, (void*)((IntPtr)handle + layout_offset),
Marshal.SizeOf<SoundIoChannelLayout> (), Marshal.SizeOf<SoundIoChannelLayout> ());
}
}