void OPLL_copyPatch(OPLL opll, int num, OPLL_PATCH patch) { opll.patch[num] = (OPLL_PATCH)patch.Clone(); }
/* Change a rhythm voice */ static void setSlotPatch(OPLL_SLOT slot, OPLL_PATCH patch) { slot.patch = patch; }
static void makeDefaultPatch() { for (int i = 0; i < OPLL_TONE_NUM; i++) { for (int j = 0; j < 19; j++) { default_patch[i, j * 2 + 0] = new OPLL_PATCH(); default_patch[i, j * 2 + 1] = new OPLL_PATCH(); OPLL_getDefaultPatch(i, j, new[] { default_patch[i, j * 2 + 0], default_patch[i, j * 2 + 1] }); } } }
OPLL_getDefaultPatch(int type, int num, OPLL_PATCH[] patch) { byte[] r = new byte[8]; Array.Copy(default_inst[type], num * 16, r, 0, r.Length); OPLL_dump2patch(r, patch); }
static void OPLL_dump2patch(byte[] dump, OPLL_PATCH[] patch) { patch[0].am = (uint)(dump[0] >> 7) & 1; patch[1].am = (uint)(dump[1] >> 7) & 1; patch[0].pm = (uint)(dump[0] >> 6) & 1; patch[1].pm = (uint)(dump[1] >> 6) & 1; patch[0].eg = (uint)(dump[0] >> 5) & 1; patch[1].eg = (uint)(dump[1] >> 5) & 1; patch[0].kr = (uint)(dump[0] >> 4) & 1; patch[1].kr = (uint)(dump[1] >> 4) & 1; patch[0].ml = (uint)(dump[0]) & 15; patch[1].ml = (uint)(dump[1]) & 15; patch[0].kl = (uint)(dump[2] >> 6) & 3; patch[1].kl = (uint)(dump[3] >> 6) & 3; patch[0].tl = (uint)(dump[2]) & 63; patch[0].fb = (uint)(dump[3]) & 7; patch[0].wf = (uint)(dump[3] >> 3) & 1; patch[1].wf = (uint)(dump[3] >> 4) & 1; patch[0].ar = (uint)(dump[4] >> 4) & 15; patch[1].ar = (uint)(dump[5] >> 4) & 15; patch[0].dr = (uint)(dump[4]) & 15; patch[1].dr = (uint)(dump[5]) & 15; patch[0].sl = (uint)(dump[6] >> 4) & 15; patch[1].sl = (uint)(dump[7] >> 4) & 15; patch[0].rr = (uint)(dump[6]) & 15; patch[1].rr = (uint)(dump[7]) & 15; }
public object Clone() { OPLL_PATCH o = new OPLL_PATCH(); o.tl = this.tl; o.fb = this.fb; o.eg = this.eg; o.ml = this.ml; o.ar = this.ar; o.dr = this.dr; o.sl = this.sl; o.rr = this.rr; o.kr = this.kr; o.kl = this.kl; o.am = this.am; o.pm = this.pm; o.wf = this.wf; return o; }