From dc5a17bc56f2f8029067654e98ff79c65766e0c7 Mon Sep 17 00:00:00 2001 From: CreepyCrafter24 <33260128+CreepyCrafter24@users.noreply.github.com> Date: Mon, 30 Mar 2020 16:05:25 +0200 Subject: [PATCH] Quick hack using ffmpeg to fix linux builds --- .../SoundManagement/LinuxSoundManager.cs | 16 +++++++++++----- testexetrisathlon/testexetrisathlon.csproj | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/testexetrisathlon/SoundManagement/LinuxSoundManager.cs b/testexetrisathlon/SoundManagement/LinuxSoundManager.cs index 3b7a873..0cfe6f7 100644 --- a/testexetrisathlon/SoundManagement/LinuxSoundManager.cs +++ b/testexetrisathlon/SoundManagement/LinuxSoundManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Reflection; using Bassoon; @@ -29,12 +30,17 @@ namespace testexetrisathlon.SoundManagement foreach ((string name, string key) in manifestResources) { string file = Path.GetTempFileName(); - File.Move(file, Path.ChangeExtension(file, "wav")); + 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"); - using Stream resource = Assembly.GetManifestResourceStream(key); - using FileStream fileStream = File.Create(file); - resource.Seek(0, SeekOrigin.Begin); - resource.CopyTo(fileStream); _files.Add(name, file); _loadedSounds.Add(name, new Sound(file)); } diff --git a/testexetrisathlon/testexetrisathlon.csproj b/testexetrisathlon/testexetrisathlon.csproj index 2f6505b..a8fbba3 100644 --- a/testexetrisathlon/testexetrisathlon.csproj +++ b/testexetrisathlon/testexetrisathlon.csproj @@ -26,6 +26,7 @@ +