A reference to an audio file.
Example #1
0
        /// <summary>
        /// Initializes the audio manager.
        /// </summary>
        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 DBPFFile(ContentManager.GetPath("TSOAudio.dat"));
            tsov2 = new DBPFFile(ContentManager.GetPath("tsov2.dat"));
            Stings = new DBPFFile(ContentManager.GetPath("Stings.dat"));
            EP5Samps = new DBPFFile(ContentManager.GetPath("EP5Samps.dat"));
            EP2 = new DBPFFile(ContentManager.GetPath("EP2.dat"));
            Hitlists = new DBPFFile(ContentManager.GetPath("HitListsTemp.dat"));

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

            AddTracksFrom(TSOAudio);
        }