forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrameworkDispatcher.cs
48 lines (40 loc) · 1.32 KB
/
FrameworkDispatcher.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using Microsoft.Xna.Framework.Audio;
namespace Microsoft.Xna.Framework
{
/// <summary>
/// Helper class for processing internal framework events.
/// </summary>
/// <remarks>
/// If you use <see cref="Game"/> class, <see cref="Update()"/> is called automatically.
/// Otherwise you must call it as part of your game loop.
/// </remarks>
public static class FrameworkDispatcher
{
private static bool _initialized = false;
/// <summary>
/// Processes framework events.
/// </summary>
public static void Update()
{
if (!_initialized)
Initialize();
DoUpdate();
}
private static void DoUpdate()
{
DynamicSoundEffectInstanceManager.UpdatePlayingInstances();
SoundEffectInstancePool.Update();
Microphone.UpdateMicrophones();
}
private static void Initialize()
{
// Initialize sound system
SoundEffect.InitializeSoundEffect();
_initialized = true;
}
}
}