コード例 #1
0
ファイル: K053260.cs プロジェクト: pedipanol/mml2vgm
        public K053260(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.K053260;
            _Name      = "K053260";
            _ShortName = "K53";
            _ChMax     = 4;
            _canUsePcm = true;
            _canUsePI  = false;
            ChipNumber = chipNumber;

            Frequency = 3_579_545;
            port      = new byte[][] { new byte[] { 0xba } };

            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  = 127;
            }

            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, 0x8e
                        , 0x00, 0x00, 0x00, 0x00 //size of data
                        , 0x00, 0x00, 0x00, 0x00 //size of the entire ROM
                        , 0x00, 0x00, 0x00, 0x00 //start address of data
                    };
                }
                else
                {
                    pcmDataInfo[0].totalBuf = new byte[] {
                        0x07, 0x66, 0x8e
                        , 0x00, 0x00, 0x00, 0x00 //size of data
                        , 0x00, 0x00, 0x00, 0x00 //size of the entire ROM
                        , 0x00, 0x00, 0x00, 0x00 //start address of data
                    };
                }
            }
            else
            {
                pcmDataInfo[0].totalBuf = new byte[] {
                    0x67, 0x66, 0x8e
                    , 0x00, 0x00, 0x00, 0x00 //size of data
                    , 0x00, 0x00, 0x00, 0x00 //size of the entire ROM
                    , 0x00, 0x00, 0x00, 0x00 //start address of data
                };
            }

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

            memoryMap = new List <long>();
        }
コード例 #2
0
ファイル: YM2612.cs プロジェクト: pedipanol/mml2vgm
        public YM2612(ClsVgm parent, int chipID, string initialPartName, string stPath, int chipNumber) : base(parent, chipID, initialPartName, stPath, chipNumber)
        {
            _chipType  = enmChipType.YM2612;
            _Name      = "YM2612";
            _ShortName = "OPN2";
            _ChMax     = 9;
            _canUsePcm = true;
            _canUsePI  = false;
            FNumTbl    = _FNumTbl;
            ChipNumber = chipNumber;

            Frequency = 7670454;
            port      = new byte[][] {
                new byte[] { (byte)(0x2 | (chipNumber != 0 ? 0xa0 : 0x50)) }
                , new byte[] { (byte)(0x3 | (chipNumber != 0 ? 0xa0 : 0x50)) }
            };

            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;
            }

            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[5].Type = enmChannelType.FMPCM;
            Ch[6].Type = enmChannelType.FMOPNex;
            Ch[7].Type = enmChannelType.FMOPNex;
            Ch[8].Type = enmChannelType.FMOPNex;

            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,            // data block
                        0x00, 0x00,            // Chip Command Number
                        0x00,                  // data type
                        0x00, 0x00, 0x00, 0x00 // size of data
                    };
                }
                else
                {
                    pcmDataInfo[0].totalBuf = new byte[] {
                        0x07,                  // data block
                        0x00,                  // Chip Command Number
                        0x00,                  // data type
                        0x00, 0x00, 0x00, 0x00 // size of data
                    };
                }
            }
            else
            {
                pcmDataInfo[0].totalBuf = new byte[] { 0x67, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00 };
            }

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