private void PlayWave(string path)
{
if (!File.Exists(path))
return;
string loc = Path.GetDirectoryName(Application.ExecutablePath) + "\\exec";
Stream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
if (path.EndsWith(".pcc"))
{
using (ME3Package package = MEPackageHandler.OpenME3Package(path))
{
if (package.IsCompressed)
{
Stream result = CompressionHelper.DecompressME3(fs);
fs.Dispose();
fs = result;
}
}
}
if (DataOffset + DataSize > fs.Length)
return;
ExtractRawFromStream(fs);
ConvertRiffToWav();
if (File.Exists(loc + "\\out.wav"))
{
sp = new SoundPlayer(loc + "\\out.wav");
sp.Play();
while (!sp.IsLoadCompleted)
Application.DoEvents();
}
fs.Dispose();
}