ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/OniSplit/Sound/OsbdXmlImporter.cs
Revision: 1114
Committed: Wed Jan 22 14:08:57 2020 UTC (5 years, 8 months ago) by iritscen
File size: 1110 byte(s)
Log Message:
Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File Contents

# Content
1 using System;
2 using System.Xml;
3 using Oni.Metadata;
4 using Oni.Xml;
5
6 namespace Oni.Sound
7 {
8 internal sealed class OsbdXmlImporter : RawXmlImporter
9 {
10 public OsbdXmlImporter(XmlReader reader, BinaryWriter writer)
11 : base(reader, writer)
12 {
13 }
14
15 public void Import()
16 {
17 switch (Xml.LocalName)
18 {
19 case "AmbientSound":
20 Import(SoundMetadata.OSAm, SoundMetadata.osam6);
21 break;
22
23 case "ImpulseSound":
24 Import(SoundMetadata.OSIm, SoundMetadata.osim6);
25 break;
26
27 case "SoundGroup":
28 Import(SoundMetadata.OSGr, SoundMetadata.osgr6);
29 break;
30 }
31 }
32
33 private void Import(int tag, MetaStruct type)
34 {
35 Xml.ReadStartElement();
36
37 BeginStruct(0);
38
39 Writer.Write(tag);
40 Writer.Write(0);
41 Writer.Write(6);
42
43 ReadStruct(type);
44 }
45 }
46 }