Exemple #1
0
        private void LoadObjects(SoundPack pack, EndianReader reader, SoundScanner scanner)
        {
            foreach (SoundPackFolder folder in pack.Folders)
            {
                foreach (SoundPackFile file in folder.Files)
                {
                    reader.SeekTo(file.Offset);
                    int magic = reader.ReadInt32();

                    switch (magic)
                    {
                    case 0x52494658:     // RIFX - Embedded sound file
                        scanner.RegisterGlobalObject(file);
                        break;

                    case 0x424B4844:     // BKHD - Sound bank
                        reader.SeekTo(file.Offset);
                        SoundBank bank = new SoundBank(reader, file.Size);
                        scanner.RegisterSoundBank(bank);
                        _soundbanks.Add(bank);
                        break;
                    }
                }
            }
        }
        public SoundEndine(SoundPack sound_pack)
        {
            Location = sound_pack.Location;

            mSounds = new System.IO.DirectoryInfo(Location)
                .EnumerateFiles()
                .Where(_ => _.Extension == ".wav")
                .Select(_ => new SoundPlayer(_.FullName))
                .ToDictionary(_ => Path.GetFileNameWithoutExtension(_.SoundLocation));

            mTimer = new Timer();

            mTimer.Tick += (_sender, _e) =>
            {
                if (mKeyboardListener == null ||
                    mKeyboardListener.Enabled == false)
                {
                    InitializaKeyboardListner();
                    System.Diagnostics.Debug.WriteLine(
                        "(Re)start keyboard listner: {0}", DateTime.Now);
                }
            };

            mTimer.Interval = 60 * 1000;
            mTimer.Start();
        }
Exemple #3
0
        public void PlaySE(SoundPack.SystemSE se)
        {
            if (!this.Initialized || !this.IsActiveControl)
            {
                return;
            }
            SoundPack soundPack = !Singleton <Resources> .IsInstance() ? (SoundPack)null : Singleton <Resources> .Instance.SoundPack;

            if (Object.op_Equality((Object)soundPack, (Object)null))
            {
                return;
            }
            soundPack.Play(se);
        }
 public static SoundEngine FromSoundPack(SoundPack pack)
 {
     return new SoundEngine(pack.Location);
 }