| 6 |  | internal class AifExporter : SoundExporter | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 8 |  | #region Private data | 
 
 
 
 
 
 
 
 | 9 | + | private bool do_pc_demo_test; | 
 
 
 
 
 
 
 
 | 10 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 |  | private const int fcc_FORM = 0x464f524d; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 |  | private const int fcc_AIFC = 0x41494643; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 13 |  | private const int fcc_COMM = 0x434f4d4d; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 21 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 22 |  | #endregion | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 24 | < | public AifExporter(InstanceFileManager fileManager, string outputDirPath) | 
 
 
 
 
 
 
 
 
 | 24 | > | public AifExporter(InstanceFileManager fileManager, string outputDirPath, bool noDemo = false) | 
 
 
 
 
 
 
 
 
 
 
 | 25 |  | : base(fileManager, outputDirPath) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 26 |  | { | 
 
 
 
 
 
 
 
 | 27 | + | do_pc_demo_test = !noDemo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 |  | protected override void ExportInstance(InstanceDescriptor descriptor) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 32 | < | var sound = SoundData.Read(descriptor); | 
 
 
 
 
 
 
 
 
 | 32 | > | var sound = SoundData.Read(descriptor, do_pc_demo_test); | 
 
 
 
 
 
 
 
 
 
 
 | 33 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 |  | using (var stream = File.Create(Path.Combine(OutputDirPath, descriptor.FullName + ".aif"))) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 |  | using (var writer = new BinaryWriter(stream)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 36 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 |  | if (!(sound.IsIMA4)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 39 | < | throw new NotSupportedException("Transcoding from PC ADPCM to Mac/demo ADPCM not supported!"); | 
 
 
 
 
 
 
 
 
 | 39 | > | throw new NotSupportedException("Transcoding from MS ADPCM (PC) to IMA4 ADPCM (Mac) not supported!"); | 
 
 
 
 
 
 
 
 
 
 
 | 40 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 41 |  | writer.Write(Utils.ByteSwap(fcc_FORM)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 42 |  | writer.Write(Utils.ByteSwap(50 + sound.Data.Length)); |