1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-10-01 12:30:00 +02:00
Ryujinx/Ryujinx.HLE/OsHle/Utilities/StructReader.cs
gdkchan 98c6ceede5
Audio Renderer improvements (#210)
* Partial voice implementation on audio renderer

* Implemented audren resampler (based on original impl)

* Fix BiquadFilter struct

* Pause audio playback on last stream buffer

* Split audren/audout files into separate folders, some minor cleanup

* Use AudioRendererParameter on GetWorkBufferSize aswell

* Bump audren version to REV4, name a few things, increase sample buffer size

* Remove useless new lines
2018-07-14 23:57:41 -03:00

45 lines
1,017 B
C#

using ChocolArm64.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.OsHle.Utilities
{
class StructReader
{
private AMemory Memory;
public long Position { get; private set; }
public StructReader(AMemory Memory, long Position)
{
this.Memory = Memory;
this.Position = Position;
}
public T Read<T>() where T : struct
{
T Value = AMemoryHelper.Read<T>(Memory, Position);
Position += Marshal.SizeOf<T>();
return Value;
}
public T[] Read<T>(int Size) where T : struct
{
int StructSize = Marshal.SizeOf<T>();
int Count = Size / StructSize;
T[] Output = new T[Count];
for (int Index = 0; Index < Count; Index++)
{
Output[Index] = AMemoryHelper.Read<T>(Memory, Position);
Position += StructSize;
}
return Output;
}
}
}