예제 #1
0
파일: xgm.cs 프로젝트: hiroshica/MDPlayer
        private bool getXGMInfo(byte[] vgmBuf)
        {
            if (vgmBuf == null)
            {
                return(false);
            }

            try
            {
                if (common.getLE32(vgmBuf, 0) != FCC_XGM)
                {
                    return(false);
                }

                for (uint i = 0; i < 63; i++)
                {
                    sampleID[i]      = new XGMSampleID();
                    sampleID[i].addr = (common.getLE16(vgmBuf, i * 4 + 4) * 256);
                    sampleID[i].size = (common.getLE16(vgmBuf, i * 4 + 6) * 256);
                }

                sampleDataBlockSize = common.getLE16(vgmBuf, 0x100);

                versionInformation = vgmBuf[0x102];

                dataInformation = vgmBuf[0x103];

                isNTSC = (dataInformation & 0x1) == 0;

                existGD3 = (dataInformation & 0x2) != 0;

                multiTrackFile = (dataInformation & 0x4) != 0;

                sampleDataBlockAddr = 0x104;

                musicDataBlockSize = common.getLE32(vgmBuf, sampleDataBlockAddr + sampleDataBlockSize * 256);

                musicDataBlockAddr = sampleDataBlockAddr + sampleDataBlockSize * 256 + 4;

                gd3InfoStartAddr = musicDataBlockAddr + musicDataBlockSize;

                GD3 = getGD3Info(vgmBuf);

                if (musicDataBlockSize == 0)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                log.Write(string.Format("XGMの情報取得中に例外発生 Message=[{0}] StackTrace=[{1}]", e.Message, e.StackTrace));
                return(false);
            }

            return(true);
        }
예제 #2
0
        public void Stop(byte ChipID)
        {
            pcmExecDelta[ChipID] = 0.0;
            DACEnable[ChipID]    = 0;
            ox2b = false;

            for (int i = 0; i < 4; i++)
            {
                if (xgmpcm[ChipID][i] == null)
                {
                    xgmpcm[ChipID][i] = new XGMPCM();
                }
                xgmpcm[ChipID][i].isPlaying = false;
            }
            for (int i = 0; i < 63; i++)
            {
                sampleID[ChipID][i] = new XGMSampleID();
            }
        }