Exemplo n.º 1
0
 public ClsChip(ClsVgm parent, int chipID, string initialPartName, string stPath)
 {
     this.parent  = parent;
     this._ChipID = chipID;
     this.stPath  = stPath;
     MakeFNumTbl();
 }
Exemplo n.º 2
0
        public C140(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.C140;
            _Name      = "C140";
            _ShortName = "C140";
            _ChMax     = 24;
            _canUsePcm = true;
            _canUsePI  = true;
            ChipNumber = chipNumber;

            Frequency = 8000000;
            port      = new byte[][] { new byte[] { 0xd4 } };
            Interface = 0x0;//System2

            dataType = 0x8d;

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.PCM;
                ch.chipNumber = chipID == 1;
                ch.MaxVolume  = 255;
            }

            pcmDataInfo = new clsPcmDataInfo[] { new clsPcmDataInfo() };
            pcmDataInfo[0].totalBufPtr = 0L;
            pcmDataInfo[0].use         = false;
            if (parent.info.format == enmFormat.ZGM)
            {
                if (parent.ChipCommandSize == 2)
                {
                    pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x00, 0x66, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
                }
                ;
                else
                {
                    pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x66, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
                };
            }
            else
            {
                pcmDataInfo[0].totalBuf = new byte[] { 0x67, 0x66, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
            };

            pcmDataInfo[0].totalHeaderLength       = pcmDataInfo[0].totalBuf.Length;
            pcmDataInfo[0].totalHeadrSizeOfDataPtr = (parent.ChipCommandSize == 2) ? 4 : 3;

            Envelope     = new Function();
            Envelope.Max = 255;
            Envelope.Min = 0;

            makePcmTbl();
            memoryMap = new List <long>();
        }
Exemplo n.º 3
0
        public YM2151(ClsVgm parent, int chipID, string initialPartName, string stPath, bool isSecondary) : base(parent, chipID, initialPartName, stPath, isSecondary)
        {
            _Name      = "YM2151";
            _ShortName = "OPM";
            _ChMax     = 8;
            _canUsePcm = false;

            Frequency = 3579545;
            port      = new byte[] { (byte)(IsSecondary ? 0xa4 : 0x54) };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            MakeFNumTbl();

            //Ch = new ClsChannel[ChMax];
            //SetPartToCh(Ch, initialPartName);
            Ch = new ClsChannel[ChMax];
            char[] PART_OPM = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
            for (int i = 0; i < Ch.Length; i++)
            {
                if (Ch[i] == null)
                {
                    Ch[i] = new ClsChannel();
                }
                Ch[i].Name        = PART_OPM[i].ToString();
                Ch[i].Type        = enmChannelType.FMOPM;
                Ch[i].isSecondary = IsSecondary;
            }
        }
Exemplo n.º 4
0
        private void SetInspectedClockCounter(ClsVgm desVGM, Dictionary <KeyValuePair <enmChipType, int>, long> dicInspectedClockCounter)
        {
            foreach (KeyValuePair <enmChipType, ClsChip[]> kvp in desVGM.chips)
            {
                foreach (ClsChip chip in kvp.Value)
                {
                    if (!chip.use)
                    {
                        continue;
                    }

                    foreach (partWork pw in chip.lstPartWork)
                    {
                        if (pw.pData == null)
                        {
                            continue;
                        }

                        KeyValuePair <enmChipType, int> k = new KeyValuePair <enmChipType, int>(kvp.Key, pw.ch);
                        if (dicInspectedClockCounter.ContainsKey(k))
                        {
                            pw.inspectedClockCounter = dicInspectedClockCounter[k];
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void SetLoopInfo(ClsVgm desVGM, Dictionary <KeyValuePair <enmChipType, int>, clsLoopInfo> dicLoopInfo)
        {
            foreach (KeyValuePair <enmChipType, ClsChip[]> kvp in desVGM.chips)
            {
                foreach (ClsChip chip in kvp.Value)
                {
                    if (!chip.use)
                    {
                        continue;
                    }

                    foreach (partWork pw in chip.lstPartWork)
                    {
                        if (pw.pData == null)
                        {
                            continue;
                        }

                        KeyValuePair <enmChipType, int> k = new KeyValuePair <enmChipType, int>(kvp.Key, pw.ch);
                        if (dicLoopInfo.ContainsKey(k))
                        {
                            pw.loopInfo = dicLoopInfo[k];
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public MidiGM(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.MIDI_GM;
            _Name      = "GeneralMIDI";
            _ShortName = "GM";
            _ChMax     = 99;
            _canUsePcm = false;
            _canUsePI  = false;
            ChipNumber = chipNumber;

            Frequency = 0;
            port      = new byte[][] { new byte[] { 0x00 } };
            dataType  = 0;

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.MIDI;
                ch.chipNumber = chipID == 1;
                ch.MaxVolume  = 127;
            }

            pcmDataInfo = null;
        }
Exemplo n.º 7
0
        public Conductor(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.CONDUCTOR;
            _Name      = "CONDUCTOR";
            _ShortName = "CON";
            _ChMax     = 2;
            _canUsePcm = false;
            _canUsePI  = false;
            ChipNumber = chipNumber;

            Frequency = 44100;
            port      = new byte[][] {
                new byte[] { 0x00 }
            };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.SSG;
                ch.chipNumber = chipID == 1;
                ch.MaxVolume  = 15;
            }
        }
Exemplo n.º 8
0
        public SN76489(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "SN76489";
            _ShortName = "DCSG";
            _ChMax     = 4;
            _canUsePcm = false;
            FNumTbl    = _FNumTbl;

            Frequency = 3579545;

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.DCSG;
                ch.isSecondary = chipID == 1;
            }
            Ch[3].Type = enmChannelType.DCSGNOISE;
        }
Exemplo n.º 9
0
        public YM2612(ClsVgm parent, int chipID, string initialPartName, string stPath, bool isSecondary) : base(parent, chipID, initialPartName, stPath, isSecondary)
        {
            _chipType   = enmChipType.YM2612;
            _Name       = "YM2612";
            _ShortName  = "OPN2";
            _ChMax      = 10;
            _canUsePcm  = true;
            _canUsePI   = false;
            FNumTbl     = _FNumTbl;
            IsSecondary = isSecondary;

            Frequency = 7670454;

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            Ch = new ClsChannel[ChMax];
            char[] PART_OPN2 = new char[] { 'A', 'B', 'C', 'H', 'I', 'J', 'K', 'L', 'M', 'N' };
            for (int i = 0; i < Ch.Length; i++)
            {
                if (Ch[i] == null)
                {
                    Ch[i] = new ClsChannel();
                }
                Ch[i].Name = PART_OPN2[i].ToString();
            }

            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.FMOPN;
                ch.isSecondary = chipID == 1;
            }

            Ch[2].Type = enmChannelType.FMOPNex;
            Ch[6].Type = enmChannelType.FMPCM;
            Ch[7].Type = enmChannelType.FMOPNex;
            Ch[8].Type = enmChannelType.FMOPNex;
            Ch[9].Type = enmChannelType.FMOPNex;

            pcmDataInfo             = new clsPcmDataInfo[] { new clsPcmDataInfo() };
            pcmDataInfo[0].totalBuf = new byte[7] {
                0x67, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00
            };
            pcmDataInfo[0].totalBufPtr = 0L;
            pcmDataInfo[0].use         = false;
        }
Exemplo n.º 10
0
        public AY8910(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.AY8910;
            _Name      = "AY8910";
            _ShortName = "AY10";
            _ChMax     = 3;
            _canUsePcm = false;
            _canUsePI  = false;
            ChipNumber = chipNumber;

            Frequency = 1789750;
            port      = new byte[][] { new byte[] { 0xa0 } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl = new int[1][] { new int[96] };
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                if (dic.ContainsKey("MASTERCLOCK"))
                {
                    Frequency = (int)dic["MASTERCLOCK"][0];
                }
                if (dic.ContainsKey("CHIPTYPE"))
                {
                    ChipType = (byte)(int)dic["CHIPTYPE"][0];
                }
                if (dic.ContainsKey("FLAGS"))
                {
                    Flags = (byte)(int)dic["FLAGS"][0];
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.SSG;
                ch.chipNumber = chipID == 1;
                ch.MaxVolume  = 15;
            }

            Envelope     = new Function();
            Envelope.Max = 15;
            Envelope.Min = 0;
        }
Exemplo n.º 11
0
 public ClsChip(ClsVgm parent, int chipID, string initialPartName, string stPath, bool isSecondary)
 {
     this.parent      = parent;
     this._ChipID     = chipID;
     this.stPath      = stPath;
     this.IsSecondary = IsSecondary;
     MakeFNumTbl();
 }
Exemplo n.º 12
0
        public VRC6(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.VRC6;
            _Name      = "VRC6";
            _ShortName = "VRC6";
            _ChMax     = 3;//SQR:2ch SAW:1ch
            _canUsePcm = true;
            _canUsePI  = true;

            Frequency = 1789772;//NTSC (PAL=1662607)
            port      = new byte[][] {
                new byte[] { 0x00 }
            };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            Ch[0].Type = enmChannelType.Square;
            Ch[1].Type = enmChannelType.Square;
            Ch[2].Type = enmChannelType.Saw;

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl = new int[1][] { new int[96] };
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }

                if (dic.ContainsKey("MASTERCLOCK"))
                {
                    Frequency = (int)dic["MASTERCLOCK"][0];
                }

                c           = 0;
                Saw_FNumTbl = new int[1][] { new int[96] };
                foreach (double v in dic["SAW_FNUM_00"])
                {
                    Saw_FNumTbl[0][c++] = (int)v;
                    if (c == Saw_FNumTbl[0].Length)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 13
0
        public YM2203(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "YM2203";
            _ShortName = "OPN";
            _ChMax     = 9;
            _canUsePcm = false;
            FNumTbl    = _FNumTbl;

            Frequency = 3993600;// 7987200/2;

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;

                c = 0;
                foreach (double v in dic["FNUM_01"])
                {
                    FNumTbl[1][c++] = (int)v;
                    if (c == FNumTbl[1].Length)
                    {
                        break;
                    }
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.FMOPN;
                ch.isSecondary = chipID == 1;
            }

            Ch[2].Type = enmChannelType.FMOPNex;
            Ch[3].Type = enmChannelType.FMOPNex;
            Ch[4].Type = enmChannelType.FMOPNex;
            Ch[5].Type = enmChannelType.FMOPNex;

            Ch[6].Type = enmChannelType.SSG;
            Ch[7].Type = enmChannelType.SSG;
            Ch[8].Type = enmChannelType.SSG;
        }
Exemplo n.º 14
0
        public YM3526(ClsVgm parent, int chipID, string initialPartName, string stPath, bool isSecondary) : base(parent, chipID, initialPartName, stPath, isSecondary)
        {
            _Name      = "YM3526";
            _ShortName = "OPL";
            _ChMax     = 9 + 5;//FM 9ch Rhythm 5ch
            _canUsePcm = false;

            Frequency = 3579545;
            port      = new byte[] {
                (byte)(isSecondary ? 0xab : 0x5b)
            };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl    = new int[1][];
                FNumTbl[0] = new int[13];
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            //Ch = new ClsChannel[ChMax];
            //SetPartToCh(Ch, initialPartName);
            Ch = new ClsChannel[ChMax];
            char[] PART_OPL = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N' };
            for (int i = 0; i < Ch.Length; i++)
            {
                if (Ch[i] == null)
                {
                    Ch[i] = new ClsChannel();
                }
                Ch[i].Name        = PART_OPL[i].ToString();
                Ch[i].Type        = enmChannelType.FMOPL;
                Ch[i].isSecondary = IsSecondary;
            }
        }
Exemplo n.º 15
0
        public YMF262(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "YMF262";
            _ShortName = "OPL3";
            _ChMax     = 18;
            // OPL2 mode = 9*2 2op
            // OPL3 mode (all 2op) = 18 2op channel
            // OPL3 Rhythm Mode = 15*4op + 3 rhythm channel
            // OPL3 4op = 1-4, 2-5, 3-6, 10-13, 11-14, 12-15,(6*4op) 6*2op
            // OPL3 All mode = (4op mode) + 7,8,9(RYM) 3 2op channel
            _canUsePcm = false;

            Frequency = 14318180;
            port      = new byte[][] { new byte[] { (byte)(chipNumber != 0 ? 0xae : 0x5e) }, new byte[] { (byte)(chipNumber != 0 ? 0xaf : 0x5f) } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl    = new int[1][];
                FNumTbl[0] = new int[13];
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            int i = 0;

            /*
             * foreach (ClsChannel ch in Ch)
             * {
             *  ch.Type = i < 18 ? enmChannelType.FMOPL : enmChannelType.RHYTHM;
             *  ch.chipNumber = chipID == 1;
             *  i++;
             * }*/
        }
Exemplo n.º 16
0
        public SN76489(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "SN76489";
            _ShortName = "DCSG";
            _ChMax     = 4;
            _canUsePcm = false;
            _canUsePI  = false;
            FNumTbl    = _FNumTbl;
            port       = new byte[][] {
                new byte[] { (byte)(chipNumber != 0 ? 0x30 : 0x50) }
                , new byte[] { (byte)(chipNumber != 0 ? 0x3f : 0x4f) }
            };

            Frequency       = 3579545;
            this.ChipNumber = chipNumber;

            Envelope     = new Function();
            Envelope.Max = 15;
            Envelope.Min = 0;

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.DCSG;
                ch.chipNumber = chipID == 1;
            }
            Ch[3].Type = enmChannelType.DCSGNOISE;
        }
Exemplo n.º 17
0
        public RF5C164(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "RF5C164";
            _ShortName = "RF5C";
            _ChMax     = 8;
            _canUsePcm = true;

            Frequency = 12500000;
            Ch        = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.PCM;
                ch.isSecondary = chipID == 1;
            }
        }
Exemplo n.º 18
0
        public outDatum[] Build(ClsVgm mmlInfo)
        {
            this.mmlInfo = mmlInfo;
            mmlInfo.dat  = new List <outDatum>();
            define       = new List <DefineInfo>();
            track        = new List <TrackInfo>();

            makeAndOutHeaderDiv();
            makeDefineDiv();
            makeTrackDiv();
            makeAndOutExtraDiv();
            makeAndOutGD3Div();
            makeFooterDiv();

            return(mmlInfo.dat.ToArray());
        }
Exemplo n.º 19
0
        public K051649(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.K051649;
            _Name      = "K051649";
            _ShortName = "SCC";
            _ChMax     = 5;
            _canUsePcm = false;
            _canUsePI  = false;
            ChipNumber = chipNumber;

            Frequency = 1789772;
            port      = new byte[][] { new byte[] { 0xd2 } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl = new int[1][] { new int[96] };
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.WaveForm;
                ch.chipNumber = chipID == 1;
                ch.MaxVolume  = 15;
            }

            Envelope     = new Function();
            Envelope.Max = 15;
            Envelope.Min = 0;
        }
Exemplo n.º 20
0
        public HuC6280(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "HuC6280";
            _ShortName = "HuC8";
            _ChMax     = 6;
            _canUsePcm = true;

            Frequency = 3579545;

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.WaveForm;
                ch.isSecondary = chipID == 1;
                ch.MaxVolume   = 15;
            }
        }
Exemplo n.º 21
0
        public YM2413(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "YM2413";
            _ShortName = "OPLL";
            _ChMax     = 14; // FM 9ch + Rhythm 5ch
            _canUsePcm = false;

            Frequency = 3579545;

            MakeFNumTbl();
            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.FMOPL;
                ch.isSecondary = chipID == 1;
            }
        }
Exemplo n.º 22
0
        public YM2413(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "YM2413";
            _ShortName = "OPLL";
            _ChMax     = 14; // FM 9ch + Rhythm 5ch
            _canUsePcm = false;

            Frequency = 3579545;
            port      = new byte[][] { new byte[] { (byte)(chipNumber != 0 ? 0xa1 : 0x51) } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl    = new int[1][];
                FNumTbl[0] = new int[13];
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            int i = 0;

            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = i < 9 ? enmChannelType.FMOPL : enmChannelType.RHYTHM;
                ch.chipNumber = chipID == 1;
                i++;
            }
        }
Exemplo n.º 23
0
        public YM2612X(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "YM2612X";
            _ShortName = "OPN2X";
            _ChMax     = 12;
            _canUsePcm = true;
            FNumTbl    = _FNumTbl;

            Frequency = 7670454;

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.FMOPN;
                ch.isSecondary = chipID == 1;
            }

            Ch[2].Type  = enmChannelType.FMOPNex;
            Ch[5].Type  = enmChannelType.FMPCMex;
            Ch[6].Type  = enmChannelType.FMOPNex;
            Ch[7].Type  = enmChannelType.FMOPNex;
            Ch[8].Type  = enmChannelType.FMOPNex;
            Ch[9].Type  = enmChannelType.FMPCMex;
            Ch[10].Type = enmChannelType.FMPCMex;
            Ch[11].Type = enmChannelType.FMPCMex;
        }
Exemplo n.º 24
0
        public segaPcm(ClsVgm parent, int chipID, string initialPartName, string stPath) : base(parent, chipID, initialPartName, stPath)
        {
            _Name      = "SEGAPCM";
            _ShortName = "SPCM";
            _ChMax     = 16;
            _canUsePcm = true;

            Frequency = 4026987;
            Interface = 0x00f8000d;

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.PCM;
                ch.isSecondary = chipID == 1;
                ch.MaxVolume   = 127;
            }
        }
Exemplo n.º 25
0
        public Gigatron(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.Gigatron;
            _Name      = "Gigatron";
            _ShortName = "Gigatron";
            _ChMax     = 4;//WAV:4ch
            _canUsePcm = false;
            _canUsePI  = false;

            Frequency = (int)(521.0 * 59.98);//vsync(NTSC):59.98Hz scanline:521line
            port      = new byte[][] {
                new byte[] { 0x00 }
            };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel c in Ch)
            {
                c.Type = enmChannelType.WaveForm;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl = new int[1][] { new int[96] };
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 26
0
        public Conductor(ClsVgm parent, int chipID, string initialPartName, string stPath, bool isSecondary) : base(parent, chipID, initialPartName, stPath, isSecondary)
        {
            _chipType   = enmChipType.CONDUCTOR;
            _Name       = "CONDUCTOR";
            _ShortName  = "CON";
            _ChMax      = 2;
            _canUsePcm  = false;
            _canUsePI   = false;
            IsSecondary = isSecondary;

            Frequency = 44100;

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type        = enmChannelType.SSG;
                ch.isSecondary = chipID == 1;
                ch.MaxVolume   = 15;
            }
        }
Exemplo n.º 27
0
        public YMF271(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "YMF271";
            _ShortName = "OPX";
            _ChMax     = 48;
            _canUsePcm = true;

            Frequency = 16934400;
            port      = new byte[][] { new byte[] { 0xd1 } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl    = new int[1][];
                FNumTbl[0] = new int[13];
                if (dic.Count != 0)
                {
                    foreach (double v in dic["FNUM_00"])
                    {
                        FNumTbl[0][c++] = (int)v;
                        if (c == FNumTbl[0].Length)
                        {
                            break;
                        }
                    }
                    FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
        }
Exemplo n.º 28
0
        public YM3526(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "YM3526";
            _ShortName = "OPL";
            _ChMax     = 9 + 5;//FM 9ch Rhythm 5ch
            _canUsePcm = false;

            Frequency = 3579545;
            port      = new byte[][] {
                new byte[] { (byte)(chipNumber != 0 ? 0xab : 0x5b) }
            };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                FNumTbl    = new int[1][];
                FNumTbl[0] = new int[13];
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
        }
Exemplo n.º 29
0
        public YM2151(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _Name      = "YM2151";
            _ShortName = "OPM";
            _ChMax     = 8;
            _canUsePcm = false;

            Frequency = 3579545;
            port      = new byte[][] { new byte[] { (byte)(chipNumber != 0 ? 0xa4 : 0x54) } };

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            MakeFNumTbl();
            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.FMOPM;
                ch.chipNumber = chipID == 1;
            }
        }
Exemplo n.º 30
0
        public YM2608(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.YM2608;
            _Name      = "YM2608";
            _ShortName = "OPNA";
            _ChMax     = 19;
            _canUsePcm = true;
            _canUsePI  = true;
            FNumTbl    = _FNumTbl;
            ChipNumber = chipNumber;
            dataType   = 0x81;
            Frequency  = 7987200;
            port       = new byte[][] {
                new byte[] { (byte)(chipNumber != 0 ? 0xa6 : 0x56) }
                , new byte[] { (byte)(chipNumber != 0 ? 0xa7 : 0x57) }
            };
            DataBankID = 0x0d;//TBD(固定値ではなく、恐らくデータごとに連番を振るのが良いと思われる。)

            if (string.IsNullOrEmpty(initialPartName))
            {
                return;
            }

            Dictionary <string, List <double> > dic = MakeFNumTbl();

            if (dic != null)
            {
                int c = 0;
                foreach (double v in dic["FNUM_00"])
                {
                    FNumTbl[0][c++] = (int)v;
                    if (c == FNumTbl[0].Length)
                    {
                        break;
                    }
                }
                FNumTbl[0][FNumTbl[0].Length - 1] = FNumTbl[0][0] * 2;

                c = 0;
                foreach (double v in dic["FNUM_01"])
                {
                    FNumTbl[1][c++] = (int)v;
                    if (c == FNumTbl[1].Length)
                    {
                        break;
                    }
                }

                c         = 0;
                hsFnumTbl = new int[72];
                foreach (double v in dic["HSFNUM_00"])
                {
                    hsFnumTbl[c++] = (int)v;
                    if (c == hsFnumTbl.Length)
                    {
                        break;
                    }
                }
            }

            Ch = new ClsChannel[ChMax];
            SetPartToCh(Ch, initialPartName);
            foreach (ClsChannel ch in Ch)
            {
                ch.Type       = enmChannelType.FMOPN;
                ch.chipNumber = chipID == 1;
            }

            Ch[2].Type = enmChannelType.FMOPNex;
            Ch[6].Type = enmChannelType.FMOPNex;
            Ch[7].Type = enmChannelType.FMOPNex;
            Ch[8].Type = enmChannelType.FMOPNex;

            Ch[9].Type  = enmChannelType.SSG;
            Ch[10].Type = enmChannelType.SSG;
            Ch[11].Type = enmChannelType.SSG;

            Ch[12].Type = enmChannelType.RHYTHM;
            Ch[13].Type = enmChannelType.RHYTHM;
            Ch[14].Type = enmChannelType.RHYTHM;
            Ch[15].Type = enmChannelType.RHYTHM;
            Ch[16].Type = enmChannelType.RHYTHM;
            Ch[17].Type = enmChannelType.RHYTHM;

            Ch[18].Type = enmChannelType.ADPCM;

            pcmDataInfo = new clsPcmDataInfo[] { new clsPcmDataInfo(), new clsPcmDataInfo() };
            pcmDataInfo[0].totalBufPtr = 0L;
            pcmDataInfo[0].use         = false;
            pcmDataInfo[1].totalBufPtr = 0L;
            pcmDataInfo[1].use         = false;
            if (parent.info.format == enmFormat.ZGM)
            {
                if (parent.ChipCommandSize == 2)
                {
                    if (chipNumber == 0)
                    {
                        pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x00, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        pcmDataInfo[1].totalBuf = new byte[] { 0x07, 0x00, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                    }
                    else
                    {
                        pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x00, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        pcmDataInfo[1].totalBuf = new byte[] { 0x07, 0x00, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                    }
                }
                else
                {
                    if (chipNumber == 0)
                    {
                        pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        pcmDataInfo[1].totalBuf = new byte[] { 0x07, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                    }
                    else
                    {
                        pcmDataInfo[0].totalBuf = new byte[] { 0x07, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        pcmDataInfo[1].totalBuf = new byte[] { 0x07, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                    }
                }
            }
            else
            {
                if (chipNumber == 0)
                {
                    pcmDataInfo[0].totalBuf = new byte[] { 0x67, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                    pcmDataInfo[1].totalBuf = new byte[] { 0x67, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                }
                else
                {
                    pcmDataInfo[0].totalBuf = new byte[] { 0x67, 0x66, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                    pcmDataInfo[1].totalBuf = new byte[] { 0x67, 0x66, DataBankID, 0x00, 0x00, 0x00, 0x00 };
                }
            }

            pcmDataInfo[0].totalHeaderLength       = pcmDataInfo[0].totalBuf.Length;
            pcmDataInfo[0].totalHeadrSizeOfDataPtr = (parent.ChipCommandSize == 2) ? 4 : 3;
            pcmDataInfo[1].totalHeaderLength       = pcmDataInfo[1].totalBuf.Length;
            pcmDataInfo[1].totalHeadrSizeOfDataPtr = (parent.ChipCommandSize == 2) ? 4 : 3;

            Envelope     = new Function();
            Envelope.Max = 255;
            Envelope.Min = 0;
        }