Skip to content

Commit

Permalink
Add WoplFile.GetRawWoplBytes method
Browse files Browse the repository at this point in the history
  • Loading branch information
csinkers committed Aug 9, 2022
1 parent 299b9c2 commit d40fe2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ADLMidi.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/CSinkers/AdlMidi.NET</RepositoryUrl>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<version>1.0.15</version>
<version>1.0.16</version>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/WoplFile.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using SerdesNet;

namespace ADLMidi.NET
Expand Down Expand Up @@ -96,5 +98,14 @@ public WoplFile(GlobalTimbreLibrary timbreLibrary)
Percussion[0].Instruments[i - 128 + 35] = x;
}
}

public byte[] GetRawWoplBytes(Action<string> assertionFailed)
{
using var ms = new MemoryStream();
using var bw = new BinaryWriter(ms);
using var gbw = new GenericBinaryWriter(bw, Encoding.ASCII.GetBytes, assertionFailed);
Serdes(this, gbw);
return ms.ToArray();
}
}
}

0 comments on commit d40fe2d

Please sign in to comment.