コード例 #1
0
        public void Init()
        {
            this.Stations     = new List <AudioReference>();
            this.StationsById = new Dictionary <uint, AudioReference>();
            this.Modes        = new List <AudioReference>();

            var stationsRegEx = new Regex(@"music\\stations\\.*\.mp3");

            foreach (var file in ContentManager.AllFiles)
            {
                if (stationsRegEx.IsMatch(file))
                {
                    var reference = new AudioReference {
                        Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file)
                    };
                    Stations.Add(reference);
                    var idString = Path.GetFileNameWithoutExtension(file);
                    idString = idString.Substring(idString.LastIndexOf("_") + 1);
                    var id = Convert.ToUInt32(idString, 16);
                    reference.ID = id;
                    StationsById.Add(id, reference);
                }
            }

            var tsoAudio = new DBPF(ContentManager.GetPath("TSOAudio.dat"));
        }
コード例 #2
0
        private byte[] GetAudioFrom(uint id, DBPF dbpf)
        {
            //all game sfx has type id 0x2026960B
            var dat = dbpf.GetItemByID((ulong)0x2026960B + (((ulong)id) << 32));

            if (dat != null)
            {
                string head = new string(new char[] { (char)dat[0], (char)dat[1], (char)dat[2], (char)dat[3] });
                if (head.StartsWith("XA"))
                {
                    return(new XAFile(dat).DecompressedData);
                }
                else if (head.StartsWith("UTM0"))
                {
                    var utk = new UTKFile2(dat);
                    utk.UTKDecode();
                    return(utk.DecompressedWav);
                }
                else
                {
                    return(dat); //either wav or mp3, bass.net can explicitly read these.
                }
            }
            return(null);
        }
コード例 #3
0
        private void AddTracksFrom(DBPF dbpf)
        {
            var tracks = dbpf.GetItemsByType(0x5D73A611);

            for (var i = 0; i < tracks.Count; i++)
            {
                TracksById.Add(tracks[i].Key, new Track(tracks[i].Value));
            }
        }
コード例 #4
0
        private Hitlist GetHitlistFrom(uint id, DBPF dbpf)
        {
            var hit = dbpf.GetItemByID((ulong)0x7B1ACFCD + (((ulong)id) << 32));

            if (hit != null)
            {
                return(new Hitlist(hit));
            }

            return(null);
        }
コード例 #5
0
        public void Init()
        {
            this.Stations     = new List <AudioReference>();
            this.StationsById = new Dictionary <uint, AudioReference>();
            this.Modes        = new List <AudioReference>();

            var stationsRegEx = new Regex(@"music\\stations\\.*\.mp3");

            foreach (var file in ContentManager.AllFiles)
            {
                if (stationsRegEx.IsMatch(file))
                {
                    var reference = new AudioReference {
                        Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file)
                    };
                    Stations.Add(reference);
                    var idString = Path.GetFileNameWithoutExtension(file);
                    idString = idString.Substring(idString.LastIndexOf("_") + 1);
                    var id = Convert.ToUInt32(idString, 16);
                    reference.ID = id;
                    StationsById.Add(id, reference);
                }
            }

            TSOAudio = new DBPF(ContentManager.GetPath("TSOAudio.dat"));
            tsov2    = new DBPF(ContentManager.GetPath("tsov2.dat"));
            Stings   = new DBPF(ContentManager.GetPath("Stings.dat"));
            EP5Samps = new DBPF(ContentManager.GetPath("EP5Samps.dat"));
            EP2      = new DBPF(ContentManager.GetPath("EP2.dat"));
            Hitlists = new DBPF(ContentManager.GetPath("HitListsTemp.dat"));

            SFXCache     = new Dictionary <uint, GCHandle>();
            TracksById   = new Dictionary <uint, Track>();
            HitlistsById = new Dictionary <uint, Hitlist>();

            AddTracksFrom(TSOAudio);
        }