public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader)
        {
            _priority = reader.ReadInt32();

            int    volume            = reader.ReadInt32();
            double attenuation_in_db = volume / 100.0f;

            GSGE.Debug.assert(attenuation_in_db <= 0);
            gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            GSGE.Debug.assert(gain <= 1.0f);

            _pitch = (float)(reader.ReadInt32() / 100.0f);

            int trackCount = reader.ReadInt32();

            _tracks = new TrackHelper[trackCount];
            for (int i = 0; i < trackCount; i++)
            {
                _tracks[i] = new TrackHelper(reader);
            }

            int strLen = reader.ReadInt16();

            byte[] bytes   = reader.ReadBytes((int)strLen);
            string catname = Encoding.ASCII.GetString(bytes);

            category = audioengine.GetCategory(catname);

            int rpcCount = reader.ReadInt32();

            rpcs = new RPCCurve[rpcCount];
            for (int i = 0; i < rpcCount; i++)
            {
                strLen = reader.ReadInt16();
                bytes  = reader.ReadBytes((int)strLen);
                string rpc = Encoding.ASCII.GetString(bytes);

                rpcs[i] = audioengine.GetRPC(rpc);
            }

            strLen = reader.ReadInt16();
            bytes  = reader.ReadBytes((int)strLen);
            effect = Encoding.ASCII.GetString(bytes);
        }
Beispiel #2
0
        public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader)
        {
            _priority = reader.ReadInt32();

            int volume = reader.ReadInt32();
            double attenuation_in_db = volume / 100.0f;
            GSGE.Debug.assert(attenuation_in_db <= 0);
            gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            GSGE.Debug.assert(gain <= 1.0f);

            _pitch = (float)(reader.ReadInt32() / 100.0f);

            int trackCount = reader.ReadInt32();
            _tracks = new TrackHelper[trackCount];
            for (int i = 0; i < trackCount; i++)
            {
                _tracks[i] = new TrackHelper(reader);
            }

            int strLen = reader.ReadInt16();
            byte[] bytes = reader.ReadBytes((int)strLen);
            string catname = Encoding.ASCII.GetString(bytes);
            category = audioengine.GetCategory(catname);

            int rpcCount = reader.ReadInt32();
            rpcs = new RPCCurve[rpcCount];
            for (int i = 0; i < rpcCount; i++)
            {
                strLen = reader.ReadInt16();
                bytes = reader.ReadBytes((int)strLen);
                string rpc = Encoding.ASCII.GetString(bytes);

                rpcs[i] = audioengine.GetRPC(rpc);
            }

            strLen = reader.ReadInt16();
            bytes = reader.ReadBytes((int)strLen);
            effect = Encoding.ASCII.GetString(bytes);
        }