private void rSTMToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = SupportedFilesHandler.GetCompleteFilter("wav") }) if (ofd.ShowDialog() == DialogResult.OK) { RSTMNode r = new RSTMNode() { _fileIndex = _targetNode.Files.Count }; using (BrstmConverterDialog dlg = new BrstmConverterDialog()) { dlg.AudioSource = ofd.FileName; if (dlg.ShowDialog(this) == DialogResult.OK) { r.Name = String.Format("[{0}] {1}", _targetNode.Files.Count, Path.GetFileNameWithoutExtension(dlg.AudioSource)); r.ReplaceRaw(dlg.AudioData); } } r._parent = _targetNode; _targetNode.Files.Add(r); r.SignalPropertyChange(); Update(lstSets); } }
public unsafe override void Replace(string fileName) { if (fileName.EndsWith(".wav")) using (BrstmConverterDialog dlg = new BrstmConverterDialog()) { dlg.Type = 2; dlg.AudioSource = fileName; if (dlg.ShowDialog(null) == DialogResult.OK) ReplaceRaw(dlg.AudioData); } else base.Replace(fileName); //Init(Header->Data->Data, Header->Data->_header._length, &Header->Info->_info); UpdateCurrentControl(); SignalPropertyChange(); Parent.Parent.SignalPropertyChange(); if (RSARNode != null) RSARNode.SignalPropertyChange(); }
/// <summary> /// This method can handle WAV files, converting them to BRSTM using BrawlLib's converter. /// </summary> /// <param name="src">a BRSTM or WAV file</param> /// <param name="dest">the output BRSTM path</param> public static void copyBrstm(string src, string dest) { if (src.EndsWith(".brstm")) { FileOperations.Copy(src, dest, deleteFirst:true); } else { BrstmConverterDialog bcd = new BrstmConverterDialog(); bcd.AudioSource = src; if (bcd.ShowDialog() == DialogResult.OK) { // Make a temporary node to put the data in, and export it. // This avoids the need to use pointers directly. RSTMNode tmpNode = new RSTMNode(); tmpNode.ReplaceRaw(bcd.AudioData); tmpNode.Export(dest); tmpNode.Dispose(); } bcd.Dispose(); } }
private void bRStmAudioToolStripMenuItem_Click(object sender, EventArgs e) { string path; if (Program.OpenFile("PCM Audio (*.wav)|*.wav", out path) > 0) { if (Program.New<RSTMNode>()) { using (BrstmConverterDialog dlg = new BrstmConverterDialog()) { dlg.AudioSource = path; if (dlg.ShowDialog(this) == DialogResult.OK) { Program.RootNode.Name = Path.GetFileNameWithoutExtension(dlg.AudioSource); Program.RootNode.ReplaceRaw(dlg.AudioData); } else Program.Close(true); } } } }
public unsafe override void Replace(string fileName) { if (fileName.EndsWith(".wav")) using (BrstmConverterDialog dlg = new BrstmConverterDialog()) { dlg.Type = 1; dlg.AudioSource = fileName; if (dlg.ShowDialog(null) == DialogResult.OK) ReplaceRaw(dlg.AudioData); } else base.Replace(fileName); Init(WorkingUncompressed.Address + Info._dataLocation, (int)(WorkingUncompressed.Length - Info._dataLocation), (WaveInfo*)WorkingUncompressed.Address); //Cut out the audio samples from the imported data SetSizeInternal((int)Info._dataLocation); UpdateCurrentControl(); SignalPropertyChange(); Parent.Parent.SignalPropertyChange(); if (RSARNode != null) RSARNode.SignalPropertyChange(); }