--- OniSplit/Sound/AifExporter.cs 2020/01/22 14:08:57 1114 +++ OniSplit/Sound/AifExporter.cs 2020/05/30 12:08:12 1131 @@ -6,6 +6,8 @@ namespace Oni.Sound internal class AifExporter : SoundExporter { #region Private data + private bool do_pc_demo_test; + private const int fcc_FORM = 0x464f524d; private const int fcc_AIFC = 0x41494643; private const int fcc_COMM = 0x434f4d4d; @@ -19,18 +21,23 @@ namespace Oni.Sound #endregion - public AifExporter(InstanceFileManager fileManager, string outputDirPath) + public AifExporter(InstanceFileManager fileManager, string outputDirPath, bool noDemo = false) : base(fileManager, outputDirPath) { + do_pc_demo_test = !noDemo; } protected override void ExportInstance(InstanceDescriptor descriptor) { - var sound = SoundData.Read(descriptor); + var sound = SoundData.Read(descriptor, do_pc_demo_test); using (var stream = File.Create(Path.Combine(OutputDirPath, descriptor.FullName + ".aif"))) using (var writer = new BinaryWriter(stream)) { + if (!(sound.IsIMA4)) + { + throw new NotSupportedException("Transcoding from MS ADPCM (PC) to IMA4 ADPCM (Mac) not supported!"); + } writer.Write(Utils.ByteSwap(fcc_FORM)); writer.Write(Utils.ByteSwap(50 + sound.Data.Length)); writer.Write(Utils.ByteSwap(fcc_AIFC));