コード例 #1
0
ファイル: M15Loader.cs プロジェクト: VRDate/sharpmod
        public bool Test()
        {
            int t;
            M15_MODULEHEADER mh = new M15_MODULEHEADER();

            if (!LoadModuleHeader(mh))
            {
                return(false);
            }

            for (t = 0; t < 15; t++)
            {
                // all finetunes should be zero
                if (mh.samples[t].finetune != 0)
                {
                    return(false);
                }

                // all volumes should be <=64
                if (mh.samples[t].volume > 64)
                {
                    return(false);
                }
            }
            if (mh.magic1 > 127)
            {
                return(false);
            }
            // and magic1 should be <128

            return(true);
        }
コード例 #2
0
ファイル: M15Loader.cs プロジェクト: VRDate/sharpmod
        private bool LoadModuleHeader(M15_MODULEHEADER mh)
        {
            try
            {
                int t;

                mh.songname = Reader.ReadString(20);

                for (t = 0; t < 15; t++)
                {
                    mh.samples[t].samplename = Reader.ReadString(22);
                    mh.samples[t].length     = Reader.ReadMotorolaUWord();
                    mh.samples[t].finetune   = Reader.ReadUByte();
                    mh.samples[t].volume     = Reader.ReadUByte();
                    mh.samples[t].reppos     = Reader.ReadMotorolaUWord();
                    mh.samples[t].replen     = Reader.ReadMotorolaUWord();
                }

                mh.songlength = Reader.ReadUByte();
                mh.magic1     = Reader.ReadUByte();
                Reader.ReadSBytes(mh.positions, 128);

                return(!Reader.isEOF());
            }
            catch (System.IO.IOException)
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: M15Loader.cs プロジェクト: VRDate/sharpmod
        public bool Init(SharpMod.Song.SongModule module)
        {
            this._module = module;
            int i;

            patbuf = null;

            mh = new M15_MODULEHEADER();

            mh.songlength = (short)(mh.magic1 = 0);

            for (i = 0; i < 128; i++)
            {
                mh.positions[i] = 0;
            }

            for (i = 0; i < 15; i++)
            {
                mh.samples[i].length   = mh.samples[i].reppos = mh.samples[i].replen = 0;
                mh.samples[i].finetune = (short)(mh.samples[i].volume = (short)0);
            }

            return(true);
        }