generated from rbfx/Core.SamplePlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_Plugin.cpp
More file actions
37 lines (28 loc) · 1 KB
/
_Plugin.cpp
File metadata and controls
37 lines (28 loc) · 1 KB
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
#include "_Plugin.h"
#include "SteamAudio.h"
#include "SteamSoundListener.h"
#include "SteamSoundMesh.h"
#include "SteamSoundSource.h"
#include <Urho3D/Engine/Engine.h>
#include <Urho3D/Engine/EngineDefs.h>
#include <Urho3D/Plugins/PluginApplication.h>
using namespace Urho3D;
namespace
{
void RegisterPluginObjects(PluginApplication& plugin)
{
plugin.RegisterObject<SteamSoundListener>();
plugin.RegisterObject<SteamSoundMesh>();
plugin.RegisterObject<SteamSoundSource>();
Context* context = plugin.GetContext();
auto steamAudio = context->RegisterSubsystem<SteamAudio>();
auto engine = context->GetSubsystem<Engine>();
steamAudio->SetMode(engine->GetParameter(EP_SOUND_MIX_RATE).GetInt(),
static_cast<SpeakerMode>(engine->GetParameter(EP_SOUND_MODE).GetInt()));
}
void UnregisterPluginObjects(PluginApplication& plugin)
{
plugin.GetContext()->RemoveSubsystem<SteamAudio>();
}
} // namespace
URHO3D_DEFINE_PLUGIN_MAIN_SIMPLE(RegisterPluginObjects, UnregisterPluginObjects);