public static void insertWav(string fileName, int groupID, int collID, int wavID) { if (!File.Exists("sndconv.exe")) { Console.WriteLine("Missing sndconv.exe: unable to convert wav file"); return; } TextWriter writer = File.CreateText("sawnd.txt"); writer.Write("BEGIN a\r\nFile sound.wav\r\nOUTPUT ADPCM\r\nEND"); writer.Close(); //In the case that someone wants to insert the temp file "sound.wav", no need to delete or copy. if (fileName.CompareTo("sound.wav") != 0) { File.Delete("sound.wav"); File.Copy(fileName, "sound.wav"); } System.Audio.IAudioStream wav = System.Audio.WAV.FromFile("sound.wav"); bool loop = wav.IsLooping; int frequency = wav.Frequency; wav.Dispose(); p = new Process(); try { p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "sndconv.exe"; p.StartInfo.Arguments = "sawnd.txt -a"; p.Start(); while ((!p.HasExited || !p.StandardOutput.EndOfStream)) { char[] buffer = new char[10]; int count = p.StandardOutput.Read(buffer, 0, 10); Console.Write(buffer); } if (!p.HasExited) { p.WaitForExit(); } insert(groupID, collID, wavID, frequency, loop); } catch (Exception e) { Console.WriteLine(e.ToString()); //If the process is still running kill it if (p != null && !p.HasExited) { p.Kill(); p = null; } } }
public MappingItem(string name, int group = -1, int collection = -1, int wave = -1) { this.name = name; this.Text = name; this.groupID = group; this.collectionID = collection; this.wavID = wave; sound = null; _fileSize = 0; }
public StreamSource(System.Audio.IAudioStream istream) { stream = istream; }
public StreamSource() { stream = null; }