From e1e5e58fb081d55a5cf17ba0b701de22e01f855b Mon Sep 17 00:00:00 2001 From: Cam Sinclair Date: Sun, 31 Jan 2021 19:21:44 -0500 Subject: [PATCH] 1.0.10 - Update SerdesNet dependency --- ADLMidi.NET.sln | 6 ++++++ TestApp/TestApp.csproj | 2 +- src/ADLMidi.NET.csproj | 4 ++-- src/GlobalTimbreLibrary.cs | 2 +- src/WoplFile.cs | 8 ++++---- src/WoplInstrument.cs | 8 ++++---- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ADLMidi.NET.sln b/ADLMidi.NET.sln index 78e9a1a..59467ee 100644 --- a/ADLMidi.NET.sln +++ b/ADLMidi.NET.sln @@ -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 @@ -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 diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj index c962460..e48ebc0 100644 --- a/TestApp/TestApp.csproj +++ b/TestApp/TestApp.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 true diff --git a/src/ADLMidi.NET.csproj b/src/ADLMidi.NET.csproj index 5242221..e9b50d4 100644 --- a/src/ADLMidi.NET.csproj +++ b/src/ADLMidi.NET.csproj @@ -14,7 +14,7 @@ Git https://github.com/CSinkers/AdlMidi.NET true - 1.0.9 + 1.0.10 @@ -22,7 +22,7 @@ - + diff --git a/src/GlobalTimbreLibrary.cs b/src/GlobalTimbreLibrary.cs index c728ffb..ec654ee 100644 --- a/src/GlobalTimbreLibrary.cs +++ b/src/GlobalTimbreLibrary.cs @@ -41,7 +41,7 @@ public static GlobalTimbreLibrary Serdes(GlobalTimbreLibrary library, ISerialize IList headers = new List(); - if (s.Mode == SerializerMode.Reading) + if (s.IsReading()) { TimbreHeader header; do diff --git a/src/WoplFile.cs b/src/WoplFile.cs index 4e19c76..7d1e5c1 100644 --- a/src/WoplFile.cs +++ b/src/WoplFile.cs @@ -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); @@ -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; } diff --git a/src/WoplInstrument.cs b/src/WoplInstrument.cs index 50b9ca2..2871ca4 100644 --- a/src/WoplInstrument.cs +++ b/src/WoplInstrument.cs @@ -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); @@ -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); @@ -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; }