/// <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); }
void imlInterp_StartRecording(object sender, SoundFileEventArgs e) { telecomProvider.StartRecording(lineNumber, e.SoundFilename, e.Format); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + lineNumber + ") Started recording to " + e.SoundFilename, false); lastRecording = e.SoundFilename; recording = true; }
/// <summary> /// Event handler for the SoundScanner.FoundSoundPackFile event. /// </summary> private void FoundSoundPackFile(object sender, SoundFileEventArgs <SoundPackFile> e) { //if (e.SourceEvent.ID != snd.SoundAddress1 && e.SourceEvent.ID != snd.SoundAddress2) return; EndianReader reader = null; foreach (SoundPackInfo pack in cache.SoundPacks) { if (pack.Pack.FindFileByID(e.File.ID) != null) { reader = pack.Reader; break; } } AddSound(reader, e.File.Offset, e.File.Size, e.File.ID, e.SourceEvent.ID); }
void imlInterp_CopyLastRecording(object sender, SoundFileEventArgs e) { try { if (!recording && lastRecording != null && lastRecording.Length > 0 && File.Exists(lastRecording)) { File.Copy(lastRecording, e.SoundFilename); LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + lineNumber + ") Move last recording at " + lastRecording + " to " + e.SoundFilename, false); } } catch (Exception ex) { LoggingService.AddLogEntry(LogLevel.ErrorsOnly, "(Line " + lineNumber + ") Unable to move last recording at " + lastRecording + " to " + e.SoundFilename, true); } }