public void Init(Dictionary <string, string> manifestResources)
 {
     _bassoon      = new BassoonEngine();
     _files        = new Dictionary <string, string>();
     _loadedSounds = new Dictionary <string, Sound>();
     foreach ((string name, string key) in manifestResources)
     {
         string file = Path.GetTempFileName();
         File.Move(file, Path.ChangeExtension(file, "mp3"));
         file = Path.ChangeExtension(file, "mp3");
         using (Stream resource = Assembly.GetManifestResourceStream(key))
         {
             using FileStream fileStream = File.Create(file);
             resource.Seek(0, SeekOrigin.Begin);
             resource.CopyTo(fileStream);
         }
         Process.Start(new ProcessStartInfo {
             FileName = "ffmpeg", Arguments = $"-i {file} {Path.ChangeExtension(file, "wav")}", WorkingDirectory = Path.GetTempPath()
         }).WaitForExit();
         File.Delete(file);
         file = Path.ChangeExtension(file, "wav");
         _files.Add(name, file);
         _loadedSounds.Add(name, new Sound(file));
     }
     Console.Clear();
 }
Exemple #2
0
 public Bassoon()
 {
     Engine = new BassoonEngine();
 }