Browse Source

Add info for common unsupported audio types

master
NGnius (Graham) 4 years ago
parent
commit
85c1342313
4 changed files with 40 additions and 1 deletions
  1. +37
    -0
      Pixi/Audio/AudioFakeImporter.cs
  2. +1
    -0
      Pixi/Common/ColorSpaceUtility.cs
  3. +1
    -1
      Pixi/Common/CommandRoot.cs
  4. +1
    -0
      Pixi/PixiPlugin.cs

+ 37
- 0
Pixi/Audio/AudioFakeImporter.cs View 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)
{
}
}
}

+ 1
- 0
Pixi/Common/ColorSpaceUtility.cs View File

@@ -314,6 +314,7 @@ namespace Pixi.Common
count++;
}
}
yield return asyncHandle.Continue();
}
}
}


+ 1
- 1
Pixi/Common/CommandRoot.cs View File

@@ -157,7 +157,7 @@ namespace Pixi.Common
#endif
// import blocks
BlockJsonInfo[] blocksInfo = magicImporter.Import(name);
if (blocksInfo.Length == 0)
if (blocksInfo == null || blocksInfo.Length == 0)
{
#if DEBUG
Logging.CommandLogError($"Importer {magicImporter.Name} didn't provide any blocks to import. Mission Aborted!");


+ 1
- 0
Pixi/PixiPlugin.cs View File

@@ -57,6 +57,7 @@ namespace Pixi
#endif
// Audio functionality
root.Inject(new MidiImporter());
root.Inject(new AudioFakeImporter());
}
}
}

Loading…
Cancel
Save