Exemple #1
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type;
            bool re = false;
            int  n;

            if (mml.args[0] is bool)
            {
                type = (char)mml.args[1];
                re   = true;
                n    = (int)mml.args[2];
            }
            else
            {
                type = (char)mml.args[0];
                n    = (int)mml.args[1];
            }

            //Duty比切り替え
            if (type == 'I')
            {
                if (page.Type == enmChannelType.Square)
                {
                    if (re)
                    {
                        n = page.instrument + n;
                    }
                    n = Common.CheckRange(n, 0, 7);
                    page.dutyCycle = n;
                    SetDummyData(page, mml);
                    return;
                }

                msgBox.setErrMsg(msg.get("E32000"), mml.line.Lp);
                return;
            }

            //E指定 ソフトエンベロープ切り替え
            if (type == 'E')
            {
                SetEnvelopParamFromInstrument(page, n, re, mml);
                return;
            }

            //無指定でdpcm以外の場合は ソフトエンベロープ切り替え
            if (page.Type != enmChannelType.DPCM)
            {
                SetEnvelopParamFromInstrument(page, n, re, mml);
                return;
            }
        }
Exemple #2
0
        public override void SetFNum(partPage page, MML mml)
        {
            int arpNote = page.arpFreqMode ? 0 : page.arpDelta;
            int arpFreq = page.arpFreqMode ? page.arpDelta : 0;

            int f = GetK053260FNum(mml, page, page.octaveNow, page.noteCmd, page.shift + page.keyShift + arpNote);//

            if (page.bendWaitCounter != -1)
            {
                f = page.bendFnum;
            }
            f = f + page.detune;
            f = f + arpFreq;
            for (int lfo = 0; lfo < 4; lfo++)
            {
                if (!page.lfo[lfo].sw)
                {
                    continue;
                }
                if (page.lfo[lfo].type != eLfoType.Vibrato)
                {
                    continue;
                }
                f += page.lfo[lfo].value + page.lfo[lfo].param[6];
            }

            f = Common.CheckRange(f, 0, 0xfff);
            if (page.spg.freq == f)
            {
                return;
            }

            page.spg.freq = f;


            //Delta
            int data = f & 0xfff;

            if (page.spg.beforeFNum != data)
            {
                int adr = (page.ch + 1) * 8 + 0x00;
                OutK053260Port(mml, port[0], page
                               , (byte)adr
                               , (byte)data);
                adr++;
                OutK053260Port(mml, port[0], page
                               , (byte)adr
                               , (byte)((data & 0xf00) >> 8));
                page.spg.beforeFNum = data;
            }
        }
Exemple #3
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type = (char)mml.args[0];
            int  n    = (int)mml.args[1];

            if (type == 'n' || type == 'N' || type == 'R' || type == 'A')
            {
                if (page.Type == enmChannelType.FMOPNex)
                {
                    page.instrument = n;
                    lstPartWork[2].cpg.instrument = n;
                    lstPartWork[6].cpg.instrument = n;
                    lstPartWork[7].cpg.instrument = n;
                    lstPartWork[8].cpg.instrument = n;
                    OutFmSetInstrument(page, mml, n, page.volume, type);
                    return;
                }
            }

            if (type == 'n')
            {
                if (page.pcm)
                {
                    if (page.isPcmMap)
                    {
                        page.pcmMapNo = n;
                        if (!parent.instPCMMap.ContainsKey(n))
                        {
                            msgBox.setErrMsg(string.Format(msg.get("E10024"), n), mml.line.Lp);
                        }
                        return;
                    }

                    page.instrument = n;
                    if (!parent.instPCM.ContainsKey(n))
                    {
                        msgBox.setErrMsg(string.Format(msg.get("E20002"), n), mml.line.Lp);
                    }
                    else
                    {
                        if (parent.instPCM[n].Item2.chip != enmChipType.YM2612)
                        {
                            msgBox.setErrMsg(string.Format(msg.get("E20003"), n), mml.line.Lp);
                        }
                    }
                    return;
                }
            }

            base.CmdInstrument(page, mml);
        }
Exemple #4
0
        public override void CmdPan(partPage page, MML mml)
        {
            int n = (int)mml.args[0];

            n        = Common.CheckRange(n, 0, 3);
            page.pan = ((n & 1) << 1) | ((n & 2) >> 1);//LR反転
            int vch = page.ch;

            if (page.Type == enmChannelType.RHYTHM)
            {
                if (page.ch == 18)
                {
                    vch = 6;
                }
                else if (page.ch == 19)
                {
                    vch = 7;
                }
                else if (page.ch == 20)
                {
                    vch = 8;
                }
                else if (page.ch == 21)
                {
                    vch = 8;
                }
                else if (page.ch == 22)
                {
                    vch = 7;
                }
            }

            byte[] port = getPortFromCh(vch);

            byte PanFbCnt = 0;

            if (page.instrument != -1)
            {
                PanFbCnt = (byte)(
                    (parent.instOPL[page.instrument].Item2[26] & 0x07) << 1
                        | parent.instOPL[page.instrument].Item2[25] & 0x01
                    );
            }

            SOutData(page, mml, port, (byte)(vch % 9 + 0xC0), (byte)((
                                                                         PanFbCnt
                                                                         | (page.pan * 0x10) // PAN
                                                                         )));

            SetDummyData(page, mml);
        }
Exemple #5
0
        public override void CmdY(partPage page, MML mml)
        {
            base.CmdY(page, mml);

            if (mml.args[0] is string)
            {
                return;
            }

            byte adr = (byte)(int)mml.args[0];
            byte dat = (byte)(int)mml.args[1];

            SOutData(page, mml, (page.ch > 2 && page.ch < 6) ? port[1] : port[0], adr, dat);
        }
Exemple #6
0
        public override void SetupPageData(partWork pw, partPage page)
        {
            OutC140KeyOff(null, page);
            page.spg.instrument = -1;

            //周波数
            page.spg.freq = -1;
            SetFNum(page, null);

            //音量(パン兼用)
            page.spg.beforeLVolume = -1;
            page.spg.beforeRVolume = -1;
            SetVolume(page, null);
        }
Exemple #7
0
        private void OutPsgVolume(partPage page, MML mml)
        {
            if (page.pcm)
            {
                return;
            }

            if (page.spg.beforeVolume != page.beforeVolume)
            {
                byte data = (byte)(0x80 + (page.ch << 5) + 0x10 + (15 - page.beforeVolume));
                OutPsgPort(page, mml, port[0], data);
                page.spg.beforeVolume = page.beforeVolume;
            }
        }
Exemple #8
0
        public override void CmdMIDICh(partPage page, MML mml)
        {
            int ch = (int)mml.args[0];

            page.MIDIch = ch & 0xf;

            MML vmml = new MML();

            vmml.type = enmMMLType.MIDICh;
            vmml.args = new List <object>();
            vmml.args.Add(page.MIDIch);
            vmml.line = mml.line;
            SetDummyData(page, vmml);
        }
Exemple #9
0
        public override void CmdVelocity(partPage page, MML mml)
        {
            int vel = (int)mml.args[0];

            page.velocity = vel & 0x7f;

            MML vmml = new MML();

            vmml.type = enmMMLType.Velocity;
            vmml.args = new List <object>();
            vmml.args.Add(page.velocity);
            vmml.line = mml.line;
            SetDummyData(page, vmml);
        }
Exemple #10
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type;
            bool re = false;
            int  n;

            if (mml.args[0] is bool)
            {
                type = (char)mml.args[1];
                re   = true;
                n    = (int)mml.args[2];
            }
            else
            {
                type = (char)mml.args[0];
                n    = (int)mml.args[1];
            }

            if (type == 'E')
            {
                n = SetEnvelopParamFromInstrument(page, n, re, mml);
                return;
            }
            else if (type == 'S')
            {
                if (re)
                {
                    n = page.instrument + n;
                }
                SendSysEx(page, mml, n);
                return;
            }

            if (re)
            {
                n = page.instrument + n;
            }
            n = Common.CheckRange(n, 0, 127);
            page.instrument = n;

            MML vmml = new MML();

            vmml.type = enmMMLType.Instrument;
            vmml.args = new List <object>();
            vmml.args.Add(page.instrument);
            vmml.line = mml.line;
            SetDummyData(page, vmml);

            OutMidiProgramChange(page, mml, (byte)page.instrument);
        }
Exemple #11
0
        private void OutDCSGCh3Freq(partPage page, MML mml)
        {
            dcsgCh3Freq = Common.CheckRange(dcsgCh3Freq, -1, 0x3ff);

            if (beforeDcsgCh3Freq != dcsgCh3Freq && dcsgCh3Freq != -1)
            {
                beforeDcsgCh3Freq = dcsgCh3Freq;
                byte data = (byte)(0xc0 + (dcsgCh3Freq & 0xf));
                OutPsgPort(page, mml, port[0], data);

                data = (byte)(dcsgCh3Freq >> 4);
                OutPsgPort(page, mml, port[0], data);
            }
        }
Exemple #12
0
        protected virtual void SetInstAtChannelPanFbCnt(partPage page, MML mml, int chNum, int pan, int fb, int cnt)
        {
            //portは9channel毎に切り替わる
            byte[] port = this.port[chNum / 9];

            SOutData(page,
                     mml,
                     port,
                     (byte)(chNum % 9 + 0xC0),
                     (byte)(
                         ((fb & 0x07) << 1) | (cnt & 0x01) | (pan * 0x10) // PAN(CHA,CHB (CHC,CHDは未使用))
                         )
                     );
        }
Exemple #13
0
        public override void SetLfoAtKeyOn(partPage page, MML mml)
        {
            base.SetLfoAtKeyOn(page, mml);

            for (int lfo = 0; lfo < 4; lfo++)
            {
                clsLfo pl = page.lfo[lfo];
                if (!pl.sw)
                {
                    continue;
                }
                if (pl.type == eLfoType.Wah)
                {
                    continue;
                }

                if (pl.param[5] != 1)
                {
                    continue;
                }

                pl.isEnd            = false;
                pl.value            = (pl.param[0] == 0) ? pl.param[6] : 0;//ディレイ中は振幅補正は適用されない
                pl.waitCounter      = pl.param[0];
                pl.direction        = pl.param[2] < 0 ? -1 : 1;
                pl.depthWaitCounter = pl.param[7];
                pl.depth            = pl.param[3];
                pl.depthV2          = pl.param[2];

                if (pl.type == eLfoType.Vibrato)
                {
                    if (page.Type == enmChannelType.ADPCM)
                    {
                        SetAdpcmFNum(mml, page);
                    }
                }

                if (pl.type == eLfoType.Tremolo)
                {
                    page.beforeVolume = -1;

                    //if (pw.ppg[pw.cpgNum].Type == enmChannelType.RHYTHM)
                    //SetRhythmVolume(pw);
                    if (page.Type == enmChannelType.ADPCM)
                    {
                        SetAdpcmVolume(mml, page);
                    }
                }
            }
        }
Exemple #14
0
        public override void SetupPageData(partWork pw, partPage page)
        {
            page.keyOff         = true;
            page.spg.instrument = -1;

            page.spg.beforeEnvInstrument = -1;

            //周波数
            page.spg.beforeFNum = -1;

            //音量
            page.spg.beforeVolume = -1;
            SetVolume(page, null);
        }
Exemple #15
0
        public override void SetFNum(partPage page, MML mml)
        {
            if (page.Type != enmChannelType.DCSGNOISE)
            {
                int arpNote = page.arpFreqMode ? 0 : page.arpDelta;
                int arpFreq = page.arpFreqMode ? page.arpDelta : 0;

                int f = -page.detune;
                f = f - arpFreq;

                for (int lfo = 0; lfo < 4; lfo++)
                {
                    if (!page.lfo[lfo].sw)
                    {
                        continue;
                    }
                    if (page.lfo[lfo].type != eLfoType.Vibrato)
                    {
                        continue;
                    }
                    f -= page.lfo[lfo].value + page.lfo[lfo].param[6];//param[6] : 位相
                }

                if (page.octaveNow < 1)
                {
                    f <<= -page.octaveNow;
                }
                else
                {
                    f >>= page.octaveNow - 1;
                }

                if (page.bendWaitCounter != -1)
                {
                    f += page.bendFnum;
                }
                else
                {
                    f += GetDcsgFNum(page.octaveNow, page.noteCmd, page.shift + page.keyShift + arpNote);//
                }

                f         = Common.CheckRange(f, 0, 0x3ff);
                page.freq = f;
            }
            else
            {
                int f = 0xe0 + (page.noise & 7);
                page.freq = f;
            }
        }
Exemple #16
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type = (char)mml.args[0];
            int  n    = (int)mml.args[1];

            if (type == 'I')
            {
                msgBox.setErrMsg(msg.get("E22001")
                                 , mml.line.Lp);
                return;
            }

            if (type == 'T')
            {
                msgBox.setErrMsg(msg.get("E22002")
                                 , mml.line.Lp);
                return;
            }

            if (type == 'E')
            {
                n = SetEnvelopParamFromInstrument(page, n, mml);
                return;
            }

            n = Common.CheckRange(n, 0, 255);

            if (!parent.instPCM.ContainsKey(n))
            {
                msgBox.setErrMsg(string.Format(msg.get("E22003"), n)
                                 , mml.line.Lp);
                return;
            }

            if (parent.instPCM[n].Item2.chip != enmChipType.QSound)
            {
                msgBox.setErrMsg(string.Format(msg.get("E22004"), n)
                                 , mml.line.Lp);
                return;
            }

            page.instrument           = n;
            page.pcmStartAddress      = (int)parent.instPCM[n].Item2.stAdr;
            page.pcmEndAddress        = (int)parent.instPCM[n].Item2.edAdr;
            page.pcmLoopAddress       = (int)parent.instPCM[n].Item2.loopAdr;
            page.beforepcmLoopAddress = -1;
            page.pcmBank = (int)((parent.instPCM[n].Item2.stAdr >> 16));
            SetDummyData(page, mml);
        }
Exemple #17
0
        public override void MultiChannelCommand(MML mml)
        {
            if (!use)
            {
                return;
            }

            for (int i = 0; i < ChMax; i++)
            {
                partPage page = lstPartWork[i].cpg;
                //fnum
                if (page.beforeFNum != page.FNum)
                {
                    byte data = (byte)page.FNum;
                    OutK051649Port(page, mml, port[0], ChipNumber, 1, (byte)(0 + page.ch * 2), data);

                    data = (byte)((page.FNum & 0xf00) >> 8);
                    OutK051649Port(page, mml, port[0], ChipNumber, 1, (byte)(1 + page.ch * 2), data);
                    page.beforeFNum = page.FNum;
                }

                //instrument
                if (page.spg.instrument != page.instrument)
                {
                    page.spg.instrument = page.instrument;
                    ((K051649)page.chip).OutK051649SetInstrument(page, mml, page.instrument);
                }

                //volume
                SetSsgVolume(mml, page);

                //keyonoff
                if (page.keyOn)
                {
                    keyOnStatus |= (byte)(1 << page.ch);
                }
                else
                {
                    keyOnStatus &= (byte)~(1 << page.ch);
                }
            }

            //keyonoff
            if (keyOnStatus != keyOnStatusOld)
            {
                OutK051649Port(lstPartWork[lstPartWork.Count - 1].cpg, mml, port[0], ChipNumber, 3, 0, keyOnStatus);
                keyOnStatusOld = keyOnStatus;
            }
        }
Exemple #18
0
        public override void SetLfoAtKeyOn(partPage page, MML mml)
        {
            for (int lfo = 0; lfo < 4; lfo++)
            {
                clsLfo pl = page.lfo[lfo];
                if (!pl.sw)
                {
                    continue;
                }
                if (pl.type == eLfoType.Hardware)
                {
                    continue;
                }
                int w = 0;
                if (pl.type == eLfoType.Wah)
                {
                    w = 1;
                }
                if (pl.param[w + 5] != 1)
                {
                    continue;
                }

                pl.isEnd            = false;
                pl.value            = (pl.param[w + 0] == 0) ? pl.param[w + 6] : 0;//ディレイ中は振幅補正は適用されない
                pl.waitCounter      = pl.param[w + 0];
                pl.direction        = pl.param[w + 2] < 0 ? -1 : 1;
                pl.depthWaitCounter = pl.param[w + 7];
                pl.depth            = pl.param[w + 3];
                pl.depthV2          = pl.param[w + 2];

                if (pl.type == eLfoType.Vibrato)
                {
                    SetFmFNum(page, mml);
                }

                if (pl.type == eLfoType.Tremolo)
                {
                    page.beforeVolume = -1;
                    SetFmVolume(page, mml);
                }

                if (pl.type == eLfoType.Wah)
                {
                    page.beforeVolume = -1;
                    SetFmTL(page, mml);
                }
            }
        }
Exemple #19
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type = (char)mml.args[0];
            int  n    = (int)mml.args[1];

            if (type == 'I')
            {
                msgBox.setErrMsg(msg.get("E13001"), mml.line.Lp);
                return;
            }

            if (type == 'T')
            {
                msgBox.setErrMsg(msg.get("E13002"), mml.line.Lp);
                return;
            }

            if (type == 'E')
            {
                n = SetEnvelopParamFromInstrument(page, n, mml);
                return;
            }

            n = Common.CheckRange(n, 0, 255);

            if (!parent.instPCM.ContainsKey(n))
            {
                msgBox.setErrMsg(string.Format(msg.get("E13003"), n), mml.line.Lp);
                return;
            }

            if (parent.instPCM[n].Item2.chip != enmChipType.RF5C164)
            {
                msgBox.setErrMsg(string.Format(msg.get("E13004"), n), mml.line.Lp);
                return;
            }

            page.instrument            = n;
            page.beforepcmStartAddress = -1;
            page.pcmStartAddress       = (int)parent.instPCM[n].Item2.stAdr;
            SetRf5c164SampleStartAddress(mml, page);
            SetRf5c164LoopAddress(mml, page, (int)(parent.instPCM[n].Item2.loopAdr + 2));

            //L対策も混みです
            page.envIndex   = -1;
            page.envCounter = -1;
            page.envVolume  = 0;
            SetKeyOff(page, mml);
        }
Exemple #20
0
        public override void CmdPan(partPage page, MML mml)
        {
            int n = (int)mml.args[0];

            page.pan = ((n & 1) << 1) | ((n & 2) >> 1);//LR反転
            int vch = page.ch;

            if (page.Type == enmChannelType.RHYTHM)
            {
                if (page.ch == 18)
                {
                    vch = 6;
                }
                else if (page.ch == 19)
                {
                    vch = 7;
                }
                else if (page.ch == 20)
                {
                    vch = 8;
                }
                else if (page.ch == 21)
                {
                    vch = 8;
                }
                else if (page.ch == 22)
                {
                    vch = 7;
                }
            }

            if (page.instrument != -1)
            {
                if (!page.isOp4Mode)
                {
                    byte[] inst = parent.instOPL[page.instrument].Item2;
                    SetInstAtChannelPanFbCnt(page, mml, vch, (int)page.pan, inst[26], inst[25]);
                }
                else
                {
                    byte[] inst = parent.instOPL[page.instrument].Item2;
                    SetInstAtChannelPanFbCnt(page, mml, vch, (int)page.pan, inst[51], inst[49]);
                    SetInstAtChannelPanFbCnt(page, mml, vch + 3, (int)page.pan, inst[51], inst[50]);
                }
            }


            SetDummyData(page, mml);
        }
Exemple #21
0
        public void SetFmTL(partPage page, MML mml)
        {
            int tl1  = page.tlDelta1;
            int tl2  = page.tlDelta2;
            int tl3  = page.tlDelta3;
            int tl4  = page.tlDelta4;
            int slot = 0;

            for (int lfo = 0; lfo < 4; lfo++)
            {
                if (!page.lfo[lfo].sw)
                {
                    continue;
                }
                if (page.lfo[lfo].type != eLfoType.Wah)
                {
                    continue;
                }

                if ((page.lfo[lfo].slot & 1) != 0)
                {
                    tl1 += page.lfo[lfo].value + page.lfo[lfo].param[1 + 6]; slot |= 1;
                }
                if ((page.lfo[lfo].slot & 2) != 0)
                {
                    tl2 += page.lfo[lfo].value + page.lfo[lfo].param[1 + 6]; slot |= 2;
                }
                if ((page.lfo[lfo].slot & 4) != 0)
                {
                    tl3 += page.lfo[lfo].value + page.lfo[lfo].param[1 + 6]; slot |= 4;
                }
                if ((page.lfo[lfo].slot & 8) != 0)
                {
                    tl4 += page.lfo[lfo].value + page.lfo[lfo].param[1 + 6]; slot |= 8;
                }
            }

            if (page.spg.beforeTlDelta1 != tl1 || page.spg.beforeTlDelta2 != tl2 || page.spg.beforeTlDelta3 != tl3 || page.spg.beforeTlDelta4 != tl4)
            {
                if (parent.instOPM.ContainsKey(page.instrument))
                {
                    OutFmSetTL(page, mml, tl1, tl2, tl3, tl4, slot, page.instrument);
                }
                page.spg.beforeTlDelta1 = tl1;
                page.spg.beforeTlDelta2 = tl2;
                page.spg.beforeTlDelta3 = tl3;
                page.spg.beforeTlDelta4 = tl4;
            }
        }
Exemple #22
0
        public void SetRf5c164SampleStartAddress(MML mml, partPage page)
        {
            //Address shift
            int stAdr = page.pcmStartAddress + page.addressShift;

            //if (stAdr >= pw.ppg[pw.cpgNum].pcmEndAddress) stAdr = pw.ppg[pw.cpgNum].pcmEndAddress - 1;

            if (page.beforepcmStartAddress != stAdr && stAdr >= 0)
            {
                SetRf5c164CurrentChannel(mml, page);
                byte data = (byte)(stAdr >> 8);
                OutRf5c164Port(page, mml, port[0], page.chipNumber, 0x6, data);
                //pw.ppg[pw.cpgNum].pcmStartAddress = stAdr;
            }
        }
Exemple #23
0
        public void OutSsgKeyOff(MML mml, partPage page)
        {
            page.keyOn = false;
            //byte pch = (byte)page.ch;
            //int n = 9;
            //byte data = (byte)(SSGKeyOn | n << pch);
            //SSGKeyOn = data;

            //parent.OutData(mml, port[0], (byte)(0x08 + pch), 0);
            //SOutData(page, mml, port[0], (byte)(0x08 + pch), 0);
            //page.spg.beforeVolume = -1;
            //parent.OutData(mml, port[0], 0x07, data);

            //SOutData(page, mml, port[0], 0x07, data);
        }
Exemple #24
0
 /// <summary>
 /// Ch3:波形書き換え
 /// </summary>
 private void SetWaveFormFromInstrument(partPage page, int n, MML mml)
 {
     SOutData(page, mml, port[0], NR30, 0x00);
     page.beforeFNum = -1;
     for (int i = 0; i < 16; i++)
     {
         // 0 は音色番号が入っている為1からスタート
         SOutData(page, mml, port[0], (byte)(0x20 + i)
                  , (byte)(
                      ((parent.instWF[n].Item2[i * 2 + 0 + 1] & 0xf) << 4)
                      | (parent.instWF[n].Item2[i * 2 + 1 + 1] & 0xf)
                      ));
     }
     SOutData(page, mml, port[0], NR30, 0x80);
 }
Exemple #25
0
        public override void CmdPan(partPage page, MML mml)
        {
            int n = (int)mml.args[0];

            //強制的にモノラルにする
            if (parent.info.monoPart != null &&
                parent.info.monoPart.Contains(Ch[5].Name))
            {
                n = 3;
            }

            n        = Common.CheckRange(n, 0, 3);
            page.pan = n;
            ((ClsOPN)page.chip).OutOPNSetPanAMSPMS(mml, page, n, page.ams, page.fms);
        }
Exemple #26
0
        public bool getNumNoteLength(partPage page, out int num, out bool flg)
        {
            flg = false;

            skipTabSpace(page);

            //クロック直接指定
            if (getChar(page) == '#')
            {
                flg = true;
                incPos(page);
            }

            return(getNum(page, out num));
        }
Exemple #27
0
        public override void CmdInstrument(partPage page, MML mml)
        {
            char type = (char)mml.args[0];
            int  n    = (int)mml.args[1];

            if (type == 'I')
            {
                msgBox.setErrMsg(msg.get("E16005"), mml.line.Lp);
                return;
            }

            if (type == 'T')
            {
                n = Common.CheckRange(n, 0, 255);
                page.toneDoubler = n;
                return;
            }

            if (type == 'E')
            {
                SetEnvelopParamFromInstrument(page, n, mml);
                return;
            }

            n = Common.CheckRange(n, 0, 255);
            if (page.instrument == n)
            {
                return;
            }

            page.instrument = n;
            int modeBeforeSend = parent.info.modeBeforeSend;

            if (type == 'N')
            {
                modeBeforeSend = 0;
            }
            else if (type == 'R')
            {
                modeBeforeSend = 1;
            }
            else if (type == 'A')
            {
                modeBeforeSend = 2;
            }

            OutSetInstrument(page, mml, n, page.volume, modeBeforeSend);
        }
Exemple #28
0
        public void SetADPCMAddress(MML mml, partPage page, int startAdr, int endAdr)
        {
            if (page.spg.pcmStartAddress != startAdr)
            {
                SOutData(page, mml, port[1], 0x02, (byte)((startAdr >> 2) & 0xff));
                SOutData(page, mml, port[1], 0x03, (byte)((startAdr >> 10) & 0xff));
                page.spg.pcmStartAddress = startAdr;
            }

            if (page.spg.pcmEndAddress != endAdr)
            {
                SOutData(page, mml, port[1], 0x04, (byte)(((endAdr - 0x04) >> 2) & 0xff));
                SOutData(page, mml, port[1], 0x05, (byte)(((endAdr - 0x04) >> 10) & 0xff));
                page.spg.pcmEndAddress = endAdr;
            }
        }
Exemple #29
0
        public override void CmdPan(partPage page, MML mml)
        {
            int p = (int)mml.args[0];

            p         = Common.CheckRange(p, 0, 32);
            page.panL = (32 - p);

            byte adr = (byte)(page.ch + 0x80);

            OutQSoundPort(mml, port[0], page
                          , adr
                          , (ushort)(page.panL + 0x110)
                          );

            SetDummyData(page, mml);
        }
Exemple #30
0
        public override void CmdMode(partPage page, MML mml)
        {
            int n = (int)mml.args[0];

            n = Common.CheckRange(n, 0, 1);
            if (n == 1)
            {
                page.freq     = 0;//freqをリセット
                page.spg.freq = -1;
                OutPsgFnum(page, mml);
            }

            page.pcm              = (n == 1);
            page.instrument       = -1;
            page.spg.beforeVolume = -1;
        }