forked from MadFlyFish/fmod-for-godot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfmod_runtime.h
160 lines (112 loc) · 5.24 KB
/
fmod_runtime.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//
// Created by Daniel on 2024-01-18.
//
#ifndef FMOD_RUNTIME_H
#define FMOD_RUNTIME_H
#include <vector>
#include "fmod_assets.h"
#include "api/studio_api.h"
#include "scene/main/node.h"
#include "fmod_types.h"
#include "fmod_assets.h"
#include "fmod_studio_module.h"
#include "scene/studio_event_emitter.h"
#include "scene/studio_listener.h"
#include "scene/main/window.h"
#include "utils/debug_monitors.h"
#include "utils/runtime_utils.h"
class FMODStudioModule;
class StudioListener3D;
class StudioListener2D;
class FMODRuntime : public Node
{
GDCLASS(FMODRuntime, Node)
protected:
static void _bind_methods();
uint64_t last_time_played_hover = 0;
uint64_t last_time_played_click = 0;
bool has_sfx_click = false;
bool has_sfx_hover = false;
bool already_setup_in_tree = false;
public:
Ref<StudioApi::StudioSystem> studio_system;
Ref<StudioApi::StudioSystem> get_studio_system(){return studio_system;}
void set_studio_system(Ref<StudioApi::StudioSystem> val){studio_system = val;}
Node* debug_scene{};
Node* get_debug_scene() {return debug_scene;}
void set_debug_scene(Node* val) { debug_scene = val; }
void _notification(int p_what);
void do_enter_tree();
HashMap<ObjectID,Vector<Ref<StudioApi::EventInstance>>> looped_instances;
Ref<StudioApi::EventInstance> snapshot_instance;
Ref<StudioApi::EventInstance> music_instance;
Ref<FMODGuidDictionary> guid_dictionary;
Ref<FMODGuidDictionary> get_guid_dictionary();
void set_guid_dictionary(const Dictionary &p_guid_dictionary);
void back_to_previous_music();
void back_to_previous_snapshot();
String path_from_guid(const String &guid) const;
String previous_music = "";
String previous_music_resource_path = "";
String current_music = "";
String current_music_resource_path = "";
void set_current_music(const Ref<EventAsset> &desired_snapshot);
Ref<EventAsset> get_current_music() const;
bool set_parameter_by_name(const String& name, float value, bool ignore_seek_speed = false);
String previous_snapshot = "";
String previous_snapshot_resource_path = "";
String current_snapshot = "";
String current_snapshot_resource_path = "";
void set_current_snapshot(const Ref<EventAsset> &desired_snapshot);
Ref<EventAsset> get_current_snapshot() const;
String sfx_click_asset = "";
String sfx_hover_asset = "";
void set_click_and_hover_assets(const Ref<EventAsset> &_click, const Ref<EventAsset> &_hover);
void make_button_grab_focus(Control *button);
void play_click_sfx();
void play_hover_sfx();
void setup_button_sfx_callback(Control* p_button, const Callable &p_callable);
void setup_button_sfx(Control* button);
StudioListener2D* create_studio_listener_2d();
StudioListener3D* create_studio_listener_3d();
String path_to_guid(const String &path);
Ref<StudioApi::EventDescription> get_event_description(const Ref<EventAsset> &event_asset);
Ref<StudioApi::EventDescription> get_event_description_path(const String &event_path);
Ref<StudioApi::EventDescription> get_event_description_id(const String &guid);
Ref<StudioApi::EventInstance> create_instance(const Ref<EventAsset> &event_asset);
Ref<StudioApi::EventInstance> create_instance_path(const String &event_path);
Ref<StudioApi::EventInstance> create_instance_id(const String &guid);
void play_one_shot_attached(const Ref<EventAsset> &event_asset, Node *node);
void play_looped_attached(const Ref<EventAsset> &event_asset, Node *node);
void play_one_shot_attached_path(const String &event_path, Node *node);
void play_one_shot_attached_id(const String &guid, Node *node);
void play_looped_attached_id(const String &guid, Node *node);
void stop_looped_id(const String &guid, ObjectID node_obj_id);
void stop_looped(const Ref<EventAsset> &event_asset, Node *node);
void play_looped(const Ref<EventAsset> &event_asset, Node *node, const Variant &position);
void play_one_shot(const Ref<EventAsset> &event_asset, const Variant &position);
void play_one_shot_path(const String &event_path, const Variant &position);
void play_one_shot_volume(const Ref<EventAsset> &event_asset, float volume, const Variant &position);
void play_one_shot_path_volume(const String &event_path, float volume, const Variant &position);
void play_one_shot_id(const String &guid, const Variant &position);
void play_looped_id(const String &guid, Node *node, const Variant &position);
void play_one_shot_id_volume(const String &guid, float volume, const Variant &position);
void attach_instance_to_node(const Ref<StudioApi::EventInstance> &instance, Node *node, Object *physicsbody);
void detach_instance_from_node(const Ref<StudioApi::EventInstance> &instance);
void do_ready();
void do_exit_tree();
void do_process();
static FMODRuntime* singleton;
static FMODRuntime* get_singleton();
bool has_initialized = false;
bool get_has_initialized() {return has_initialized;}
void set_has_initialized(bool v) {
}
bool debug_print_event_calls = false;
bool get_debug_print_event_calls() const {return debug_print_event_calls;}
void set_debug_print_event_calls(bool val) {debug_print_event_calls = val;}
void setup_in_tree();
FMODRuntime();
~FMODRuntime() override;
};
#endif //FMOD_RUNTIME_H