public void SaveTemp(int index) { var info = _perms[index]; var fileName = Path.GetTempPath() + "temp_playback.wav"; RIFX rifx = ReadRIFX(info); switch (info.Format) { case Composer.SoundFormat.XMA: SoundExtraction.ExtractXMAToWAV(info.Reader, info.Offset, rifx, fileName); break; case Composer.SoundFormat.WwiseOGG: throw new NotSupportedException("OGG preview not supported: extract it instead."); case Composer.SoundFormat.XWMA: SoundExtraction.ExtractXWMAToWAV(info.Reader, info.Offset, rifx, fileName); break; default: throw new Exception("no"); } }
private void btnSaveSelected_Click(object sender, EventArgs e) { var sfd = new SaveFileDialog() { AddExtension = false, FileName = Path.GetFileName(tag.Filename), // tag.Filename.Substring(tag.Filename.LastIndexOf('\\') + 1), Filter = "WAV Files|*.wav", //|XMA Files|*.xma|Raw Data|*.bin", FilterIndex = (int)DefaultSnd_Format + 1 }; if (sfd.ShowDialog() != DialogResult.OK) { return; } try { for (int i = 0; i < lstPerms.Items.Count; i++) { if (!lstPerms.SelectedIndices.Contains(i)) { continue; } var info = _perms[i]; var fileName = sfd.FileName.Substring(0, sfd.FileName.LastIndexOf("\\") + 1) + Path.GetFileNameWithoutExtension(sfd.FileName) + " [" + i.ToString() + "]" + Path.GetExtension(sfd.FileName); RIFX rifx = ReadRIFX(info); switch (info.Format) { case Composer.SoundFormat.XMA: SoundExtraction.ExtractXMAToWAV(info.Reader, info.Offset, rifx, fileName); break; case Composer.SoundFormat.WwiseOGG: SoundExtraction.ExtractWwiseToOGG(info.Reader, info.Offset, info.Size, fileName); break; case Composer.SoundFormat.XWMA: SoundExtraction.ExtractXWMAToWAV(info.Reader, info.Offset, rifx, fileName); break; default: throw new Exception("no"); } } //SaveSelected(sfd.FileName, cache, tag, (SoundFormat)(sfd.FilterIndex - 1), indices, true); TagExtracted(this, tag); } catch (Exception ex) { ErrorExtracting(this, tag, ex); } }