Add info for common unsupported audio types
This commit is contained in:
parent
5aa13c2e82
commit
21ddbf698b
4 changed files with 40 additions and 1 deletions
37
Pixi/Audio/AudioFakeImporter.cs
Normal file
37
Pixi/Audio/AudioFakeImporter.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using GamecraftModdingAPI;
|
||||||
|
using GamecraftModdingAPI.Utility;
|
||||||
|
using Pixi.Common;
|
||||||
|
|
||||||
|
namespace Pixi.Audio
|
||||||
|
{
|
||||||
|
public class AudioFakeImporter : Importer
|
||||||
|
{
|
||||||
|
public int Priority { get; } = 0;
|
||||||
|
public bool Optimisable { get; } = false;
|
||||||
|
public string Name { get; } = "AudioWarning~Spell";
|
||||||
|
public BlueprintProvider BlueprintProvider { get; } = null;
|
||||||
|
public bool Qualifies(string name)
|
||||||
|
{
|
||||||
|
return name.EndsWith(".flac", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| name.EndsWith(".ogg", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| name.EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| name.EndsWith(".wav", StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| name.EndsWith(".aac", StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockJsonInfo[] Import(string name)
|
||||||
|
{
|
||||||
|
Logging.CommandLogWarning($"Audio importing only works with MIDI (.mid) files, which '{name}' is not.\nThere are many converters online, but for best quality use a MIDI file made from a music transcription.\nFor example, musescore.com has lots of good transcriptions and they offer a 30-day free trial.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PreProcess(string name, ref ProcessedVoxelObjectNotation[] blocks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostProcess(string name, ref Block[] blocks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -314,6 +314,7 @@ namespace Pixi.Common
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
yield return asyncHandle.Continue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace Pixi.Common
|
||||||
#endif
|
#endif
|
||||||
// import blocks
|
// import blocks
|
||||||
BlockJsonInfo[] blocksInfo = magicImporter.Import(name);
|
BlockJsonInfo[] blocksInfo = magicImporter.Import(name);
|
||||||
if (blocksInfo.Length == 0)
|
if (blocksInfo == null || blocksInfo.Length == 0)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Logging.CommandLogError($"Importer {magicImporter.Name} didn't provide any blocks to import. Mission Aborted!");
|
Logging.CommandLogError($"Importer {magicImporter.Name} didn't provide any blocks to import. Mission Aborted!");
|
||||||
|
|
|
@ -57,6 +57,7 @@ namespace Pixi
|
||||||
#endif
|
#endif
|
||||||
// Audio functionality
|
// Audio functionality
|
||||||
root.Inject(new MidiImporter());
|
root.Inject(new MidiImporter());
|
||||||
|
root.Inject(new AudioFakeImporter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue