Banuba SDK
Loading...
Searching...
No Matches
effect_manager.hpp
Go to the documentation of this file.
1/// \file
2/// \addtogroup EffectPlayer
3/// @{
4///
5// AUTOGENERATED FILE - DO NOT MODIFY!
6// This file was generated by Djinni from effect_player.djinni
7
8#pragma once
9
11#include <bnb/utils/defs.hpp>
12#include <cstdint>
13#include <memory>
14#include <string>
15
16namespace bnb { namespace interfaces {
17
18class effect;
19class effect_activated_listener;
20class effect_event_listener;
21class error_listener;
22class hint_listener;
23class reload_result;
24struct effect_info;
25struct surface_data;
26
27class BNB_EXPORT effect_manager {
28public:
29 virtual ~effect_manager() {}
30
31 /**
32 * Add callback to receive errors messages from Effect Player.
33 * Thread-safe. May be called from any thread
34 */
35 virtual void add_error_listener(const std::shared_ptr<error_listener> & error_listener) = 0;
36
37 /**
38 * Remove callback to receive errors messages from Effect Player.
39 * Thread-safe. May be called from any thread
40 */
41 virtual void remove_error_listener(const std::shared_ptr<error_listener> & error_listener) = 0;
42
43 /**
44 * Add callback to receive user-visible messages from effects.
45 * You should display them on UI.
46 * Thread-safe. May be called from any thread
47 */
48 virtual void add_hint_listener(const std::shared_ptr<hint_listener> & hint_listener) = 0;
49
50 /**
51 * Remove callback to receive user-visible messages from effects.
52 * Thread-safe. May be called from any thread
53 */
54 virtual void remove_hint_listener(const std::shared_ptr<hint_listener> & hint_listener) = 0;
55
56 /**
57 * Add callback to receive events from effect.
58 * Thread-safe. May be called from any thread
59 */
60 virtual void add_effect_event_listener(const std::shared_ptr<effect_event_listener> & effect_event_listener) = 0;
61
62 /**
63 * Remove callback to receive events from effect.
64 * Thread-safe. May be called from any thread
65 */
66 virtual void remove_effect_event_listener(const std::shared_ptr<effect_event_listener> & effect_event_listener) = 0;
67
68 /**
69 * Add callback to receive notifications on effect change.
70 * Thread-safe. May be called from any thread
71 */
72 virtual void add_effect_activated_listener(const std::shared_ptr<effect_activated_listener> & effect_activated_listener) = 0;
73
74 /**
75 * Remove callback to receive notifications on effect change.
76 * Thread-safe. May be called from any thread
77 */
78 virtual void remove_effect_activated_listener(const std::shared_ptr<effect_activated_listener> & effect_activated_listener) = 0;
79
80 /** Create empty effect. If working directory path is empty string then effect assumed as an in-memory effect. */
81 virtual std::shared_ptr<effect> create_effect(const std::string & work_dir) const = 0;
82
83 /**
84 * Set current effect.
85 * Thread-safe. May be called from any thread
86 */
87 virtual void set_current_effect(const std::shared_ptr<effect> & effect) = 0;
88
89 /**
90 * Load and activate effect sync.
91 * MUST be called from the render thread.
92 */
93 virtual std::shared_ptr<effect> load(const std::string & url) = 0;
94
95 /**
96 * Load effect async, activate in the draw() call when it will be ready.
97 * Thread-safe. May be called from any thread.
98 */
99 virtual std::shared_ptr<effect> load_async(const std::string & url) = 0;
100
101 /**
102 * Reload current effect config from the string provided. If this reload
103 * is possible without effect recreation, this method will return `hot_reload == true`,
104 * otherwise `current` effect will be replaced and the method will return
105 * `hot_reload == false`.
106 *
107 * Thread-safe. May be called from any thread.
108 */
109 virtual std::shared_ptr<reload_result> reload_config(const std::string & config) = 0;
110
111 /**
112 * Get effect info. May be called before loading effect
113 * "render type" and "recognizer features" fields won't be filled
114 * Thread-safe. May be called from any thread
115 */
116 static effect_info get_effect_info(const std::string & url);
117
118 /**
119 * Unload effect from cache. if no currently loading effect -
120 * works the same way as load(""); launches empty effect loading.
121 * MUST be called from the render thread
122 */
123 virtual void unload(const std::shared_ptr<effect> & effect) = 0;
124
125 /**
126 * Get active effect
127 * Thread-safe. May be called from any thread
128 */
129 virtual std::shared_ptr<effect> current() const = 0;
130
131 /**
132 * Update effect loading state
133 * @param sync syncronize effect manager, block until effect loaded
134 * MUST be called from the render thread
135 */
136 virtual void update(bool sync) = 0;
137
138 /**
139 * Get current effect size
140 * Thread-safe. May be called from any thread
141 */
142 virtual ::bnb::interfaces::size effect_size() const = 0;
143
144 /**
145 * Get current surface size
146 * Thread-safe. May be called from any thread
147 */
148 virtual ::bnb::interfaces::size surface_size() const = 0;
149
150 /**
151 * Get effect audio volume.
152 * Thread-safe. May be called from any thread
153 * @return A volume in range `[0, 1]`, where `1` means maximum volume.
154 */
155 virtual float effect_volume() const = 0;
156
157 /**
158 * Set effect audio volume.
159 * Thread-safe. May be called from any thread
160 * @param volume A value in range `[0, 1]`, where `1` means maximum volume.
161 */
162 virtual void set_effect_volume(float volume) = 0;
163
164 /**
165 * Changes effect player render size, should be called on render thread.
166 * MUST be called from the render thread
167 */
168 virtual void set_effect_size(int32_t fx_width, int32_t fx_height) = 0;
169
170 /** set different render surfaces. Can be treated as void* */
171 virtual void set_render_surface(const surface_data & data) = 0;
172
173 /** disable surface presentation. Needed for offscreen rendering */
175};
176
177} } // namespace bnb::interfaces
178/// @}
179
Interface to receive notifications on effect change.
Callback interface for effect events.
virtual::bnb::interfaces::size surface_size() const =0
Get current surface size Thread-safe.
virtual::bnb::interfaces::size effect_size() const =0
Get current effect size Thread-safe.
virtual void remove_effect_event_listener(const std::shared_ptr< effect_event_listener > &effect_event_listener)=0
Remove callback to receive events from effect.
virtual void add_hint_listener(const std::shared_ptr< hint_listener > &hint_listener)=0
Add callback to receive user-visible messages from effects.
virtual void unload(const std::shared_ptr< effect > &effect)=0
Unload effect from cache.
static effect_info get_effect_info(const std::string &url)
Get effect info.
virtual std::shared_ptr< effect > current() const =0
Get active effect Thread-safe.
virtual void add_effect_activated_listener(const std::shared_ptr< effect_activated_listener > &effect_activated_listener)=0
Add callback to receive notifications on effect change.
virtual void add_effect_event_listener(const std::shared_ptr< effect_event_listener > &effect_event_listener)=0
Add callback to receive events from effect.
virtual void remove_hint_listener(const std::shared_ptr< hint_listener > &hint_listener)=0
Remove callback to receive user-visible messages from effects.
virtual float effect_volume() const =0
Get effect audio volume.
virtual void add_error_listener(const std::shared_ptr< error_listener > &error_listener)=0
Add callback to receive errors messages from Effect Player.
virtual void remove_error_listener(const std::shared_ptr< error_listener > &error_listener)=0
Remove callback to receive errors messages from Effect Player.
virtual void set_effect_size(int32_t fx_width, int32_t fx_height)=0
Changes effect player render size, should be called on render thread.
virtual void set_current_effect(const std::shared_ptr< effect > &effect)=0
Set current effect.
virtual std::shared_ptr< reload_result > reload_config(const std::string &config)=0
Reload current effect config from the string provided.
virtual void set_render_surface(const surface_data &data)=0
set different render surfaces.
virtual void disable_surface_presentation()=0
disable surface presentation.
virtual std::shared_ptr< effect > load_async(const std::string &url)=0
Load effect async, activate in the draw() call when it will be ready.
virtual void remove_effect_activated_listener(const std::shared_ptr< effect_activated_listener > &effect_activated_listener)=0
Remove callback to receive notifications on effect change.
virtual void update(bool sync)=0
Update effect loading state.
virtual std::shared_ptr< effect > load(const std::string &url)=0
Load and activate effect sync.
virtual void set_effect_volume(float volume)=0
Set effect audio volume.
virtual std::shared_ptr< effect > create_effect(const std::string &work_dir) const =0
Create empty effect.
Interface to receive errors from EffectPlayer.
Callback to receive "hints" (e.g.
Data for creating surface.