Exemple #1
0
        public override void SetToneDoubler(partWork pw, MML mml)
        {
            return;

            int i = pw.instrument;

            if (i < 0)
            {
                return;
            }

            pw.toneDoublerKeyShift = 0;
            mucomVoice instFM = parent.instFM[i];

            if (instFM == null || instFM.data.Length < 1)
            {
                return;
            }
            Note note = (Note)mml.args[0];

            if (pw.TdA == -1)
            {
                //resetToneDoubler
                //ML
                if (pw.op1ml != instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3])
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 0, instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3]);
                    pw.op1ml = instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3];
                }
                if (pw.op2ml != instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3])
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 1, instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3]);
                    pw.op2ml = instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3];
                }
                if (pw.op3ml != instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3])
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 2, instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3]);
                    pw.op3ml = instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3];
                }
                if (pw.op4ml != instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3])
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 3, instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3]);
                    pw.op4ml = instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 7 + 3];
                }
                //DT2
                if (pw.op1dt2 != instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3])
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 0, instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3], instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op1dt2 = instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3];
                }
                if (pw.op2dt2 != instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3])
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 1, instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3], instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op2dt2 = instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3];
                }
                if (pw.op3dt2 != instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3])
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 2, instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3], instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op3dt2 = instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3];
                }
                if (pw.op4dt2 != instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3])
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 3, instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3], instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op4dt2 = instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9 + 3];
                }
            }
            else
            {
                //setToneDoubler
                int oct = pw.octaveNow;
                foreach (MML octMml in note.tDblOctave)
                {
                    switch (octMml.type)
                    {
                    case enmMMLType.Octave:
                        oct = (int)octMml.args[0];
                        break;

                    case enmMMLType.OctaveUp:
                        oct++;
                        break;

                    case enmMMLType.OctaveDown:
                        oct--;
                        break;
                    }
                }
                oct          = Common.CheckRange(oct, 1, 8);
                pw.octaveNew = oct;
                int            TdB             = oct * 12 + Const.NOTE.IndexOf(note.tDblCmd) + note.tDblShift + pw.keyShift; // + pw.arpDelta;
                int            s               = TdB - pw.TdA;                                                               // - TdB;
                int            us              = Math.Abs(s);
                int            n               = pw.toneDoubler;
                clsToneDoubler instToneDoubler = parent.instToneDoubler[n];
                if (us >= instToneDoubler.lstTD.Count)
                {
                    return;
                }

                pw.toneDoublerKeyShift = ((s < 0) ? s : 0) + instToneDoubler.lstTD[us].KeyShift;

                //ML
                if (pw.op1ml != instToneDoubler.lstTD[us].OP1ML)
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 0, instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instToneDoubler.lstTD[us].OP1ML);
                    pw.op1ml = instToneDoubler.lstTD[us].OP1ML;
                }
                if (pw.op2ml != instToneDoubler.lstTD[us].OP2ML)
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 1, instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instToneDoubler.lstTD[us].OP2ML);
                    pw.op2ml = instToneDoubler.lstTD[us].OP2ML;
                }
                if (pw.op3ml != instToneDoubler.lstTD[us].OP3ML)
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 2, instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instToneDoubler.lstTD[us].OP3ML);
                    pw.op3ml = instToneDoubler.lstTD[us].OP3ML;
                }
                if (pw.op4ml != instToneDoubler.lstTD[us].OP4ML)
                {
                    ((YM2151)pw.chip).OutSetDtMl(pw, 3, instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8 + 3], instToneDoubler.lstTD[us].OP4ML);
                    pw.op4ml = instToneDoubler.lstTD[us].OP4ML;
                }
                //DT2
                if (pw.op1dt2 != instToneDoubler.lstTD[us].OP1DT2)
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 0, instToneDoubler.lstTD[us].OP1DT2, instFM.data[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op1dt2 = instToneDoubler.lstTD[us].OP1DT2;
                }
                if (pw.op2dt2 != instToneDoubler.lstTD[us].OP2DT2)
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 1, instToneDoubler.lstTD[us].OP2DT2, instFM.data[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op2dt2 = instToneDoubler.lstTD[us].OP2DT2;
                }
                if (pw.op3dt2 != instToneDoubler.lstTD[us].OP3DT2)
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 2, instToneDoubler.lstTD[us].OP3DT2, instFM.data[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op3dt2 = instToneDoubler.lstTD[us].OP3DT2;
                }
                if (pw.op4dt2 != instToneDoubler.lstTD[us].OP4DT2)
                {
                    ((YM2151)pw.chip).OutSetDt2Sr(pw, 3, instToneDoubler.lstTD[us].OP4DT2, instFM.data[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 2 + 3]);
                    pw.op4dt2 = instToneDoubler.lstTD[us].OP4DT2;
                }

                //pw.ppg[pw.cpgNum].TdA = -1;
            }
        }
Exemple #2
0
        public override void SetToneDoubler(partPage page, MML mml)
        {
            int i = page.instrument;

            if (i < 0)
            {
                return;
            }

            page.toneDoublerKeyShift = 0;
            byte[] instOPM = parent.instOPM[i].Item2;
            if (instOPM == null || instOPM.Length < 1)
            {
                return;
            }
            Note note = (Note)mml.args[0];

            if (page.TdA == -1)
            {
                //resetToneDoubler
                //ML
                if (page.op1ml != instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8])
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 0, instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8]);
                    page.op1ml = instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8];
                }
                if (page.op2ml != instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8])
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 1, instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8]);
                    page.op2ml = instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8];
                }
                if (page.op3ml != instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8])
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 2, instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8]);
                    page.op3ml = instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8];
                }
                if (page.op4ml != instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8])
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 3, instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8]);
                    page.op4ml = instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 8];
                }
                //DT2
                if (page.op1dt2 != instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10])
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 0, instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10], instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op1dt2 = instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10];
                }
                if (page.op2dt2 != instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10])
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 1, instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10], instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op2dt2 = instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10];
                }
                if (page.op3dt2 != instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10])
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 2, instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10], instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op3dt2 = instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10];
                }
                if (page.op4dt2 != instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10])
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 3, instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10], instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op4dt2 = instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 10];
                }
            }
            else
            {
                //setToneDoubler
                int oct = page.octaveNow;
                foreach (MML octMml in note.tDblOctave)
                {
                    switch (octMml.type)
                    {
                    case enmMMLType.Octave:
                        oct = (int)octMml.args[0];
                        break;

                    case enmMMLType.OctaveUp:
                        oct++;
                        break;

                    case enmMMLType.OctaveDown:
                        oct--;
                        break;
                    }
                }
                oct            = Common.CheckRange(oct, 1, 8);
                page.octaveNew = oct;
                int            arpNote         = page.arpFreqMode ? 0 : page.arpDelta;
                int            TdB             = oct * 12 + Const.NOTE.IndexOf(note.tDblCmd) + note.tDblShift + page.keyShift + arpNote;
                int            s               = TdB - page.TdA;// - TdB;
                int            us              = Math.Abs(s);
                int            n               = page.toneDoubler;
                clsToneDoubler instToneDoubler = parent.instToneDoubler[n];
                if (us >= instToneDoubler.lstTD.Count)
                {
                    return;
                }

                page.toneDoublerKeyShift = ((s < 0) ? s : 0) + instToneDoubler.lstTD[us].KeyShift;

                //ML
                if (page.op1ml != instToneDoubler.lstTD[us].OP1ML)
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 0, instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instToneDoubler.lstTD[us].OP1ML);
                    page.op1ml = instToneDoubler.lstTD[us].OP1ML;
                }
                if (page.op2ml != instToneDoubler.lstTD[us].OP2ML)
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 1, instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instToneDoubler.lstTD[us].OP2ML);
                    page.op2ml = instToneDoubler.lstTD[us].OP2ML;
                }
                if (page.op3ml != instToneDoubler.lstTD[us].OP3ML)
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 2, instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instToneDoubler.lstTD[us].OP3ML);
                    page.op3ml = instToneDoubler.lstTD[us].OP3ML;
                }
                if (page.op4ml != instToneDoubler.lstTD[us].OP4ML)
                {
                    ((YM2151)page.chip).OutSetDtMl(mml, page, 3, instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 9], instToneDoubler.lstTD[us].OP4ML);
                    page.op4ml = instToneDoubler.lstTD[us].OP4ML;
                }
                //DT2
                if (page.op1dt2 != instToneDoubler.lstTD[us].OP1DT2)
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 0, instToneDoubler.lstTD[us].OP1DT2, instOPM[0 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op1dt2 = instToneDoubler.lstTD[us].OP1DT2;
                }
                if (page.op2dt2 != instToneDoubler.lstTD[us].OP2DT2)
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 1, instToneDoubler.lstTD[us].OP2DT2, instOPM[1 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op2dt2 = instToneDoubler.lstTD[us].OP2DT2;
                }
                if (page.op3dt2 != instToneDoubler.lstTD[us].OP3DT2)
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 2, instToneDoubler.lstTD[us].OP3DT2, instOPM[2 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op3dt2 = instToneDoubler.lstTD[us].OP3DT2;
                }
                if (page.op4dt2 != instToneDoubler.lstTD[us].OP4DT2)
                {
                    ((YM2151)page.chip).OutSetDt2Sr(mml, page, 3, instToneDoubler.lstTD[us].OP4DT2, instOPM[3 * Const.INSTRUMENT_M_OPERATOR_SIZE + 3]);
                    page.op4dt2 = instToneDoubler.lstTD[us].OP4DT2;
                }

                //pw.ppg[pw.cpgNum].TdA = -1;
            }
        }