Example #1
0
        public void Visit(SoundPackFile file)
        {
            // Raise the FoundSoundPackFile event
            SoundFileEventArgs <SoundPackFile> args = new SoundFileEventArgs <SoundPackFile>(file, _currentEvent);

            OnFoundSoundPackFile(args);
        }
Example #2
0
        /// <summary>
        /// Event handler for the SoundScanner.FoundSoundBankFile event.
        /// </summary>
        private void FoundSoundBankFile(object sender, SoundFileEventArgs <SoundBankFile> e)
        {
            //if (e.SourceEvent.ID != snd.SoundAddress1 && e.SourceEvent.ID != snd.SoundAddress2) return;

            // Find the sound bank's pack file so we can determine the offset of the audio data
            uint          bankId   = e.File.ParentBank.ID;
            SoundPackInfo packInfo = null;
            SoundPackFile packFile = null;

            foreach (SoundPackInfo pack in cache.SoundPacks)
            {
                packFile = pack.Pack.FindFileByID(bankId);
                if (packFile != null)
                {
                    packInfo = pack;
                    break;
                }
            }
            if (packFile == null)
            {
                return;
            }

            // Calculate the offset of the audio data and add it
            int offset = packFile.Offset + e.File.ParentBank.DataOffset + e.File.Offset;

            AddSound(packInfo.Reader, offset, e.File.Size, e.File.ID, e.SourceEvent.ID);
        }