private void SetMute(DataGridViewRow r) { string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (mmlParams == null) { return; } if (!mmlParams.Insts.ContainsKey(chip)) { return; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; int pn = (int)r.Cells["ClmPartNumber"].Value - 1; bool mute = (string)r.Cells["ClmMute"].Value == "M"; mmli.SetMute(pn, mute); //特殊処理:mucの場合はリズムは一括で制御 if (pn == 12 && (string)r.Cells["ClmPart"].Value == "G") { for (int i = 0; i < 5; i++) { mmli.SetMute(i + 13, mute); } } }
private void SetMute(DataGridViewRow r) { string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (mmlParams == null) { return; } if (!mmlParams.Insts.ContainsKey(chip)) { return; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; int pn = (int)r.Cells["ClmPartNumber"].Value - 1; bool mute = (string)r.Cells["ClmMute"].Value == "M"; if (!(mmli is YM2608_mucom) && !(mmli is YM2610B_mucom)) { mmli.SetMute(pn, mute); return; } string cp = (string)r.Cells["ClmPart"].Value; int ch = cp[0] - 'A'; int pg;// = cp.Length < 2 ? 0 : (cp[1] - '0'); string mm = (string)r.Cells["ClmMute"].Value; string sm = (string)r.Cells["ClmSolo"].Value; foreach (DataGridViewRow rw in dgvPartCounter.Rows) { string p = (string)rw.Cells["ClmPart"].Value; int c = p[0] - 'A'; if (c != ch) { continue; } rw.Cells["ClmMute"].Value = mm; rw.Cells["ClmSolo"].Value = sm; pn = (int)rw.Cells["ClmPartNumber"].Value - 1; pg = p.Length < 2 ? 0 : (p[1] - '0'); ((YM2608_mucom)mmli).SetMute(pn, ch, pg, mute); } }
private void Timer_Tick(object sender, EventArgs e) { if (mmlParams == null) { return; } //パラメータ取得 //パラメータ描画 dgvPartCounter.SuspendLayout(); for (int p = 0; p < dgvPartCounter.Rows.Count; p++) { string chip = (string)dgvPartCounter.Rows[p].Cells["ClmChip"].Value; int r = (int)dgvPartCounter.Rows[p].Cells["ClmPartNumber"].Value - 1; if (r < 0) { continue; } int chipIndex = (int)dgvPartCounter.Rows[p].Cells["ClmChipIndex"].Value; int chipNumber = (int)dgvPartCounter.Rows[p].Cells["ClmChipNumber"].Value; if (!mmlParams.Insts.ContainsKey(chip)) { continue; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { continue; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; dgvPartCounter.Rows[p].Cells["ClmInstrument"].Value = mmli.inst[r] == null ? "-" : mmli.inst[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmEnvelope"].Value = mmli.envelope[r] == null ? "-" : mmli.envelope[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmVolume"].Value = mmli.vol[r] == null ? "-" : mmli.vol[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmExpression"].Value = mmli.expression[r] == null ? "-" : mmli.expression[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmVelocity"].Value = mmli.velocity[r] == null ? "-" : mmli.velocity[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmPan"].Value = mmli.pan[r] == null ? "-" : mmli.pan[r]; dgvPartCounter.Rows[p].Cells["ClmNote"].Value = mmli.notecmd[r] == null ? "-" : mmli.notecmd[r]; dgvPartCounter.Rows[p].Cells["ClmLength"].Value = mmli.length[r] == null ? "-" : mmli.length[r]; dgvPartCounter.Rows[p].Cells["ClmEnvSw"].Value = mmli.envSw[r] == null ? "-" : mmli.envSw[r]; dgvPartCounter.Rows[p].Cells["ClmLfoSw"].Value = mmli.lfoSw[r] == null ? "-" : mmli.lfoSw[r]; dgvPartCounter.Rows[p].Cells["ClmDetune"].Value = mmli.detune[r] == null ? "-" : mmli.detune[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmKeyShift"].Value = mmli.keyShift[r] == null ? "-" : mmli.keyShift[r].ToString(); DrawMeter(dgvPartCounter.Rows[p].Cells["ClmMeter"], mmli, r); } dgvPartCounter.ResumeLayout(); }
private bool CheckMucomParameter() { if (dgvPartCounter.Rows.Count < 1) { return(false); } DataGridViewRow r = dgvPartCounter.Rows[0]; string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (mmlParams == null) { return(false); } if (!mmlParams.Insts.ContainsKey(chip)) { return(false); } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return(false); } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; if (mmli is YM2608_mucom) { return(true); } if (mmli is YM2610B_mucom) { return(true); } if (mmli is YM2151_mucom) { return(true); } return(false); }
private void SetMute(DataGridViewRow r) { string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (!mmlParams.Insts.ContainsKey(chip)) { return; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; int pn = (int)r.Cells["ClmPartNumber"].Value - 1; bool mute = (string)r.Cells["ClmMute"].Value == "M"; mmli.SetMute(pn, mute); }
private void SetMute(DataGridViewRow r) { string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (mmlParams == null) { return; } if (!mmlParams.Insts.ContainsKey(chip)) { return; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; int pn = (int)r.Cells["ClmPartNumber"].Value - 1; bool mute = (string)r.Cells["ClmMute"].Value == "M"; if (!(mmli is YM2608_mucom) && !(mmli is YM2610B_mucom) && !(mmli is YM2151_mucom)) { mmli.SetMute(pn, mute); return; } string cp = (string)r.Cells["ClmPart"].Value; int isOPNA = "ABCDEFGHIJKLMNOPQRSTUV".IndexOf(cp[0]) < 0 ? ("abcdefghijklmnopqrstuv".IndexOf(cp[0]) < 0 ? 2 : 1) : 0; int ch; int cn = 0; if (isOPNA < 2) { ch = (cp[0] < 'a') ? (cp[0] - 'A') : (cp[0] - 'a'); cn = ch < 11 ? 0 : 1; ch = ch < 11 ? ch : (ch - 11); } else { ch = (cp[0] <= 'w' ? (cp[0] - 'W') : (cp[0] - 'w' + 4)); } int pg;// = cp.Length < 2 ? 0 : (cp[1] - '0'); string mm = (string)r.Cells["ClmMute"].Value; string sm = (string)r.Cells["ClmSolo"].Value; //int partKey = (int)r.Cells["ClmMuteMngKey"].Value; //muteStatus ms = muteManager.GetStatus(partKey); foreach (DataGridViewRow rw in dgvPartCounter.Rows) { string p = (string)rw.Cells["ClmPart"].Value; int isOPNAc = "ABCDEFGHIJKLMNOPQRSTUV".IndexOf(p[0]) < 0 ? ("abcdefghijklmnopqrstuv".IndexOf(p[0]) < 0 ? 2 : 1) : 0; if (isOPNA != isOPNAc) { continue; } int c; int n = 0; if (isOPNAc < 2) { c = (p[0] < 'a') ? (p[0] - 'A') : (p[0] - 'a'); n = c < 11 ? 0 : 1; if (n != cn) { continue; } c = c < 11 ? c : (c - 11); } else { if (n != cn) { continue; } c = (p[0] <= 'w' ? (p[0] - 'W') : (p[0] - 'w' + 4)); } if (c != ch) { continue; } //partKey = (int)rw.Cells["ClmMuteMngKey"].Value; //muteManager.SetMuteSolo(partKey, ms); rw.Cells["ClmMute"].Value = mm; rw.Cells["ClmSolo"].Value = sm; pn = (int)rw.Cells["ClmPartNumber"].Value - 1; pg = p.Length < 2 ? 0 : (p[1] - '0'); if (isOPNA == 0) { ((YM2608_mucom)mmli).SetMute(pn, ch, pg, mute); } else if (isOPNA == 1) { ((YM2610B_mucom)mmli).SetMute(pn, ch, pg, mute); } else { ((YM2151_mucom)mmli).SetMute(pn, ch, pg, mute); } } }
private void Timer_Tick(object sender, EventArgs e) { if (mmlParams == null) { return; } //パラメータ取得 //パラメータ描画 dgvPartCounter.SuspendLayout(); for (int p = 0; p < dgvPartCounter.Rows.Count; p++) { string chip = (string)dgvPartCounter.Rows[p].Cells["ClmChip"].Value; int r = (int)dgvPartCounter.Rows[p].Cells["ClmPartNumber"].Value - 1; if (r < 0) { continue; } int chipIndex = (int)dgvPartCounter.Rows[p].Cells["ClmChipIndex"].Value; int chipNumber = (int)dgvPartCounter.Rows[p].Cells["ClmChipNumber"].Value; if (!mmlParams.Insts.ContainsKey(chip)) { continue; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { continue; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; if (mmli is YM2608_mucom) { string cp = (string)dgvPartCounter.Rows[p].Cells["ClmPart"].Value; int ch = cp[0] - (chipNumber == 0 ? 'A' : 'L'); int pg = cp.Length < 2 ? 0 : (cp[1] - '0'); r = ch * 10 + pg; } else if (mmli is YM2610B_mucom) { string cp = (string)dgvPartCounter.Rows[p].Cells["ClmPart"].Value; int ch = cp[0] - (chipNumber == 0 ? 'a' : 'l'); int pg = cp.Length < 2 ? 0 : (cp[1] - '0'); r = ch * 10 + pg; } else if (mmli is YM2151_mucom) { string cp = (string)dgvPartCounter.Rows[p].Cells["ClmPart"].Value; int ch = (cp[0] < 'w') ? (cp[0] - 'W') : (cp[0] - 'w' + 4); int pg = cp.Length < 2 ? 0 : (cp[1] - '0'); r = ch * 10 + pg; } if (r >= mmli.inst.Length) { continue; } dgvPartCounter.Rows[p].Cells["ClmInstrument"].Value = mmli.inst[r] == null ? "-" : mmli.inst[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmEnvelope"].Value = mmli.envelope[r] == null ? "-" : mmli.envelope[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmVolume"].Value = mmli.vol[r] == null ? "-" : mmli.vol[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmExpression"].Value = mmli.expression[r] == null ? "-" : mmli.expression[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmVelocity"].Value = mmli.velocity[r] == null ? "-" : mmli.velocity[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmPan"].Value = mmli.pan[r] == null ? "-" : mmli.pan[r]; dgvPartCounter.Rows[p].Cells["ClmGateTime"].Value = mmli.gatetime[r] == null ? "-" : mmli.gatetime[r]; dgvPartCounter.Rows[p].Cells["ClmNote"].Value = mmli.notecmd[r] == null ? "-" : mmli.notecmd[r]; dgvPartCounter.Rows[p].Cells["ClmLength"].Value = mmli.length[r] == null ? "-" : mmli.length[r]; dgvPartCounter.Rows[p].Cells["ClmEnvSw"].Value = mmli.envSw[r] == null ? "-" : mmli.envSw[r]; dgvPartCounter.Rows[p].Cells["ClmLfoSw"].Value = mmli.lfoSw[r] == null ? "-" : mmli.lfoSw[r]; dgvPartCounter.Rows[p].Cells["ClmLfo"].Value = mmli.lfo[r] == null ? "-" : mmli.lfo[r]; dgvPartCounter.Rows[p].Cells["ClmHLfo"].Value = mmli.hlfo[r] == null ? "-" : mmli.hlfo[r]; dgvPartCounter.Rows[p].Cells["ClmDetune"].Value = mmli.detune[r] == null ? "-" : mmli.detune[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmKeyShift"].Value = mmli.keyShift[r] == null ? "-" : mmli.keyShift[r].ToString(); dgvPartCounter.Rows[p].Cells["ClmMIDIch"].Value = mmli.MIDIch[r] == null ? "-" : mmli.MIDIch[r].ToString(); DrawMeter(dgvPartCounter.Rows[p].Cells["ClmMeter"], mmli, r); } dgvPartCounter.ResumeLayout(); }
private void SetAssign(DataGridViewRow r) { string chip = (string)r.Cells["ClmChip"].Value; int chipIndex = (int)r.Cells["ClmChipIndex"].Value; int chipNumber = (int)r.Cells["ClmChipNumber"].Value; if (mmlParams == null) { return; } if (!mmlParams.Insts.ContainsKey(chip)) { return; } if (!mmlParams.Insts[chip].ContainsKey(chipIndex) || !mmlParams.Insts[chip][chipIndex].ContainsKey(chipNumber)) { return; } MMLParameter.Instrument mmli = mmlParams.Insts[chip][chipIndex][chipNumber]; int pn = (int)r.Cells["ClmPartNumber"].Value - 1; bool assign = (string)r.Cells[clmKBDAssign].Value == Assign; //mucom以外は加工無し if (!(mmli is YM2608_mucom) && !(mmli is YM2610B_mucom) && !(mmli is YM2151_mucom)) { mmli.SetAssign(pn, assign); return; } //mucomの場合は同系パートも同時にAssignする string cp = (string)r.Cells["ClmPart"].Value; int isOPNA = "ABCDEFGHIJKLMNOPQRSTUV".IndexOf(cp[0]) < 0 ? ("abcdefghijklmnopqrstuv".IndexOf(cp[0]) < 0 ? 2 : 1) : 0; int ch; int cn = 0; if (isOPNA < 2) { ch = (cp[0] < 'a') ? (cp[0] - 'A') : (cp[0] - 'a'); cn = ch < 11 ? 0 : 1; ch = ch < 11 ? ch : (ch - 11); } else { ch = (cp[0] <= 'W' ? (cp[0] - 'W') : (cp[0] - 'w' + 4)); } int pg;// = cp.Length < 2 ? 0 : (cp[1] - '0'); string am = (string)r.Cells[clmKBDAssign].Value; foreach (DataGridViewRow rw in dgvPartCounter.Rows) { string p = (string)rw.Cells["ClmPart"].Value; int isOPNAc = "ABCDEFGHIJKLMNOPQRSTUV".IndexOf(p[0]) < 0 ? ("abcdefghijklmnopqrstuv".IndexOf(p[0]) < 0 ? 2 : 1) : 0; if (isOPNA != isOPNAc) { continue; } int c; int n = 0; if (isOPNAc < 2) { c = (p[0] < 'a') ? (p[0] - 'A') : (p[0] - 'a'); n = c < 11 ? 0 : 1; if (n != cn) { continue; } c = c < 11 ? c : (c - 11); } else { if (n != cn) { continue; } c = (p[0] <= 'W' ? (p[0] - 'W') : (p[0] - 'w' + 4)); } if (c != ch) { continue; } rw.Cells[clmKBDAssign].Value = am; pn = (int)rw.Cells["ClmPartNumber"].Value - 1; pg = p.Length < 2 ? 0 : (p[1] - '0'); if (isOPNA == 0) { ((YM2608_mucom)mmli).SetAssign(pn, ch, pg, assign); } else if (isOPNA == 1) { ((YM2610B_mucom)mmli).SetAssign(pn, ch, pg, assign); } else { ((YM2151_mucom)mmli).SetAssign(pn, ch, pg, assign); } } }