diff --git a/.gitignore b/.gitignore index 2021df0f..478ede43 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,6 @@ config.log **/*.editor demo/addons/fmod/libs/android/aar/ + +*.pdb +.vs \ No newline at end of file diff --git a/src/nodes/fmod_event_emitter.h b/src/nodes/fmod_event_emitter.h index 69153a1c..0917cab8 100644 --- a/src/nodes/fmod_event_emitter.h +++ b/src/nodes/fmod_event_emitter.h @@ -55,6 +55,8 @@ namespace godot { void play(); void stop(); + Variant get_parameter(const String& p_name) const; + void set_parameter(const String& p_name, const Variant& p_property); void set_paused(bool p_is_paused); const Ref& get_event() const; bool is_paused(); @@ -233,6 +235,36 @@ namespace godot { } } + template + Variant FmodEventEmitter::get_parameter(const String& p_name) const { + if (!_event.is_valid()) { return nullptr; } + + Parameter* parameter {find_parameter_by_name(p_name)}; + + if (!parameter) { return nullptr; } + + return parameter->value; + } + + template + void FmodEventEmitter::set_parameter(const String& p_name, const Variant& p_property) { + if (!_event.is_valid()) { return; } + + Parameter* parameter {find_parameter_by_name(p_name)}; + + if (!parameter) { return; } + + parameter->value = p_property; + + #ifdef TOOLS_ENABLED + if (!Engine::get_singleton()->is_editor_hint()) { + #endif + apply_parameters(); + #ifdef TOOLS_ENABLED + } + #endif + } + template void FmodEventEmitter::set_paused(bool p_is_paused) { if (!_event.is_valid()) { return; } @@ -696,6 +728,8 @@ namespace godot { void FmodEventEmitter::_bind_methods() { ClassDB::bind_method(D_METHOD("play"), &Derived::play); ClassDB::bind_method(D_METHOD("stop"), &Derived::stop); + ClassDB::bind_method(D_METHOD("set_parameter", "name", "value"), &Derived::set_parameter); + ClassDB::bind_method(D_METHOD("get_parameter", "name"), &Derived::get_parameter); ClassDB::bind_method(D_METHOD("is_paused"), &Derived::is_paused); ClassDB::bind_method(D_METHOD("set_paused", "p_is_paused"), &Derived::set_paused); ClassDB::bind_method(D_METHOD("set_event_name", "event_name"), &Derived::set_event_name);