public YM3812OperatorStats GetOperatorStats(int OperatorID) { if (OperatorID < 1) { OperatorID = 1; } if (OperatorID > 18) { OperatorID = 18; } YM3812OperatorStats result = Operators[OperatorID]; int opofs = OperatorIDToOperatorOffset(OperatorID); result.AmpMod = AmpMod(opofs); result.Attack = Attack(opofs); result.Decay = Decay(opofs); result.EGType = EGType(opofs); result.KeyScale = KeyScale(opofs); result.KeyScaling = KeyScaling(opofs); result.Mult = Mult(opofs); result.Release = Release(opofs); result.Sustain = Sustain(opofs); result.TotalLevel = TotalLevel(opofs); result.Vibrato = Vibrato(opofs); result.Waveform = Waveform(opofs); return(result); }
static void DrawOPStat(YM3812OperatorStats os, int hp, int vp) { Console.SetCursorPosition(hp, vp + 1); Console.Write(os.OperatorID.ToString("00")); Console.SetCursorPosition(hp, vp + 2); Console.Write(os.Attack.ToString("00")); Console.SetCursorPosition(hp, vp + 3); Console.Write(os.Decay.ToString("00")); Console.SetCursorPosition(hp, vp + 4); Console.Write(os.Sustain.ToString("00")); Console.SetCursorPosition(hp, vp + 5); Console.Write(os.Release.ToString("00")); Console.SetCursorPosition(hp, vp + 6); Console.Write(os.TotalLevel.ToString("00")); Console.SetCursorPosition(hp, vp + 7); Console.Write(os.Mult.ToString("00")); Console.SetCursorPosition(hp, vp + 8); Console.Write(os.EGType ? "EG" : " "); Console.SetCursorPosition(hp, vp + 9); Console.Write(os.Vibrato ? "VIB" : " "); Console.SetCursorPosition(hp, vp + 10); Console.Write(os.AmpMod ? "AMP" : " "); Console.SetCursorPosition(hp, vp + 11); Console.Write(os.KeyScale ? "KS" : " "); Console.SetCursorPosition(hp, vp + 12); Console.Write(os.KeyScaling); Console.SetCursorPosition(hp, vp + 13); Console.Write(os.Waveform); }
public static void LoadFromYM3812Operator(TrackConv.YM2151operator ym2151op, YM3812OperatorStats ym3812op) { ym2151op.AM = ym3812op.AmpMod ? (byte)1 : (byte)0; ym2151op.AR = (byte)(ym3812op.Attack << 1); ym2151op.D1L = (byte)ym3812op.Sustain; ym2151op.D1R = (byte)(ym3812op.Decay << 1); ym2151op.D2R = (byte)(ym3812op.Release << 1); ym2151op.DT = 0; ym2151op.DT2 = 0; ym2151op.KS = (byte)ym3812op.KeyScaling; ym2151op.MULT = (byte)ym3812op.Mult; ym2151op.RR = (byte)(ym3812op.Release << 1); ym2151op.TL = (byte)(ym3812op.TotalLevel << 1); }
public YM3812() { for (int i = 1; i < 19; i++) { Operators[i] = new YM3812OperatorStats(); Operators[i].OperatorID = i; } for (int i = 0; i < 9; i++) { Channels[i] = new YM3812ChannelStats(); Channels[i].ChannelID = i; Channels[i].OPR1 = Operators[GetOPR1ID(i)]; Channels[i].OPR2 = Operators[GetOPR2ID(i)]; } }