Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SoundEffectSerializer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using System;
5 
6 using SiliconStudio.Core.Serialization;
7 using SiliconStudio.Core.Serialization.Contents;
8 
9 namespace SiliconStudio.Paradox.Audio
10 {
11  internal class SoundEffectSerializer : ContentSerializerBase<SoundEffect>
12  {
13  private readonly AudioEngine audioEngine;
14 
15  public SoundEffectSerializer(AudioEngine engine)
16  {
17  if (engine == null)
18  throw new ArgumentNullException("engine");
19 
20  audioEngine = engine;
21  }
22 
23  public override void Serialize(ContentSerializerContext context, SerializationStream stream, ref SoundEffect obj)
24  {
25  base.Serialize(context, stream, ref obj);
26 
27  if (context.Mode == ArchiveMode.Deserialize)
28  {
29  obj = SoundEffect.Load(audioEngine, stream.NativeStream);
30  }
31  else
32  {
33  throw new NotImplementedException();
34  }
35  }
36 
37  public override object Construct(ContentSerializerContext context)
38  {
39  return null;
40  }
41  }
42 }
Base class for implementation of SerializationStream.
ArchiveMode
Enumerates the different mode of serialization (either serialization or deserialization).
Definition: ArchiveMode.cs:8