0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-24 12:05:48 +00:00
ryujinx-fork/Ryujinx.Audio/Native/libsoundio/MarshalExtensions.cs
Ac_K 7b66cb0d90
audio: Cleanup Ryujinx.Audio and fix OpenAL issue (#1746)
* audio: Cleanup SoundIO and fix OpenAL issue

* fix tabs by spaces

* Fix extra spaces

* Fix SoundIO.cs

* Fix ContainsAudioOutBuffer
2020-11-27 20:55:00 +01:00

38 lines
No EOL
1.1 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace SoundIOSharp
{
public static class MarshalEx
{
public static double ReadDouble(IntPtr handle, int offset = 0)
{
return BitConverter.Int64BitsToDouble(Marshal.ReadInt64(handle, offset));
}
public static void WriteDouble(IntPtr handle, double value)
{
WriteDouble(handle, 0, value);
}
public static void WriteDouble(IntPtr handle, int offset, double value)
{
Marshal.WriteInt64(handle, offset, BitConverter.DoubleToInt64Bits(value));
}
public static float ReadFloat(IntPtr handle, int offset = 0)
{
return BitConverter.Int32BitsToSingle(Marshal.ReadInt32(handle, offset));
}
public static void WriteFloat(IntPtr handle, float value)
{
WriteFloat(handle, 0, value);
}
public static void WriteFloat(IntPtr handle, int offset, float value)
{
Marshal.WriteInt32(handle, offset, BitConverter.SingleToInt32Bits(value));
}
}
}