From 5c44c9600f09c3faa45c01e2b94d01ac1715c71a Mon Sep 17 00:00:00 2001
From: Thomas Guillemard <me@thog.eu>
Date: Mon, 19 Aug 2019 22:28:14 +0200
Subject: [PATCH] Fix a memory corruption in SoundIO wrapper (#742)

This fix audio slowdown on Unix based platforms where soundio will try
to switch to mono because of the invalid data written.
---
 Ryujinx.Audio/Native/libsoundio/SoundIOOutStream.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Ryujinx.Audio/Native/libsoundio/SoundIOOutStream.cs b/Ryujinx.Audio/Native/libsoundio/SoundIOOutStream.cs
index a910142563..346e6afbc7 100644
--- a/Ryujinx.Audio/Native/libsoundio/SoundIOOutStream.cs
+++ b/Ryujinx.Audio/Native/libsoundio/SoundIOOutStream.cs
@@ -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> ());
 				}
 			}