コード例 #1
0
        private void Decode()
        {
            _InputBuffer = SourceFile.GetData();

            Init();

            var fileHeaderSize = ReadInt16(0x0E);

            ReadScdHeader(fileHeaderSize);

            var entryHeaders      = new ScdEntryHeader[ScdHeader.EntryCount];
            var entryChunkOffsets = new int[ScdHeader.EntryCount];
            var entryDataOffsets  = new int[ScdHeader.EntryCount];

            for (var i = 0; i < ScdHeader.EntryCount; ++i)
            {
                var headerOffset = ReadInt32(ScdHeader.EntryTableOffset + 4 * i);
                entryHeaders[i] = ReadEntryHeader(headerOffset);

                entryChunkOffsets[i] = headerOffset + System.Runtime.InteropServices.Marshal.SizeOf <ScdEntryHeader>();
                entryDataOffsets[i]  = entryChunkOffsets[i];
                for (var j = 0; j < entryHeaders[i].AuxChunkCount; ++j)
                {
                    entryDataOffsets[i] += ReadInt32(entryDataOffsets[i] + 4);
                }
            }

            this.Entries = new ScdEntry[ScdHeader.EntryCount];
            for (var i = 0; i < ScdHeader.EntryCount; ++i)
            {
                this.Entries[i] = CreateEntry(entryHeaders[i], entryChunkOffsets[i], entryDataOffsets[i]);
            }

            _InputBuffer = null;
        }
コード例 #2
0
        private ScdEntryHeader ReadEntryHeader(int offset)
        {
            var h = new ScdEntryHeader();

            h.DataSize        = ReadInt32(offset + 0x00);
            h.ChannelCount    = ReadInt32(offset + 0x04);
            h.Frequency       = ReadInt32(offset + 0x08);
            h.Codec           = (ScdCodec)ReadInt32(offset + 0x0C);
            h.LoopStartSample = ReadInt32(offset + 0x10);
            h.LoopEndSample   = ReadInt32(offset + 0x14);
            h.SamplesOffset   = ReadInt32(offset + 0x18);
            h.AuxChunkCount   = ReadInt16(offset + 0x1C);
            h.Unknown1        = ReadInt16(offset + 0x1E);

            return(h);
        }
コード例 #3
0
        private ScdEntry CreateEntry(ScdEntryHeader header, int chunksOffset, int dataOffset)
        {
            if (header.DataSize == 0 || header.Codec == ScdCodec.None)
            {
                return(null);
            }

            switch (header.Codec)
            {
            case ScdCodec.OGG:
                return(new ScdOggEntry(this, header, dataOffset));

            case ScdCodec.MSADPCM:
                return(new ScdAdpcmEntry(this, header, chunksOffset, dataOffset));

            default:
                throw new NotSupportedException();
            }
        }
コード例 #4
0
 internal ScdAdpcmEntry(ScdFile file, ScdEntryHeader header, int chunksOffset, int dataOffset)
     : base(file, header)
 {
     Decode(chunksOffset, dataOffset);
 }
コード例 #5
0
ファイル: ScdEntry.cs プロジェクト: alphaONE2/saint-coinach
 protected ScdEntry(ScdFile file, ScdEntryHeader header)
 {
     this.File   = file;
     this.Header = header;
 }
コード例 #6
0
 internal ScdOggEntry(ScdFile file, ScdEntryHeader header, int dataOffset)
     : base(file, header)
 {
     Decode(dataOffset);
 }
コード例 #7
0
ファイル: ScdEntry.cs プロジェクト: mclark4386/SaintCoinach
 protected ScdEntry(ScdFile file, ScdEntryHeader header) {
     this.File = file;
     this.Header = header;
 }
コード例 #8
0
        private ScdEntryHeader ReadEntryHeader(int offset)
        {
            var h = new ScdEntryHeader();

            h.DataSize = ReadInt32(offset + 0x00);
            h.ChannelCount = ReadInt32(offset + 0x04);
            h.Frequency = ReadInt32(offset + 0x08);
            h.Codec = (ScdCodec)ReadInt32(offset + 0x0C);
            h.LoopStartSample = ReadInt32(offset + 0x10);
            h.LoopEndSample = ReadInt32(offset + 0x14);
            h.SamplesOffset = ReadInt32(offset + 0x18);
            h.AuxChunkCount = ReadInt16(offset + 0x1C);
            h.Unknown1 = ReadInt16(offset + 0x1E);

            return h;
        }
コード例 #9
0
        private void Decode()
        {
            _InputBuffer = SourceFile.GetData();

            Init();

            var fileHeaderSize = ReadInt16(0x0E);

            ReadScdHeader(fileHeaderSize);

            var entryHeaders = new ScdEntryHeader[ScdHeader.EntryCount];
            var entryChunkOffsets = new int[ScdHeader.EntryCount];
            var entryDataOffsets = new int[ScdHeader.EntryCount];
            for (var i = 0; i < ScdHeader.EntryCount; ++i) {
                var headerOffset = ReadInt32(ScdHeader.EntryTableOffset + 4 * i);
                entryHeaders[i] = ReadEntryHeader(headerOffset);

                entryChunkOffsets[i] = headerOffset + System.Runtime.InteropServices.Marshal.SizeOf<ScdEntryHeader>();
                entryDataOffsets[i] = entryChunkOffsets[i];
                for (var j = 0; j < entryHeaders[i].AuxChunkCount; ++j)
                    entryDataOffsets[i] += ReadInt32(entryDataOffsets[i] + 4);
            }

            this.Entries = new ScdEntry[ScdHeader.EntryCount];
            for (var i = 0; i < ScdHeader.EntryCount; ++i)
                this.Entries[i] = CreateEntry(entryHeaders[i], entryChunkOffsets[i], entryDataOffsets[i]);

            _InputBuffer = null;
        }
コード例 #10
0
        private ScdEntry CreateEntry(ScdEntryHeader header, int chunksOffset, int dataOffset)
        {
            if (header.DataSize == 0 || header.Codec == ScdCodec.None)
                return null;

            switch (header.Codec) {
                case ScdCodec.OGG:
                    return new ScdOggEntry(this, header, dataOffset);
                case ScdCodec.MSADPCM:
                    return new ScdAdpcmEntry(this, header, chunksOffset, dataOffset);
                default:
                    throw new NotSupportedException();
            }
        }
コード例 #11
0
 internal ScdOggEntry(ScdFile file, ScdEntryHeader header, int dataOffset)
     : base(file, header)
 {
     Decode(dataOffset);
 }