Skip to content

Commit

Permalink
1.0.10 - Update SerdesNet dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
csinkers committed Feb 1, 2021
1 parent e7725a6 commit e1e5e58
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions ADLMidi.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ADLMidi.NET", "src\ADLMidi.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "TestApp\TestApp.csproj", "{C39D3663-C688-489F-A46C-06B4BFF53673}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerdesNet", "..\SerdesNet\src\SerdesNet.csproj", "{DC43FE5A-8DBA-4F72-9AAB-34DE1D512DB0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{C39D3663-C688-489F-A46C-06B4BFF53673}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C39D3663-C688-489F-A46C-06B4BFF53673}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C39D3663-C688-489F-A46C-06B4BFF53673}.Release|Any CPU.Build.0 = Release|Any CPU
{DC43FE5A-8DBA-4F72-9AAB-34DE1D512DB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC43FE5A-8DBA-4F72-9AAB-34DE1D512DB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC43FE5A-8DBA-4F72-9AAB-34DE1D512DB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC43FE5A-8DBA-4F72-9AAB-34DE1D512DB0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion TestApp/TestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/ADLMidi.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/CSinkers/AdlMidi.NET</RepositoryUrl>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<version>1.0.9</version>
<version>1.0.10</version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>

<ItemGroup Condition="!Exists('..\..\SerdesNet')">
<PackageReference Include="SerdesNet" Version="1.4.1" />
<PackageReference Include="SerdesNet" Version="1.5.0" />
</ItemGroup>
<ItemGroup Condition="Exists('..\..\SerdesNet')">
<ProjectReference Include="..\..\SerdesNet\src\SerdesNet.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/GlobalTimbreLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static GlobalTimbreLibrary Serdes(GlobalTimbreLibrary library, ISerialize


IList<TimbreHeader> headers = new List<TimbreHeader>();
if (s.Mode == SerializerMode.Reading)
if (s.IsReading())
{
TimbreHeader header;
do
Expand Down
8 changes: 4 additions & 4 deletions src/WoplFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public static WoplFile Serdes(WoplFile w, ISerializer s)
throw new InvalidOperationException("Magic string missing (invalid WOPL file)");

w.Version = s.UInt16(nameof(Version), w.Version);
s.PushVersion(w.Version);
melodicBanks = s.UInt16BE(nameof(melodicBanks), melodicBanks);
percussionBanks = s.UInt16BE(nameof(percussionBanks), percussionBanks);
w.GlobalFlags = s.EnumU8(nameof(GlobalFlags), w.GlobalFlags);
Expand All @@ -49,12 +48,13 @@ public static WoplFile Serdes(WoplFile w, ISerializer s)

// Load instruments (128 per bank)
foreach (var bank in w.Melodic)
s.List(nameof(w.Melodic), bank.Instruments, bank.Instruments.Length, WoplInstrument.Serdes);
s.List(nameof(w.Melodic), bank.Instruments, bank.Instruments.Length,
(i2, w2, s2) => WoplInstrument.Serdes(i2, w2, s2, w.Version));

foreach (var bank in w.Percussion)
s.List(nameof(w.Percussion), bank.Instruments, bank.Instruments.Length, WoplInstrument.Serdes);
s.List(nameof(w.Percussion), bank.Instruments, bank.Instruments.Length,
(i2, w2, s2) => WoplInstrument.Serdes(i2, w2, s2, w.Version));

s.PopVersion();
return w;
}

Expand Down
8 changes: 4 additions & 4 deletions src/WoplInstrument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class WoplInstrument
public string Name { get; set; }
Instrument _data;

static Instrument SerdesI(int i, Instrument w, ISerializer s)
static Instrument SerdesI(int i, Instrument w, ISerializer s, int version)
{
if (s == null) throw new ArgumentNullException(nameof(s));
w.NoteOffset1 = s.Int16 (nameof(Instrument.NoteOffset1), w.NoteOffset1);
Expand All @@ -23,7 +23,7 @@ static Instrument SerdesI(int i, Instrument w, ISerializer s)
w.Operator1 = s.Object (nameof(Instrument.Operator1), w.Operator1, Operator.Serdes);
w.Operator2 = s.Object (nameof(Instrument.Operator2), w.Operator2, Operator.Serdes);
w.Operator3 = s.Object (nameof(Instrument.Operator3), w.Operator3, Operator.Serdes);
if (s.PeekVersion() >= 3)
if (version >= 3)
{
w.DelayOnMs = s.UInt16(nameof(Instrument.DelayOnMs), w.DelayOnMs);
w.DelayOffMs = s.UInt16(nameof(Instrument.DelayOffMs), w.DelayOffMs);
Expand All @@ -34,12 +34,12 @@ static Instrument SerdesI(int i, Instrument w, ISerializer s)

public override string ToString()
=> $"F:{FbConn1C0} {Operator0.Attack}:{Operator0.Decay} {Operator0.Sustain}:{Operator0.Release} {Operator0.Waveform} {Operator0.Flags} {Operator0.Level} {Operator1.Attack}:{Operator1.Decay} {Operator1.Sustain}:{Operator1.Release} {Operator1.Waveform} {Operator1.Flags} {Operator1.Level}";
public static WoplInstrument Serdes(int i, WoplInstrument w, ISerializer s)
public static WoplInstrument Serdes(int i, WoplInstrument w, ISerializer s, int version)
{
if (s == null) throw new ArgumentNullException(nameof(s));
w ??= new WoplInstrument();
w.Name = s.FixedLengthString(nameof(Name), w.Name, 32);
w._data = s.Object(nameof(_data), w._data, SerdesI);
w._data = s.Object(nameof(_data), w._data, (i2, w2, s2) => SerdesI(i2, w2, s2, version));
return w;
}

Expand Down

0 comments on commit e1e5e58

Please sign in to comment.