mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-15 06:05:10 +00:00
do this properly
This commit is contained in:
parent
214ebba172
commit
cad154423e
2 changed files with 8 additions and 6 deletions
|
@ -98,7 +98,6 @@ namespace HeavenStudio
|
||||||
CustomScreenWidth = PersistentDataManager.gameSettings.resolutionWidth;
|
CustomScreenWidth = PersistentDataManager.gameSettings.resolutionWidth;
|
||||||
CustomScreenHeight = PersistentDataManager.gameSettings.resolutionHeight;
|
CustomScreenHeight = PersistentDataManager.gameSettings.resolutionHeight;
|
||||||
|
|
||||||
|
|
||||||
if (PersistentDataManager.gameSettings.dspSize == 0)
|
if (PersistentDataManager.gameSettings.dspSize == 0)
|
||||||
PersistentDataManager.gameSettings.dspSize = 512;
|
PersistentDataManager.gameSettings.dspSize = 512;
|
||||||
if (PersistentDataManager.gameSettings.sampleRate == 0)
|
if (PersistentDataManager.gameSettings.sampleRate == 0)
|
||||||
|
|
|
@ -151,12 +151,15 @@ 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")))
|
string wavCachePath = Path.Combine(Application.temporaryCachePath, "/savewav");
|
||||||
|
if (Directory.Exists(wavCachePath))
|
||||||
{
|
{
|
||||||
Directory.Delete(Path.Combine(Application.temporaryCachePath, "/savewav"), true);
|
Directory.Delete(wavCachePath, true);
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(wavCachePath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(wavCachePath);
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(Application.temporaryCachePath, "/savewav"))
|
|
||||||
Directory.CreateDirectory(Application.temporaryCachePath, "/savewav");
|
|
||||||
if (audioType == AudioType.MPEG)
|
if (audioType == AudioType.MPEG)
|
||||||
{
|
{
|
||||||
Debug.Log($"mp3 loaded, Converting {filePath} to wav...");
|
Debug.Log($"mp3 loaded, Converting {filePath} to wav...");
|
||||||
|
@ -175,7 +178,7 @@ namespace HeavenStudio
|
||||||
AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
|
AudioClip clip = DownloadHandlerAudioClip.GetContent(www);
|
||||||
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||||
SavWav.Save("/savewav/" + fileName, clip, true);
|
SavWav.Save("/savewav/" + fileName, clip, true);
|
||||||
filePath = Path.Combine(Application.temporaryCachePath, "/savewav/" + fileName + ".wav");
|
filePath = Path.Combine(wavCachePath, $"/{fileName}.wav");
|
||||||
|
|
||||||
clip = null;
|
clip = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue