From 5070517c47e66aae07aa73f428b2a4915f76324d Mon Sep 17 00:00:00 2001 From: 110-kenichi <110.kenichi@gmail.com> Date: Sun, 8 Sep 2019 18:12:45 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E8=89=B2=E8=A8=AD=E5=AE=9A=E9=96=A2?= =?UTF-8?q?=E9=80=A3=E3=81=AE=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomExpandableObjectConverter.cs | 2 +- .../ComponentModel/MidiHookProxy.cs | 13 -- src/mamidimemo/instruments/RP2A03.cs | 166 ++++++++++-------- src/mamidimemo/instruments/YM2151.cs | 3 +- src/mamidimemo/instruments/YM2413.cs | 3 +- src/mamidimemo/instruments/YM2612.cs | 3 +- src/mamidimemo/instruments/YM3812.cs | 3 +- 7 files changed, 104 insertions(+), 89 deletions(-) diff --git a/src/mamidimemo/ComponentModel/CustomExpandableObjectConverter.cs b/src/mamidimemo/ComponentModel/CustomExpandableObjectConverter.cs index 731d1ea05b4a6..951eb8accd912 100644 --- a/src/mamidimemo/ComponentModel/CustomExpandableObjectConverter.cs +++ b/src/mamidimemo/ComponentModel/CustomExpandableObjectConverter.cs @@ -26,7 +26,7 @@ public override object ConvertTo(ITypeDescriptorContext context, System.Globaliz throw new ArgumentNullException("destinationType"); if (destinationType == typeof(string)) - return context.PropertyDescriptor.PropertyType.Name + context.PropertyDescriptor.DisplayName; + return context.PropertyDescriptor.DisplayName; return base.ConvertTo(context, culture, value, destinationType); } diff --git a/src/mamidimemo/ComponentModel/MidiHookProxy.cs b/src/mamidimemo/ComponentModel/MidiHookProxy.cs index fb9d50f5647a2..ae7b4d5f7cf90 100644 --- a/src/mamidimemo/ComponentModel/MidiHookProxy.cs +++ b/src/mamidimemo/ComponentModel/MidiHookProxy.cs @@ -55,19 +55,6 @@ public override IMessage Invoke(IMessage msg) { res = RemotingServices.ExecuteMessage(this.f_Target, call); } - //try - //{ - // //メソッド前処理 - // lockSlim.EnterWriteLock(); - - // //メソッド実行 - // res = RemotingServices.ExecuteMessage(this.f_Target, call); - //} - //finally - //{ - // //メソッド後処理 - // lockSlim.ExitWriteLock(); - //} } return res; diff --git a/src/mamidimemo/instruments/RP2A03.cs b/src/mamidimemo/instruments/RP2A03.cs index c25e7b3fb4a3e..caa52b0a56677 100644 --- a/src/mamidimemo/instruments/RP2A03.cs +++ b/src/mamidimemo/instruments/RP2A03.cs @@ -473,8 +473,8 @@ public override void KeyOn() RP2A03WriteData(parentModule.UnitNumber, 0x15, (byte)(data | (1 << Slot))); RP2A03WriteData(parentModule.UnitNumber, (uint)((Slot * 4) + 0x01), - (byte)(timbre.SQSweepEnable << 7 | timbre.SQSweepUpdateRate << 4 | - timbre.SQSweepDirection << 3 | timbre.SQSweepRange)); + (byte)(timbre.SQSweep.Enable << 7 | timbre.SQSweep.UpdateRate << 4 | + timbre.SQSweep.Direction << 3 | timbre.SQSweep.Range)); //Volume updateSqVolume(); @@ -672,7 +672,7 @@ public void UpdateNoisePitch() int n = 31 - ((NoteOnEvent.NoteNumber + pitch) % 32); var nt = timbre.NoiseType; - if (FxEngine.Active) + if (FxEngine != null && FxEngine.Active) { var eng = (NesFxEngine)FxEngine; nt = (byte)(eng.DutyValue & 1); @@ -760,7 +760,7 @@ public byte Volume [DataMember] [Category("Sound(SQ)")] - [Description("Square Envelope Decay Disable (0:Enable 1:Disable)")] + [Description("Square/Noise Envelope Decay Disable (0:Enable 1:Disable)")] [DefaultValue((byte)1)] public byte DecayDisable { @@ -777,6 +777,7 @@ public byte DecayDisable private byte f_LengthDisable = 1; + [Browsable(false)] [DataMember] [Category("Sound(SQ/Tri)")] [Description("Square/Tri Length Counter Clock Disable (0:Enable 1:Disable)")] @@ -793,7 +794,7 @@ public byte LengthCounterDisable } } - + /* private byte f_NoiseEnvDecayEnable; [DataMember] @@ -810,6 +811,7 @@ public byte NoiseEnvDecayEnable f_NoiseEnvDecayEnable = (byte)(value & 1); } } + */ private byte f_SQDutyCycle; @@ -828,73 +830,16 @@ public byte SQDutyCycle } } - private byte f_SQSweepEnable; - - [DataMember] - [Category("Sound(SQ)")] - [Description("Square Sweep Enable (0:Disable 1:Enable)")] - public byte SQSweepEnable - { - get - { - return f_SQSweepEnable; - } - set - { - f_SQSweepEnable = (byte)(value & 1); - } - } - - - private byte f_SQSweepUpdateRate; - - [DataMember] - [Category("Sound(SQ)")] - [Description("Square Sweep Update Rate (0-7)")] - public byte SQSweepUpdateRate - { - get - { - return f_SQSweepUpdateRate; - } - set - { - f_SQSweepUpdateRate = (byte)(value & 7); - } - } - - private byte f_SQSweepDirection; - - [DataMember] - [Category("Sound(SQ)")] - [Description("Wave Length (0:Decrease 1:Increse)")] - public byte SQSweepDirection - { - get - { - return f_SQSweepDirection; - } - set - { - f_SQSweepDirection = (byte)(value & 1); - } - } - - private byte f_SQSweepRange; - + /// + /// + /// [DataMember] [Category("Sound(SQ)")] - [Description("Wave Length (0-7)")] - public byte SQSweepRange + [Description("Square Wave Sweep Settings")] + public SQSweepSettings SQSweep { - get - { - return f_SQSweepRange; - } - set - { - f_SQSweepRange = (byte)(value & 7); - } + get; + private set; } private byte f_NoiseType; @@ -917,6 +862,7 @@ public byte NoiseType private byte f_PlayLength; + [Browsable(false)] [DataMember] [Category("Sound")] [Description("Square/Tri Play Length (0-31)")] @@ -935,6 +881,7 @@ public byte PlayLength private byte f_TriCounterLength = 127; + [Browsable(false)] [DataMember] [Category("Sound(Tri)")] [Description("Tri Linear Counter Length (0-127)")] @@ -992,7 +939,8 @@ public byte DeltaPcmLoopEnable /// public RP2A03Timbre() { - this.SDS.FxS = new NesFxSettings(); + SQSweep = new SQSweepSettings(); + SDS.FxS = new NesFxSettings(); } /// @@ -1018,7 +966,6 @@ public override void RestoreFrom(string serializeData) } } - } [JsonConverter(typeof(NoTypeConverterJsonConverter))] @@ -1180,6 +1127,83 @@ protected override void ProcessCore(SoundBase sound, bool isKeyOff, bool isSound } + [JsonConverter(typeof(NoTypeConverterJsonConverter))] + [TypeConverter(typeof(CustomExpandableObjectConverter))] + [DataContract] + [MidiHook] + public class SQSweepSettings : ContextBoundObject + { + + private byte f_Enable; + + [DataMember] + [Category("Sound(SQ)")] + [Description("Square Sweep Enable (0:Disable 1:Enable)")] + public byte Enable + { + get + { + return f_Enable; + } + set + { + f_Enable = (byte)(value & 1); + } + } + + private byte f_UpdateRate; + + [DataMember] + [Category("Sound(SQ)")] + [Description("Square Sweep Update Rate (0-7)")] + public byte UpdateRate + { + get + { + return f_UpdateRate; + } + set + { + f_UpdateRate = (byte)(value & 7); + } + } + + private byte f_Direction; + + [DataMember] + [Category("Sound(SQ)")] + [Description("Wave Length (0:Decrease 1:Increse)")] + public byte Direction + { + get + { + return f_Direction; + } + set + { + f_Direction = (byte)(value & 1); + } + } + + private byte f_Range; + + [DataMember] + [Category("Sound(SQ)")] + [Description("Wave Length (0-7)")] + public byte Range + { + get + { + return f_Range; + } + set + { + f_Range = (byte)(value & 7); + } + } + + } + /// /// /// diff --git a/src/mamidimemo/instruments/YM2151.cs b/src/mamidimemo/instruments/YM2151.cs index a6f4bed6b2b89..6f85b6d6c5dbd 100644 --- a/src/mamidimemo/instruments/YM2151.cs +++ b/src/mamidimemo/instruments/YM2151.cs @@ -885,7 +885,8 @@ public override void RestoreFrom(string serializeData) [JsonConverter(typeof(NoTypeConverterJsonConverter))] [TypeConverter(typeof(CustomExpandableObjectConverter))] [DataContract] - public class YM2151Operator + [MidiHook] + public class YM2151Operator : ContextBoundObject { private byte f_Enable = 1; diff --git a/src/mamidimemo/instruments/YM2413.cs b/src/mamidimemo/instruments/YM2413.cs index 9e9c64ba7840c..0a7222da9c0d2 100644 --- a/src/mamidimemo/instruments/YM2413.cs +++ b/src/mamidimemo/instruments/YM2413.cs @@ -799,7 +799,8 @@ public enum ToneType [TypeConverter(typeof(CustomExpandableObjectConverter))] [JsonConverter(typeof(NoTypeConverterJsonConverter))] [DataContract] - public class YM2413Operator + [MidiHook] + public class YM2413Operator : ContextBoundObject { private byte f_AM; diff --git a/src/mamidimemo/instruments/YM2612.cs b/src/mamidimemo/instruments/YM2612.cs index d5f15792dc812..7a2d8c498d419 100644 --- a/src/mamidimemo/instruments/YM2612.cs +++ b/src/mamidimemo/instruments/YM2612.cs @@ -893,7 +893,8 @@ public override void RestoreFrom(string serializeData) [TypeConverter(typeof(CustomExpandableObjectConverter))] [JsonConverter(typeof(NoTypeConverterJsonConverter))] [DataContract] - public class YM2612Operator + [MidiHook] + public class YM2612Operator : ContextBoundObject { private byte f_Enable = 1; diff --git a/src/mamidimemo/instruments/YM3812.cs b/src/mamidimemo/instruments/YM3812.cs index f9542e102d652..52ff2c349d9b3 100644 --- a/src/mamidimemo/instruments/YM3812.cs +++ b/src/mamidimemo/instruments/YM3812.cs @@ -646,7 +646,8 @@ public override void RestoreFrom(string serializeData) [TypeConverter(typeof(CustomExpandableObjectConverter))] [JsonConverter(typeof(NoTypeConverterJsonConverter))] [DataContract] - public class YM3812Operator + [MidiHook] + public class YM3812Operator : ContextBoundObject { private byte f_AM;