Пример #1
0
        private void GatherSoundBanks(BinaryReader br)
        {
            soundBankList.Clear();
            UInt32 soundBankCount = br.ReadUInt32();

            for (int i = 0; i < soundBankCount; i++)
            {
                soundBank soundBank = new soundBank();
                soundBank.id       = br.ReadUInt32();
                soundBank.idString = "0x" + soundBank.id.ToString("X8");
                UInt32 soundBankOffsetMult = br.ReadUInt32();
                UInt32 soundBankSize       = br.ReadUInt32();
                soundBank.headerOffset = br.ReadUInt32() * soundBankOffsetMult;
                UInt32 soundBankFolder     = br.ReadUInt32();
                string soundBankFolderName = (string)folderHashTable[soundBankFolder];
                soundBank.relativePath = soundBankFolderName + "\\" + baseName + "\\" + "SoundBank (" + soundBank.idString + ")\\";
                UInt32 soundBankTempPos = (UInt32)br.BaseStream.Position;
                br.BaseStream.Seek(soundBank.headerOffset, 0);
                br.ReadUInt32();
                soundBank.headerSize = br.ReadUInt32() + 8;
                UInt32 firstBankSectionPos = soundBank.headerOffset + soundBank.headerSize;
                br.BaseStream.Seek(firstBankSectionPos, 0);
                string firstSectionIdent = new string(br.ReadChars(4));
                if (firstSectionIdent == @"DIDX")
                {
                    UInt32 didxSize        = br.ReadUInt32();
                    UInt32 didxFilesCount  = didxSize / 12;
                    UInt32 dataFilesOffset = firstBankSectionPos + didxSize + 16;
                    for (int j = 0; j < didxFilesCount; j++)
                    {
                        soundFile soundFile = new soundFile();
                        soundFile.id           = br.ReadUInt32();
                        soundFile.idString     = "0x" + soundFile.id.ToString("X8");
                        soundFile.fileOffset   = br.ReadUInt32() + dataFilesOffset;
                        soundFile.fileSize     = br.ReadUInt32();
                        soundFile.relativePath = soundBank.relativePath;
                        soundFileList.Add(soundFile);
                    }
                    br.BaseStream.Seek(firstBankSectionPos + didxSize + 12, 0);
                    UInt32 dataSectionSize = br.ReadUInt32();
                    br.ReadBytes((int)dataSectionSize + 4);
                }
                soundBank.hircOffset = (UInt32)br.BaseStream.Position - 4;
                soundBank.hircSize   = br.ReadUInt32() + 8;
                br.BaseStream.Seek(soundBankTempPos, 0);
                soundBankList.Add(soundBank);
            }
        }
Пример #2
0
        private void GatherSoundFiles(BinaryReader br)
        {
            soundFileList.Clear();
            UInt32 soundFileCount = br.ReadUInt32();

            for (int i = 0; i < soundFileCount; i++)
            {
                soundFile soundFile = new soundFile();
                soundFile.id       = br.ReadUInt32();
                soundFile.idString = "0x" + soundFile.id.ToString("X8");
                UInt32 soundFileOffsetMult = br.ReadUInt32();
                soundFile.fileSize   = br.ReadUInt32();
                soundFile.fileOffset = br.ReadUInt32() * soundFileOffsetMult;
                UInt32 soundFileFolder     = br.ReadUInt32();
                string soundFileFolderName = (string)folderHashTable[soundFileFolder];
                soundFile.relativePath = soundFileFolderName + "\\" + baseName + "\\";
                soundFileList.Add(soundFile);
            }
        }
Пример #3
0
 private void importAlarmData(Alarm alarm)
 {
     if(alarm.AlarmType == AlarmSettings.aType.Alarm)
         TypeCombo.SelectedIndex = 0;
     else if (alarm.AlarmType == AlarmSettings.aType.Chime)
     {
         TypeCombo.SelectedIndex = 1;
         chimeIntervalTextbox.Text = (alarm as Chime).ChimeInterval.TotalMinutes.ToString();
         chimeEndTimeTextbox.Text = (alarm as Chime).ChimeEndTime.ToShortTimeString();
     }
     alarmTimePicker.Value = alarm.AlarmTime;
     descriptionTextbox.Text = alarm.AlarmDescription;
     if (alarm.SoundSet)
     {
         notifySoundCheck.Checked = true;
         soundFile snd = new soundFile(alarm.SoundPath);
         soundComboList.Items.Add(snd);
         soundComboList.SelectedIndex = soundComboList.Items.Count - 1;
     }
 }
Пример #4
0
        private List <soundFile> GetSoundFiles(BinaryReader br)
        {
            List <soundFile> Temp           = new List <soundFile>();
            UInt32           soundFileCount = br.ReadUInt32();

            for (int i = 0; i < soundFileCount; i++)
            {
                soundFile soundFile = new soundFile();
                soundFile.id       = br.ReadUInt32();
                soundFile.idString = "0x" + soundFile.id.ToString("X8");
                UInt32 soundFileOffsetMult = br.ReadUInt32();
                soundFile.fileSize   = br.ReadUInt32();
                soundFile.fileOffset = br.ReadUInt32() * soundFileOffsetMult;
                UInt32 soundFileFolder     = br.ReadUInt32();
                string soundFileFolderName = (string)folderHashTable[soundFileFolder];
                soundFile.relativePath = soundFileFolderName + "\\" + baseName + "\\";
                Temp.Add(soundFile);
            }
            return(Temp);
        }
Пример #5
0
        private void GatherSoundBanks(BinaryReader br)
        {
            UInt32 soundBankCount = br.ReadUInt32();

            for (int i = 0; i < soundBankCount; i++)
            {
                soundBank soundBank = new soundBank();

                // Sound Bank info
                soundBank.id       = br.ReadUInt32();
                soundBank.idString = "0x" + soundBank.id.ToString("X8");
                UInt32 soundBankOffsetMult = br.ReadUInt32();
                UInt32 soundBankSize       = br.ReadUInt32();
                soundBank.headerOffset = br.ReadUInt32() * soundBankOffsetMult;
                UInt32 soundBankFolder     = br.ReadUInt32();
                string soundBankFolderName = (string)folderHashTable[soundBankFolder];
                soundBank.relativePath = soundBankFolderName + "\\" + baseName + "\\" + "SoundBank (" + soundBank.idString + ")\\";

                UInt32 soundBankTempPos = (UInt32)br.BaseStream.Position;

                // Actual Sound Bank, header
                br.BaseStream.Seek(soundBank.headerOffset, 0);
                br.ReadUInt32();                            // Bank head Identifier
                soundBank.headerSize = br.ReadUInt32() + 8; // Include 0x8 head
                UInt32 firstBankSectionPos = soundBank.headerOffset + soundBank.headerSize;
                br.BaseStream.Seek(firstBankSectionPos, 0);

                // Check if we have a DIDX section (contains embedded *.wem files) to deal with
                string firstSectionIdent = new string(br.ReadChars(4));
                if (firstSectionIdent == @"DIDX")
                {
                    //soundBank.relativePath += "SoundBank (" + soundBank.idString + ")\\"; // Move Bank+Sound into Bank folder

                    UInt32 didxSize        = br.ReadUInt32();
                    UInt32 didxFilesCount  = didxSize / 12;                       // Each file description is 0xC bytes
                    UInt32 dataFilesOffset = firstBankSectionPos + didxSize + 16; // 16 is for the DIDX+DATA headers

                    for (int j = 0; j < didxFilesCount; j++)
                    {
                        soundFile soundFile = new soundFile();

                        soundFile.id         = br.ReadUInt32();
                        soundFile.idString   = "0x" + soundFile.id.ToString("X8");
                        soundFile.fileOffset = br.ReadUInt32() + dataFilesOffset;
                        soundFile.fileSize   = br.ReadUInt32();

                        soundFile.relativePath = soundBank.relativePath;

                        soundFileList.Add(soundFile);
                    }

                    br.BaseStream.Seek(firstBankSectionPos + didxSize + 12, 0); // Get us to the DATA section size
                    UInt32 dataSectionSize = br.ReadUInt32();
                    br.ReadBytes((int)dataSectionSize + 4);                     // Skip to the end of DATA + 4, so we're back after HIRC Identifier
                }

                soundBank.hircOffset = (UInt32)br.BaseStream.Position - 4; // We already hit the HIRC head Identifier
                soundBank.hircSize   = br.ReadUInt32() + 8;                // Include 0x8 head

                // Go back to SoundBank list
                br.BaseStream.Seek(soundBankTempPos, 0);

                soundBankList.Add(soundBank);
            }
        }