don't double-embed the converted audio

This commit is contained in:
minenice55 2023-12-04 15:52:20 -05:00
parent 008374bac5
commit 38d59e2f72

View file

@ -146,6 +146,10 @@ namespace HeavenStudio
public static string JukeboxAudioConverter(string filePath, AudioType audioType, string specificType) public static string JukeboxAudioConverter(string filePath, AudioType audioType, string specificType)
{ {
if (Directory.Exists(Path.Combine(Application.temporaryCachePath, "/savewav")))
{
Directory.Delete(Path.Combine(Application.temporaryCachePath, "/savewav"), true);
}
if (audioType == AudioType.MPEG) if (audioType == AudioType.MPEG)
{ {
Debug.Log($"mp3 loaded, Converting {filePath} to wav..."); Debug.Log($"mp3 loaded, Converting {filePath} to wav...");
@ -163,8 +167,8 @@ namespace HeavenStudio
} }
AudioClip clip = DownloadHandlerAudioClip.GetContent(www); AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
string fileName = Path.GetFileNameWithoutExtension(filePath); string fileName = Path.GetFileNameWithoutExtension(filePath);
SavWav.Save("/RIQCache/" + fileName, clip, true); SavWav.Save("/savewav/" + fileName, clip, true);
filePath = Path.Combine(Application.temporaryCachePath, "/RIQCache/" + fileName + ".wav"); filePath = Path.Combine(Application.temporaryCachePath, "/savewav/" + fileName + ".wav");
clip = null; clip = null;
} }