Ejemplo n.º 1
0
 public EmsacExpansion(EmsacSoundInfo info)
 {
     Version        = info.Version;
     Transformation = info.Transformation;
     ChannelCount   = info.ChannelCount;
     SubbandDegree  = info.SubbandDegree;
     LappedDegree   = info.LappedDegree;
 }
Ejemplo n.º 2
0
        void SetWaveFormat(EmsacSoundInfo info)
        {
            int pcm_bitrate = (int)(m_info.SamplesPerSec * 16 * m_info.ChannelCount);

            m_format.FormatTag             = 1;
            m_format.Channels              = (ushort)ChannelCount;
            m_format.SamplesPerSecond      = m_info.SamplesPerSec;
            m_format.BitsPerSample         = (ushort)BitsPerSample;
            m_format.BlockAlign            = (ushort)(BitsPerSample / 8 * format.Channels);
            m_format.AverageBytesPerSecond = (uint)pcm_bitrate / 8;
        }
Ejemplo n.º 3
0
        void SetSoundInfo(EmsacSoundInfo info)
        {
            m_info     = info;
            m_exp      = new EmsacExpansion(info);
            m_version  = info.Version;
            m_field_98 = info.Architecture;
            m_field_9C = 133;
            m_field_A0 = -1;
            m_field_A4 = 0;
            int subband = 2 << info.SubbandDegree;

            m_lappedSubband = subband << info.LappedDegree;
        }
Ejemplo n.º 4
0
        void ReadHeader(EriFile erif)
        {
            var section = erif.ReadSection();

            if (section.Id != "Header  " || section.Length <= 0 || section.Length > int.MaxValue)
            {
                return(null);
            }
            m_stream_pos = erif.BaseStream.Position + section.Length;
            section      = erif.ReadSection();
            if (section.Id != "FileHdr" || section.Length < 8)
            {
                return(null);
            }
            var file_hdr = new byte[section.Length];

            erif.Read(file_hdr, 0, file_hdr.Length);
            if (0 == (file_hdr[5] & 1))
            {
                return(null);
            }
            section = erif.ReadSection();
            if (section.Id != "SoundInf" || section.Length < 0x24)
            {
                return(null);
            }

            var info = new EmsacSoundInfo();

            info.Version        = erif.ReadInt32();
            info.Transformation = (CvType)erif.ReadInt32();
            info.Architecture   = (EriCode)erif.ReadInt32();
            info.ChannelCount   = erif.ReadInt32();
            info.SamplesPerSec  = erif.ReadUInt32();
            info.BlocksetCount  = erif.ReadUInt32();
            info.SubbandDegree  = erif.ReadInt32();
            info.AllSampleCount = erif.ReadInt32();
            info.LappedDegree   = erif.ReadInt32();
            SetSoundInfo(info);
            SetWaveFormat(info);

            erif.BaseStream.Position = m_stream_pos;
            var stream_size = erif.FindSection("Stream  ");

            m_stream_pos = erif.BaseStream.Position;
        }