-
Notifications
You must be signed in to change notification settings - Fork 1
/
EventDescription.hpp
63 lines (50 loc) · 1.63 KB
/
EventDescription.hpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include "Essentials.hpp"
#include "FmodInclude.hpp"
namespace lite
{
class EventDescription
{
private: // data
// Pointer to FMOD's description object.
fmod::EventDescription* description;
// User property returned when the requested property isn't found.
FMOD_STUDIO_USER_PROPERTY nullUserProperty = FMOD_STUDIO_USER_PROPERTY{ nullptr, FMOD_STUDIO_USER_PROPERTY_TYPE_FORCEINT };
// Event path name.
string path;
public: // properties
// Whether the sound will naturally terminate and
// can be used as a fire-and-forget sort of sound.
bool IsOneshot() const
{
bool b;
FmodCall(description->isOneshot(&b), false);
return b;
}
// The event's path name.
const string& Path() const { return path; }
public: // methods
EventDescription(fmod::EventDescription* description_, string path_) :
description(description_),
path(move(path_))
{}
fmod::EventInstance* CreateInstance()
{
fmod::EventInstance* instance = nullptr;
FmodCall(description->createInstance(&instance), nullptr);
return instance;
}
// Returns a user property by name. The 'name' field will be null if the
// property wasn't found.
FMOD_STUDIO_USER_PROPERTY GetUserProperty(const string& name) const
{
FMOD_STUDIO_USER_PROPERTY userProperty = nullUserProperty;
description->getUserProperty(name.c_str(), &userProperty);
return userProperty;
}
friend ostream& operator<<(ostream& os, const EventDescription& eventDescription)
{
return os << eventDescription.path;
}
};
} // namespace lite