Skip to content

Commit

Permalink
Update to latest SharpGen and FIX build.
Browse files Browse the repository at this point in the history
  • Loading branch information
amerkoleci committed Dec 3, 2024
1 parent 8c118c4 commit 9a6e9c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- https://learn.microsoft.com/nuget/consume-packages/central-package-management -->
<PropertyGroup>
<SharpGenVersion>2.3.4-beta</SharpGenVersion>
<SharpGenVersion>2.4.0-beta</SharpGenVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Vortice.DirectX/Multimedia/RiffChunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ public RiffChunk(Stream stream, FourCC type, uint size, uint dataPosition, bool
/// Gets the raw data contained in this chunk.
/// </summary>
/// <returns></returns>
public byte[] GetData()
public Span<byte> GetData()
{
byte[] data = new byte[Size];
Span<byte> data = new byte[Size];
Stream.Position = DataPosition;
Stream.Read(data, 0, (int)Size);
Stream.ReadExactly(data);
return data;
}

Expand All @@ -85,8 +85,8 @@ public byte[] GetData()
public unsafe T GetDataAs<T>() where T : unmanaged
{
T value = new();
byte[] data = GetData();
fixed (void* ptr = data)
Span<byte> data = GetData();
fixed (byte* ptr = data)
{
MemoryHelpers.Read((IntPtr)ptr, ref value);
}
Expand All @@ -105,7 +105,7 @@ public unsafe T[] GetDataAsArray<T>() where T : unmanaged
throw new ArgumentException("Size of T is incompatible with size of chunk");

T[] values = new T[Size / sizeOfT];
byte[] data = GetData();
Span<byte> data = GetData();
fixed (byte* dataPtr = data)
{
MemoryHelpers.Read((IntPtr)dataPtr, values, 0, values.Length);
Expand Down
4 changes: 2 additions & 2 deletions src/Vortice.DirectX/Multimedia/WaveFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ public static WaveFormat CreateIeeeFloatWaveFormat(int sampleRate, int channels)
/// </summary>
/// <param name="rawData">Buffer to the WaveFormat rawdata</param>
/// <returns>WaveFormat structure</returns>
public unsafe static WaveFormat MarshalFrom(byte[] rawData)
public unsafe static WaveFormat MarshalFrom(Span<byte> rawData)
{
fixed (void* pRawData = rawData)
fixed (byte* pRawData = rawData)
{
return MarshalFrom(pRawData);
}
Expand Down

0 comments on commit 9a6e9c4

Please sign in to comment.