4 // inherited by plugins
8 #include "attachmentpoint.inc"
10 #include "floatauto.inc"
11 #include "floatautos.inc"
12 #include "keyframe.inc"
14 #include "mainprogress.inc"
15 #include "maxbuffers.h"
16 #include "menueffects.inc"
19 #include "mwindow.inc"
21 #include "pluginaclientlad.inc"
22 #include "pluginclient.inc"
23 #include "pluginserver.inc"
42 PluginServer(char *path
);
43 PluginServer(PluginServer
&);
44 virtual ~PluginServer();
47 friend class PluginAClientLAD
;
48 friend class PluginAClientConfig
;
49 friend class PluginAClientWindow
;
51 // open a plugin and wait for commands
52 // Get information for plugindb if master.
53 #define PLUGINSERVER_IS_LAD 2
54 #define PLUGINSERVER_NOT_RECOGNIZED 1
55 #define PLUGINSERVER_OK 0
56 int open_plugin(int master
,
66 void set_title(char *string
);
67 // Generate title for display
68 void generate_display_title(char *string
);
69 // Get keyframes for configuration
70 KeyFrame
* get_prev_keyframe(int64_t position
);
71 KeyFrame
* get_next_keyframe(int64_t position
);
72 int64_t get_source_start();
73 // Get interpolation used by EDL
74 int get_interpolation_type();
75 // Get or create keyframe for writing, depending on editing status
76 KeyFrame
* get_keyframe();
77 // Create new theme object
83 // =============================== for realtime plugins
84 // save configuration of plugin
85 void save_data(KeyFrame
*keyframe
);
86 // Update EDL and playback engines to reflect changes
87 void sync_parameters();
88 // set for realtime processor usage
89 int set_realtime_sched();
93 // cause the plugin to show the GUI
95 // Update GUI with keyframe settings
98 void client_side_close();
101 int set_string(char *string
); // set the string that appears on the plugin title
102 // give the buffers and sizes and prepare processing realtime data
103 int init_realtime(int realtime_sched
,
104 int total_in_buffers
,
106 // process the data in the buffers
107 void process_realtime(VFrame
**input
,
109 int64_t current_position
,
110 int64_t total_len
); // Total len for transitions
111 void process_realtime(double **input
,
113 int64_t current_position
,
114 int64_t fragment_size
,
116 // Called by rendering client to cause the GUI to display something with the data.
117 void send_render_gui(void *data
);
118 void send_render_gui(void *data
, int size
);
119 // Called by MWindow to cause GUI to display
120 void render_gui(void *data
);
121 void render_gui(void *data
, int size
);
123 // Send the boundary autos of the next fragment
124 int set_automation(FloatAutos
*autos
, FloatAuto
**start_auto
, FloatAuto
**end_auto
, int reverse
);
128 // set the fragment position of a buffer before rendering
129 int arm_buffer(int buffer_number
,
130 int64_t in_fragment_position
,
131 int64_t out_fragment_position
,
132 int double_buffer_in
,
133 int double_buffer_out
);
134 // Detach all the shared buffers.
135 int detach_buffers();
137 int send_buffer_info();
145 // ============================ for non realtime plugins
146 // start processing data in plugin
147 int start_loop(int64_t start
, int64_t end
, int64_t buffer_size
, int total_buffers
);
148 // Do one iteration of a nonrealtime plugin and return if finished
149 int process_loop(VFrame
**buffers
, int64_t &write_length
);
150 int process_loop(double **buffers
, int64_t &write_length
);
152 int read_frame(VFrame
*buffer
, int channel
, int64_t start_position
);
153 int read_samples(double *buffer
, int channel
, int64_t start_position
, int64_t total_samples
);
154 int read_samples(double *buffer
, int64_t start_position
, int64_t total_samples
);
156 // For non realtime, prompt user for parameters, waits for plugin to finish and returns a result
157 int get_parameters();
158 int get_samplerate(); // get samplerate produced by plugin
159 double get_framerate(); // get framerate produced by plugin
160 int get_project_samplerate(); // get samplerate of project data before processing
161 double get_project_framerate(); // get framerate of project data before processing
162 int set_path(char *path
); // required first
163 // Used by PluginArray and MenuEffects to get user parameters and progress bar.
164 // Set pointer to mwindow for opening GUI and reconfiguring EDL.
165 void set_mwindow(MWindow
*mwindow
);
166 // Used in VirtualConsole
167 // Set pointer to AttachmentPoint to render GUI.
168 void set_attachmentpoint(AttachmentPoint
*attachmentpoint
);
169 // Set pointer to a default keyframe when there is no plugin
170 void set_keyframe(KeyFrame
*keyframe
);
171 // Set pointer to menueffect window
172 void set_prompt(MenuEffectPrompt
*prompt
);
173 int set_interactive(); // make this the master plugin for progress bars
174 // add track to the list of affected tracks for a non realtime plugin
175 int set_module(Module
*module
);
176 int set_error(); // flag to send plugin an error on next request
177 MainProgressBar
* start_progress(char *string
, int64_t length
);
179 int64_t get_written_samples(); // after samples are written, get the number written
180 int64_t get_written_frames(); // after frames are written, get the number written
184 int64_t out_buffer_size
; // size of a send buffer to the plugin
185 int64_t in_buffer_size
; // size of a recieve buffer from the plugin
186 int total_in_buffers
;
187 int total_out_buffers
;
189 // number of double buffers for each channel
190 ArrayList
<int> ring_buffers_in
;
191 ArrayList
<int> ring_buffers_out
;
192 // Parameters for automation. Setting autos to 0 disables automation.
193 FloatAuto
**start_auto
, **end_auto
;
197 // size of each buffer
198 ArrayList
<int64_t> realtime_in_size
;
199 ArrayList
<int64_t> realtime_out_size
;
201 // When arming buffers need to know the offsets in all the buffers and which
202 // double buffers for each channel before rendering.
203 ArrayList
<int64_t> offset_in_render
;
204 ArrayList
<int64_t> offset_out_render
;
205 ArrayList
<int64_t> double_buffer_in_render
;
206 ArrayList
<int64_t> double_buffer_out_render
;
208 // don't delete buffers if they belong to a virtual module
210 // Send new buffer information for next render
214 int plugin_open
; // Whether or not the plugin is open.
215 // Specifies what type of plugin.
216 int realtime
, multichannel
, fileio
;
217 // Plugin generates media
219 // What data types the plugin can handle. One of these is set.
220 int audio
, video
, theme
;
223 // Plugin is a transition
225 // name of plugin in english. Compared against the title value in the plugin.
227 int64_t written_samples
, written_frames
;
228 char *path
; // location of plugin on disk
229 char *data_text
; // pointer to the data that was requested by a save_data command
232 int error_flag
; // send plugin an error code on next request
233 ArrayList
<Module
*> *modules
; // tracks affected by this plugin during a non realtime operation
234 AttachmentPoint
*attachmentpoint
;
236 // Pointer to keyframe when plugin is not available
238 AttachmentPoint
*attachment
;
239 // Storage of keyframes and GUI status
241 // Storage of session parameters
243 MenuEffectPrompt
*prompt
;
248 // Icon for Asset Window
252 int reset_parameters();
253 int cleanup_plugin();
255 // Base class created by client
256 PluginClient
*client
;
257 // Handle from dlopen. Plugins are opened once at startup and stored in the master
260 // Pointers to C functions
261 PluginClient
* (*new_plugin
)(PluginServer
*);
265 LADSPA_Descriptor_Function lad_descriptor_function
;
266 const LADSPA_Descriptor
*lad_descriptor
;